Action form in struts

694 Views Asked by At

can we use two form in single jsp ? i am using struts with hibernate and in hibernate i have many- to one mapping

< class name="com.dto.EmployeeDTO" table="EMPLOYEEDTO">
        < id name="id" type="java.lang.String">
            < column name="ID" />
            < generator class="assigned" />
        < /id>
        < property name="fName" type="java.lang.String" access="field">
            < column name="FNAME" />
        < /property>
        < property name="lName" type="java.lang.String" access="field">
            < column name="LNAME" />
        < /property>
        < many-to-one name="address" class="com.dto.Address" fetch="join">
            < column name="ADDRESS" />
        < /many-to-one>
    < class>

in my employee pojo

private String id;
private String fName;
private String lName;
private Address address;

now i want to submit all data with one form

2

There are 2 best solutions below

0
On

yes we can more than two forms in jsp. Each form can have different or same actions.

0
On

That would be multiple normal forms to a JSP, but he is asking about Strut action forms. If you want to have clean your MVC model I would recommend 1 action form per view, but its possible to have more than one action form, example, multiple data forms in a single page, or even a single button can trigger a different action, that some controller need to handle.