You're creating a new ActionForm instead of using the one provided to you. --- [EMAIL PROTECTED] wrote:
> It doesn't seem to work. I am not getting the value > which I am setting in > TestAction.java in the ActionForm.jsp. Here is what > i did, (its a test > app), Please have a look at it and correct me: > > struts_config.xml > > <struts-config> > <form-beans> > <form-bean > name="processForm" > type="app.ProcessForm"/> > > </form-beans> > > <global-forwards> > <forward > name="welcome" > path="/Welcome.do"/> > </global-forwards> > > <action-mappings> > <action > path="/Welcome" type="app.TestAction" > name="processForm" > validate="false"> > <forward name="test" > path="/pages/AcceptForm.jsp" > /> > </action> > <action > path="/ProcessAction" > type="app.ProcessAction" > name="processForm" > scope="session" > validate="false" > input="/pages/Input.jsp"> > <forward name="end" > path="/pages/End.jsp"/> > </action> > <action > path="/Page1Action" > parameter="/pages/End.jsp" > > type="org.apache.struts.action.ForwardAction"/> > > </action-mappings> > <message-resources parameter="MessageResources" > /> > > <plug-in > className="org.apache.struts.tiles.TilesPlugin" > > <set-property property="definitions-config" > > value="/WEB-INF/tiles-defs.xml" /> > <set-property property="moduleAware" > value="true" /> > <set-property > property="definitions-parser-validate" value="true" > /> > </plug-in> > > <plug-in > className="org.apache.struts.validator.ValidatorPlugIn"> > <set-property > property="pathnames" > > value="/org/apache/struts/validator/validator-rules.xml, > /WEB-INF/validation.xml"/> > </plug-in> > </struts-config> > > ProcessForm.java > > public class ProcessForm extends ActionForm { > private String salutation; > private String name; > private String username; > private String password; > private String email; > static final long serialVersionUID = 1; > > public String getEmail() { > return email; > } > public void setEmail(String email) { > this.email = email; > } > public String getName() { > return name; > } > public void setName(String name) { > this.name = name; > } > public String getPassword() { > return password; > } > public void setPassword(String password) { > this.password = password; > } > public String getSalutation() { > return salutation; > } > public void setSalutation(String salutation) > { > this.salutation = salutation; > } > public String getUsername() { > return username; > } > public void setUsername(String username) { > this.username = username; > } > } > > TestAction.java > > public class TestAction extends Action { > > public ActionForward execute(ActionMapping > arg0, ActionForm arg1, > HttpServletRequest arg2, HttpServletResponse arg3) > throws Exception { > ProcessForm processForm = new > ProcessForm(); > processForm.setUsername("Its > Successful"); > return arg0.findForward("test"); > } > } > > AcceptForm.jsp > > <%@ taglib uri="struts-html" prefix="html" %> > > <html> > <head> > <title>Start Page</title> > </head> > <body> > <h2>Trial Form</h2> > <html:form action="/ProcessAction"> > User Name: <html:text > property="username"/><br/> > Password: <html:password > property="password"/><br/> > Email: <html:text property="email"/><br/> > <html:submit value="Submit"/> > </html:form> > </body> > </html> > > Thank you > -H > > > > "Slattery, Tim - BLS" <[EMAIL PROTECTED]> > 10/18/2007 11:55 AM > > Please respond to > "Struts Users Mailing List" <user@struts.apache.org> > > > To > "Struts Users Mailing List" <user@struts.apache.org> > cc > > Subject > RE: (beginner) How to intialize a form's input item > > > > > > > > My requirement: Prepopulate a form feild if value > is present. > > > Can anybody help me in intializing a input feild > using struts > > custom tags? > > The tags look for a corresponding property in the > form bean, and take an > initial value from that. For example, if this tag is > in you JSP file: > > <html:text property="name"/> > > Struts will call the getter method "String > getName()" in your form bean. > Whatever that method returns will be the starting > value in the text box. > > -- > Tim Slattery > [EMAIL PROTECTED] > > > === message truncated === --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]