简体   繁体   中英

Action form in struts

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM