S
strutsng
register.jsp is the view page, and when the user click submit button,
it will go to result.jsp based on struts-config.xml. The followings
are the code fragment of each significant files.
My question is for result.jsp, I am now using
request.getParameter("name")
to get the name property specified in the form. It is working code,
I just want to ask if this is the best appraoch in struts application?
Please advise. thanks!!
register.jsp
=============
<html:form action="register.do">
<P>Name: <html:text property="name"></html:text>
<P>Address: <html:text property="address"></html:text>
<P>ZIP: <html:text property="zip"></html:text>
<html:submit>Register Online</html:submit>
</html:form>
result.jsp
==========
<H3>Name = <%= request.getParameter("name") %></H3>
struts-config.xml
=================
<action-mappings>
<action name="registerFormBean" path="/register" scope="request"
type="com.insights.struts.actions.RegisterAction" input="register.jsp">
<forward name="success" path="/result.jsp"/>
</action>
</action-mappings>
RegisterAction.java
===================
public ActionForward execute(...)
{
//etc...
forward = mapping.findForward("success");
}
it will go to result.jsp based on struts-config.xml. The followings
are the code fragment of each significant files.
My question is for result.jsp, I am now using
request.getParameter("name")
to get the name property specified in the form. It is working code,
I just want to ask if this is the best appraoch in struts application?
Please advise. thanks!!
register.jsp
=============
<html:form action="register.do">
<P>Name: <html:text property="name"></html:text>
<P>Address: <html:text property="address"></html:text>
<P>ZIP: <html:text property="zip"></html:text>
<html:submit>Register Online</html:submit>
</html:form>
result.jsp
==========
<H3>Name = <%= request.getParameter("name") %></H3>
struts-config.xml
=================
<action-mappings>
<action name="registerFormBean" path="/register" scope="request"
type="com.insights.struts.actions.RegisterAction" input="register.jsp">
<forward name="success" path="/result.jsp"/>
</action>
</action-mappings>
RegisterAction.java
===================
public ActionForward execute(...)
{
//etc...
forward = mapping.findForward("success");
}