edit form using struts
hello everyone..
i have made a user registration page in my web application.Now once the user logs in he can edit his data inputed during registration.I'm using struts1.1..Now when user clicks on the edit info the registration page should be displayed along with the data what he has entered earlier and then he will edit and finally save.Can anyone one give me the flow to do so..I know that using simple jsp and servlet we can do so by sending the data from servlet to jsp page by request.setParameter(""); then in jsp page we retrive the value by request.getParameter(" ");But i'm not clear about the flow in struts..can anyone explain me how to do in struts.
I'v done the code ,but when i click on the link no exception is throws,neither i get the value printed in console and neither tomcat shows any error...her's the struts-config.xml
<action path="/EdtCompInf"
type="com.goldenembryo.company.CompanyInfoAction">
<forward name="success"
path="/pages/CompanyRegistration.jsp"/>
<forward name="failure"
path="/pages/logon.jsp"/>
</action>
from CompanyInfoAction.java i call on another class where i connect to database and the query is fired there..But once i get the result of the query how to pass it to the jsp page input field to display the data which is to be edited...
hai
First, you need to create one class in which your database coding has to come, at the same time you have to store those results in ArrayList, then call that class with that particular method in your ActionClass which returns ArrayList.
Second, In your success jsp page you need to iterate those ArrayList then you can view the details in your jsp.
Third, you create link for edit jsp page which has to contain the corresponding text fields to get the input to updata and write ActionForm as well as ActionClass to receive those input write necessary coding for updation... thats it...
in struts-config.xml....
<action path="/Edit"
type="your ActionClass name"
name="your form been name"
scope="request"
input="/your edit.jsp">
<forward name="success" path="/List.do"/>
</action>
Note:" the List.do is the jsp page which has to show the old details in your ArrayList"
Regards
Thilak