---------in useradd.jsp
Post add
<s:select name= "Roleids" multiple= "true" size= "ten" list= "#roleList" listkey= "id" listvalue= "name" ></S: Select> Ctrl-click to select or deselect
Department add
<s:select name= "DepartmentID" list= "#departmentList" listkey= "id" listvalue= "name" headerkey= "" headervalue= " Please select the Department ></s:select>
---------in Useraction
Post add
Private long[] Roleids; Generate get, set method, accept data from foreground
list<role> rolelist = Roleservice.getbyids (roleids);
Model.setroles (New hashset<role> (rolelist));
Userservice.save (model);
Department add
Private Long DepartmentID; Generate get, set method, accept data from foreground
Department Department = Departmentservice.getbyid (DepartmentID);
Model.setdepartment (department);
Userservice.save (model);
Modify and add page save.jsp---------
<s:form action= "Useraction_%{id = = null? ' Add ': ' Edit ' >
<s:hidden name= "id" ></s:hidden>
<s:radio name= "Gender" list= "%{{' male ', ' Woman '}" ></s:radio>
If Judgment------------
<s:if test= "#parent! = null" >
<s:a action= "departmentaction_list?parentid=%{#parent. parent.id}" > Return to the top level </s:a>
</s:if>
------------------------------------------------------------------------
Actioncontext.getcontext (). Put ("key", value);//Put in a value stack map
Actioncontext.getcontext (). Getvaluestack (). push (role); Put it on top of the stack, find the stack and find the map.
-------------------------------------------------------------------------
Template:
Many-to-one:
<many-to-one name= "" class= "" column= "" ></many-to-one>
Pair of more:
<set name= "" >
<key column= "" ></key>
<one-to-many class= ""/>
</set>
Many-to-many:
<set name= "" table= "" >
<key column= "" ></key>
<many-to-many class= "" column= "" ></many-to-many>
</set>
----------------------------------------------------------------------------
Number of requests Address bar
Forwarding 1 unchanged
REDIRECT 2 variable
----------------------------------------------------------------------------
Action Method name return value page
List () listlist.jsp
Remove Delete () toList
Add Page Addui () adduiaddui.jsp
Added Add () toList
Modify Page Editui () edituieditui.jsp
Modify edit () toList
Result configuration for ToList:
<result name= "toList" type= "Redirectaction" >roleAction_list</result>
OA Project---Notes