3 回答

TA貢獻1785條經(jīng)驗 獲得超8個贊
要想在提交jsp后仍然保留原來的值可以通過以下方法實現(xiàn):
1、首先在jsp頁面上input的property值不能相同,如下:<html:input property="testBox1" value="chargeStat01">測試文本1</html:input >
2、后臺Java代碼:
public class ChargeStatForm extends ActionForm {
private String testBox;
public String getTestBox() {
return testBox;
}
public void setTestBox(String testBox) {
this.chargeStatChargeItemInput="";
this.testBox = testBox;
}
}
這樣就可以讓提交之后出現(xiàn)錯誤信息之后多選框不被置空,而是原先選中什么現(xiàn)在還選中什么的狀態(tài)。

TA貢獻1725條經(jīng)驗 獲得超8個贊
你把這個文本框放在表單內(nèi),一起提交,在處理方法內(nèi)獲得文本框的值,然后保存在作用域內(nèi),可以是request,response,session等等,
如:request.setAttribute("textName", "textValu");
然后在文本框的代碼這樣寫就可以了:
<input type="text" name="textName" value="${textName}"/>
這樣,在你處理完跳轉(zhuǎn)回這個頁面時,上次輸入的值就會顯示了!
添加回答
舉報