1

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

Kumar
  • 955
  • 5
  • 20
  • 50
p27
  • 2,217
  • 1
  • 27
  • 55

2 Answers2

1

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.

0

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

Muhammad Imran Tariq
  • 22,654
  • 47
  • 125
  • 190