Struts 1 Form submision

63 Views Asked by At

How to create Struts 1 form? i have created the app on struts 1 and completed the struts-config.xml and web.xml mapping i am also retrieving the values from the jsp.page but not sure what tag i need to use in form to capture them with javascript and submit the to action class. I have done lots of googling but can not find resources.

Done googling but can not find any resources on how to create struts 1 form and what tags i need to use to update the values with javaScript.

1

There are 1 best solutions below

1
On

this is my html code for struts.

 <td><html:select property="empId" styleId="empId"
                            onchange="getEmployee()">
                            <html:option value="">---None---</html:option>
                            <html:options property="employeeId" />
                        </html:select></td>

and i am using jquery and ajax so i think same for java script

    function getEmployee() {
        let empId = $('#empId').val();
       alart(empId);
}

and this is how you get id in ActionClass

 String id = request.getParameter("id");
        Long sId = 0L;
        if (id != null) {
            try {
                sId = Long.parseLong(id);
            } catch (Exception e) {
            }
   System.out.println(sId );
}