facebook

Unable to get values of form fields using FormBean-Struts

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #316569 Reply

    ajaym
    Member

    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;
    }
    }

    #316616 Reply

    support-joy
    Member

    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

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Unable to get values of form fields using FormBean-Struts

You must be logged in to post in the forum log in