0
我需要使用@SessionScope使清單在刷新後留在頁面中,但是當我使用它時,Stripes:錯誤不再顯示。 Stripes:實際上運行錯誤(因爲我看不到任何事情會發生),但它只是不再顯示頁面中的錯誤消息。我確信@SessionScope有一些東西,因爲當我運行代碼時沒有顯示頁面中顯示的所有錯誤。 任何想法如何解決這個問題?條紋@SessionScope隱藏條紋:錯誤
注意:我也嘗試使用@Wizard(startEvents =「event」),它可以讓錯誤顯示,但是不會對保存頁面中的列表做任何事情!
的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"/>
不應該在userCheckBox上使用@Validate,以便您不必執行手動錯誤檢查? – lumpynose 2015-02-11 06:35:33