- This topic has 1 reply, 2 voices, and was last updated 14 years ago by
support-joy.
-
AuthorPosts
-
ajaymMemberHi,
I am using Struts 1.2.x and wish have mmediate help on the following issue.Issue : Unable to get values of form fields using FormBean using Struts
Details :
—-> JSP page having 3 fields Cityname, state name and country name. having HTML tags as follows :<form action=””../CityAction.do?action=submitCityMasterData”” name=”form2″ method=”post”>
——> Input type line
<input type=”button” value=”Submit” class=”g_button” onclick=”submit()” />—————————————-
struts-config.xml file has following entries for beans and mappings :<form-beans>
<form-bean name=”cityMasterFormBean” type=”com.buhariwalas.app.form.cityMaster.CityMast erFormBean”/>
</form-beans><action-mappings>
</action>
<action path=”/CityAction”
type=”com.buhariwalas.app.action.cityMaster.CityAc tion”
parameter=”action”
scope=”request”
name=”cityMasterFormBean”>
</action>————————–
can anyone tell me why the following code in SubmitCityAction.java prints null values :
public class SubmitCityAction {
private ActionForward nextPage = null;
private CityMasterFormBean cityForm = null;
/*———————————————————————–*/
public ActionForward submitCityMasterData(ActionMapping mapping, ActionForm form,
HttpServletRequest request,HttpServletResponse response){private CityMasterFormBean cityForm = null;
cityForm = (CityMasterFormBean)form ;
System.out.println(“City Form Values = “+
“\ncity = “+cityForm.getCity_name()+”,”+
“\nstate = “+cityForm.getState_name()+”,”+
“\ncountry = “+cityForm.getCountry_name() );nextPage = mapping.findForward(“mainPage”);
return nextPage;
}
}
support-joyMemberajaym,
Below is the link to the tutorial where you can refer to struts 1.2.x
http://www.roseindia.net/struts/strutsActionForms.shtml
Thanks
-
AuthorPosts