我需要使用@SessionScope使列表在刷新后留在页面中,但当我使用它时,Stripes:error不再显示。条纹:错误实际上会运行(因为我认为什么都不会发生),但它只是不再在页面中显示错误消息。我确信@SessionScope中有一些东西,因为当我运行没有它的代码时,所有的错误都会显示在页面中。你知道怎么解决这个问题吗?
注意:我还尝试使用@Wizard(startEvents=“事件”),它允许显示错误,但不会在页面中保存列表!
java
@SessionScope
@UrlBinding("/Student/import.action")
public class ImportAction implements ActionBean {
private String userCheckBox;
public Resolution importStudents() throws IOException {
if (userCheckBox == null) {
this.getContext().getValidationErrors().add("userCheckBox",new SimpleError(error));
}
return new RedirectResolution("import.action");
}
public String getUserCheckBox() {
return userCheckBox;
}
public void setUserCheckBox(String userCheckBox) {
this.userCheckBox = userCheckBox;
}
}jsp
<stripes:checkbox name="userCheckBox"/>
<stripes:errors field="userCheckBox"/>
<stripes:submit name="importStudents" value="Import"/>发布于 2015-02-11 14:33:24
我不知道这是否是正确的方法,但是如果不使用@SessionScope,如何通过你的子类化的ActionBeanContext直接将列表存储在会话中?例如,我的有
public class IlmpActionBeanContext extends ActionBeanContext {
private static final String REQUEST_TOKEN = "request_token";
public Token getRequestToken() {
return (Token) this.getRequest().getSession()
.getAttribute(IlmpActionBeanContext.REQUEST_TOKEN);
}
public void setRequestToken(final Token requestToken) {
this.getRequest()
.getSession()
.setAttribute(IlmpActionBeanContext.REQUEST_TOKEN, requestToken);
}https://stackoverflow.com/questions/28429034
复制相似问题