我有一个页面,它依赖于一些部分刷新进行交互.我不打算使用保持会话活动机制,但我想捕获部分刷新的错误响应,提醒用户他们的会话已过期/需要刷新,一旦他们执行了window.location.reload承认警报.具体而言,由用户尝试部分刷新(并且本质上,纯粹通过CSJS)进行事件驱动.
我知道使用Chrome DevTools时,部分刷新显示为Post请求,它返回html的部分(刷新区域)加上任何必需的CSJS.我也知道,正如Dojo 1.6中针对dojo.xhr(Post和Get)所记录的那样,它支持一个错误处理参数,通过它我可以传递我想要创建的函数.我目前不确定如何将此函数添加到我的dojo.xhrPost请求中.
看过这个XSnippet,"Dojo xhr请求的缓存预防",它允许在dojo.xhr请求中添加preventCache选项,我觉得这是正确的方法.再一次,这是我不确定的实现.我很失望地发现它引用的链接是源代码,http://www.juliusbuss.de/web/youatnotes/blog-jb.nsf/dx/a-big-issue-for-mobile-web-apps- with-xpages-for-iphone-and-ipad-and-how-to-solve-it..htm,对我不起作用.
会喜欢更有经验的观点.
在xe:对话框(XPages扩展库对话框)中,我想使用XSP.partialRefreshPost函数,但刷新输入的值时会丢失.
以下示例演示了此问题.
我尝试更改属性xe:对话框但没有成功.
如何在xe:对话框中使用XSP.partialRefreshPost进行刷新?
谢谢
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:label id="label1" value="refresh partial"></xp:label>
<xp:comboBox id="comboBox1">
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:return ["1", "2", "3"];}]]></xp:this.value>
</xp:selectItems>
<xp:eventHandler event="onchange" submit="true" refreshMode="partial"refreshId="comboBox1">
</xp:eventHandler>
</xp:comboBox>
<xp:inputText id="inputText1">
<xp:eventHandler event="onchange" submit="true" refreshMode="partial" refreshId="inputText1">
</xp:eventHandler>
</xp:inputText>
<xp:br></xp:br>
<xp:label id="label2" value="refresh XSP.partialRefreshPost"></xp:label>
<xp:comboBox id="comboBox2">
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:return ["1", "2", "3"];}]]></xp:this.value>
</xp:selectItems>
<xp:eventHandler event="onchange" submit="false">
<xp:this.script><![CDATA[XSP.partialRefreshPost("#{id:comboBox2}", {immediate: true});]]></xp:this.script>
</xp:eventHandler>
</xp:comboBox>
<xp:inputText id="inputText2">
<xp:eventHandler event="onchange" submit="false">
<xp:this.script><![CDATA[XSP.partialRefreshPost("#{id:inputText2}", {immediate: true});]]></xp:this.script>
</xp:eventHandler>
</xp:inputText>
<xp:br></xp:br>
<xe:dialog id="dialog1" partialRefresh="true">
<xp:label id="label3" …Run Code Online (Sandbox Code Playgroud) 我在Xpage上编写了一个自定义的rest服务,它与bean绑定.Xpage是:
<xe:restService
id="restServiceCustom"
pathInfo="custom"
ignoreRequestParams="false"
state="false"
preventDojoStore="true">
<xe:this.service>
<xe:customRestService
contentType="application/json"
serviceBean="XXXX.PCServiceBean">
</xe:customRestService>
</xe:this.service>
</xe:restService>
Run Code Online (Sandbox Code Playgroud)
我从网上的一些优秀帖子中拼凑了我的java代理.我刚开始接受GET.我的代码运行但我似乎很慢(在我的开发服务器上).我想尽快做到.我正在使用ViewEntryCollection,我正在"刷新"每个记录,我认为是流式传输.
我在代码中加入了自己的"[",所以我认为我没有做正确的事,因为我从来没有看到任何其他人这样做的例子.
任何建议将不胜感激.
package com.XXXXX.bean;
import java.io.IOException;
import java.io.Writer;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.openntf.domino.Database;
import org.openntf.domino.Session;
import org.openntf.domino.View;
import org.openntf.domino.ViewEntry;
import org.openntf.domino.ViewEntryCollection;
import org.openntf.domino.utils.Factory;
import com.ibm.commons.util.io.json.JsonException;
import com.ibm.commons.util.io.json.util.JsonWriter;
import com.ibm.domino.services.ServiceException;
import com.ibm.domino.services.rest.RestServiceEngine;
import com.ibm.xsp.extlib.component.rest.CustomService;
import com.ibm.xsp.extlib.component.rest.CustomServiceBean;
public class PCServiceBean extends CustomServiceBean {
@Override
public void renderService(CustomService service, RestServiceEngine engine) throws ServiceException {
try {
HttpServletRequest request = engine.getHttpRequest();
HttpServletResponse response = engine.getHttpResponse();
response.setHeader("Content-Type", …Run Code Online (Sandbox Code Playgroud) 我把一个计算字段放在XPages中,然后我通过下面的代码创建了值.每一行都有自己的链接,但在我完成此代码之前,我正在尝试学习如何删除行开头的逗号.必须有另一种方法来做到这一点.我应该使用重复控制等其他设计元素吗?
<xp:text escape="false" id="computedField1" style="font-size:8pt">
<xp:this.value>
<![CDATA[#{javascript:{ var links = ["A1","A2","A3","","A444",""];
for (i=0;i<arr1.length;i++) {
var strText = arr1[i];
if (strText=="") {
strText = "There is no value";
}
links[i] = "<a href="+ arr1[i] + "target=\"_blank\">"+strText+"</a><br>";
}
return links;}]]></xp:this.value>
</xp:text>
Run Code Online (Sandbox Code Playgroud)
任何建议表示赞赏,
Cumhur Ata
我有一个应用程序的主题,在所有xpages中加载许多CSS和METAS.
我的应用程序只需要index.xsp中的所有这些css,其余的页面都是由AJAX加载的,我需要这些页面在没有CSS的情况下加载,基本上没有主题.
有人知道是否可以在RESOURCES中添加"rendered"属性或添加条件来加载一个CSS或其他?我知道我可以在没有主题的情况下从其他NSF加载其他页面,但对我来说只有一个NSF更好
<resource>
<content-type>text/css</content-type>
<href>css/reset.css</href>
</resource>
<resource>
<content-type>text/css</content-type>
<href>css/style.css</href>
</resource>
<resources>
<metaData>
<name>MobileOptimized</name>
<content>320</content>
</metaData>
<metaData>
<name>viewport</name>
<content>width=device-width, initial-scale=1.0,
maximum-scale=1.0, user-scalable=no</content>
</metaData>
</resources>
Run Code Online (Sandbox Code Playgroud)
例如,我有这个用于FORM控件,这个条件对我的应用程序有效.
<control mode="override">
<name>Form</name>
<property>
<name>styleClass</name>
<value>#{javascript:(view.getPageName() == '/index.xsp')?'block wizard same-height':'xspForm'}</value>
</property>
Run Code Online (Sandbox Code Playgroud)
非常感谢
我在一些代码中遇到一个有趣的错误,这些错误与我在其他地方工作的代码几乎相同(至少在结构上).我得到一个"注释错误:索引中找不到条目"错误,它出现在我的ViewNavigator.getNext(ViewEntry)的while循环中.我觉得我在这个问题上遗漏了一些明显的东西,所以希望有人能发现它(我只是盯着它看起来很麻烦).
[更新] Jesse关于将autoUpdate设置为false的说明就行了.它似乎与2002年的技术说明有关,因为我的循环在此循环期间保存到另一个文档(相同的DB,不同的View).我vw.setAutoUpdate(false);在View上定义了句柄后立即放置了.[/更新]
我正在走一个单一类别的视图(通过视图中每个文档的引用字段值)来汇总分组文档中的一些信息.启用调试后,我发现错误发生在我从第一个类别的最后一个Document(ViewEntry of Doc)回到类别(ViewEntry)的遍历中.
这是我的代码的精简版本(// ...表示为清晰起见删除了行):
View vw = db.getView("<ViewName>");
ViewNavigator nav = vw.createViewNav();
ViewEntry first = nav.getFirst();
String unid = "";
while(first != null){
if(first.isCategory()){
if(!unid.isEmpty()){
//summarize the info and save it back to the category-relevant doc
Document myDoc = db.getDocumentByUNID(unid);
//doing my thing
boolean success = myDoc.save(true, false);
myDoc.recycle();
}
unid = "";
}
if(first.isDocument()){
Vector<?> colVals = first.getColumnValues();
if(unid.isEmpty()){
//reset temp aggregation vars back to initial value (e.g.- 0) …Run Code Online (Sandbox Code Playgroud) 我用sessionScope尝试了这个(没用):
在变量'm1'的帮助下,以下Tabs应该是可控的:
<xp:tabbedPanel id="tabbedPanel1"
selectedTab="#{javascript:sessionScope.get('m1')}">
<xp:tabPanel label="Config" id="conf">
<xc:k_conf></xc:k_conf>
</xp:tabPanel>
<xp:tabPanel label="Solution" id="sol">
<xc:k_sol></xc:k_sol>
</xp:tabPanel>
</xp:tabbedPanel>
Run Code Online (Sandbox Code Playgroud)
在控制中,k_conf是一个按钮'calculate',它执行一个代理,然后将可变量'm1'设置为'sol'.我希望,Tab切换到'Solution',但没有任何反应(尽管refreshmode ="complete").
<xp:button value="calculate" id="button1">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
...
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:
...
agent.runWithDocumentContext(docVG.getDocument());
sessionScope.put("m1","sol");
}]]>
</xp:this.script>
</xp:executeScript>
...
</xp:button>
Run Code Online (Sandbox Code Playgroud)
另一种方法是使用组件(因为'TabPanel不允许显示'而无效):
<xp:this.action>
<![CDATA[#{javascript:
var c = getComponent("IdofTab");
c.show("IdofTab");
}]]>
</xp:this.action>
Run Code Online (Sandbox Code Playgroud) 我似乎无法让我的页面在浏览器中居中.我'集中'了我能想到的一切.如果我把任何其他东西放在中心,那么整个宇宙将会成为中心!:-)
任何提示将不胜感激.这是我想要集中的内容:
http://www.labware.com/usrmtgs/chCEC2014.nsf/home.xsp
Run Code Online (Sandbox Code Playgroud)
谢谢你