UI Tags: tags used in JSP pages to echo data, which are defined by the framework to replace native tags. UI tags are: <s:textfield name= "xxx" ></s:textfield> <s:password name= "xxx" showpassword= "Trus" ></s: password> <s:select name= "xxx" list= "xx" listkey=. Listvalue=. Headervalue=. ><s/select> <s:checkboxlist list= "#pList" name= "pid" listkey= "pid" listvalue= "PName" ></s: Checkboxlist> need to echo the data to be placed in the valuestack, can be placed in the map stack, can also be placed in the object stack, there are two cases in the object stack: First, the data is encapsulated into a bean, the bean is placed in the object stack, and the other is to set the Action property, The Action property is in the object stack;
put data in 1.Action:
PublicclassUiactionextendsactionsupport{PrivateString username;PrivateString password; PublicString GetUserName () {returnUsername; } PublicvoidSetusername (String username) { This. Username = Username; } PublicString GetPassword () {returnpassword; } PublicvoidSetPassword (String password) { This. Password = password; }/** * 1. Echo the data in the form: The data is in the object stack and can be echoed directly based on the name data of the form element. * User name: <s:textfield name= "username" ></s:textfield><br/> Password: <s:password name= "pass Word "showpassword=" true "></s:password><br/> *@return*/ PublicString Showdatafromobjstack () {User user =NewUser (); User.setpassword ("AAA"); User.setusername ("BBB"); Actioncontext. GetContext (). Getvaluestack (). push (user);return"User_objstack"; }/** * echo data from the map stack, S:textfield's Value property cannot be directly followed by OGNL expression, so you need to add%{OGNL expression} * User name: <s:textfiel D name= "username" value= "%{#user. Username}" ></s:textfield><br/> password: <s:password name= "PA ssWOrd "showpassword=" true "value="%{#user. Password} "></s:password><br/> *@return* */ PublicString Showdatafrommap () {User user =NewUser (); User.setpassword ("111"); User.setusername ("Zhangsan"); Actioncontext. GetContext (). Put ("user", user);return"User_map"; The properties in the/** * action are in the object stack and can be echoed directly using value on Echo: * User name: <s:textfield name= "username" ></s:text field><br/> Password: <s:password name= "Password" showpassword= "true" ></s:password><br/& Gt *@return*/ PublicString Showdatafromactionproperty () { This. Username = "Lisi"; This. Password = "ASFD";return "User_actionproperty" ; } /** * Use s:select tag to display drop-down selection box, must have List property; * jsp: Select Province: <s:select Name= " pid" list= "#pList" listkey= "pid" listvalue= "PName" headerkey= "" headervalue= "please select Province" ></s:select > <br/> * Translated code: * Select Province: <select id= "UiAction_form_ Action_pid "Name=" pid > <option value= "" > Please select Province </option> <option value= "1" > Beijing </option> <option value= "2" > Shanghai </option> <option value= "3" > Chongqing city </option> </select> * @return*/ PublicString Putdatatoselect () {list<privice> pList = |