How to retain data on the view (JSP) if the validation fails in struts

一世执手 提交于 2019-12-13 01:25:22

问题


I am using struts 1.3 and my data on the jsp page gets reset if my validation fails. It displays the error messages coming from the ActionForm from the validate method, but resets my entire jsp. i tried using struts tags instead of html but it is not helping out.

I even tried looking at this https://stackoverflow.com/a/20499877/1771406 but i dint clearly understand what exactly he is trying to say. can anyone one help me by showing some implemented code please.


回答1:


the reason why my code was not working inspite of seting getters and setters and html strut tags was only due to this silly mistake of mine

<html:text property="abc"  value=""/>

when that value attribute was removed it then worked perfectly fine.

correct code:

<html:text property="abc"/>


来源:https://stackoverflow.com/questions/22712685/how-to-retain-data-on-the-view-jsp-if-the-validation-fails-in-struts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!