MyEclipse Forums
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
ajaym
Post subject: Unable to get values of form fields using FormBean-Struts  PostPosted: May 05, 2011 - 12:08 PM
Registered Member
Registered Member


Joined: Feb 18, 2011
Posts: 10

Hi,
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;
}
}
 
 View user's profile Send private message  
Reply with quote Back to top
support-joy
Post subject:   PostPosted: May 06, 2011 - 11:48 AM
Registered Member
Registered Member


Joined: Feb 03, 2009
Posts: 3442

ajaym,

Below is the link to the tutorial where you can refer to struts 1.2.x

http://www.roseindia.net/struts/strutsActionForms.shtml

Thanks

_________________
Joy
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits