In the OA project, how does one implement Select, Radio, and oassh in SSH?
1. Today I learned how to implement Select and Radio on the front-end of the page under SSH. I personally think it is important to take notes here, which can be used in many places.
2. First, the effect is as follows using the struts2 tag. First, let's look at Select:
<Select name = "departmentId" class = "SelectStyle"> <option value = "0" selected = "selected"> select a department </option> <option value = "7"> Executive General Manager </option> <option value = "1"> marketing department </option> <option value = "2"> consulting Department </option> <option value = "3"> internal recruitment department </option> <option value = "4"> internal Education Department </option> <option value = "5"> Internal Logistics Department </option> </ select>
The above code is static and is directly displayed on the page without passing through the database. The struts2 label is used to dynamically display the department information. The Code is as follows:
<S: select name = "departmentId" cssClass = "SelectStyle" list = "# departmentList" listKey = "id" listValue = "name" headerKey = "" headerValue = "Please select a department"> </s: select>
Explanation:
List: each Select tag has a list attribute, which indicates the DepartmentList (Set of departments) that we have prepared in the background. For details, see the list method in DepartmentAction in the previous article ), the reason for adding the # number is that we saved the Department set in the Map of the value stack in the Action.
ListKey: When we select a department from the drop-down list and submit it for storage, the id is actually transmitted at the front-end, so the listKey is the department id. (Submitted for short)
ListValue: what we see on the page is actually the name attribute of the department. Therefore, listValue indicates the display of the page by the name.
(For short, used for display)
Name: This attribute is clear to everyone. It indicates this label. The server needs to obtain its value in the background. Therefore, the DepartmentAction must have the inclumentid attribute and provide the getter and setter methods.
CssClass: to save the original style
HeaderKey: if the default value is "select a department", the key is the default value id, which is not empty here.
HeaderValue: Default Value of Select
3. The original code is as follows:
<Input type = "RADIO" name = "sex" value = "male" id = "male"/> <label for = "male"> male </label> <input type = "RADIO" name = "sex" value = "female" id = "female"/> <label for = "female"> female </label>
Now changed:
<S: radio name = "gender" list = "{'male', 'female '}"> </s: radio>
Explanation:
Name: corresponds to the attribute in Action as above
List: Construct a map # {'male': 'male', 'female: 'female}, where the first male is the key, and the second male value is the male submitted, the page is also displayed as a male, just like the preceding Select. When the key and value are the same, we can simply name the code above, which is more concise. Same as above
Note:
EL and OGNL are written differently (because $ {},%{},#{} often appears in JSP, you must be familiar with ValueStack ):
$ {Expression} in EL expression JSP}
In the OGNL expression Strtus2 (in the custom tag of Struts2, struts. xml ...)
Use the % {expression} in the property value of the custom tag of Struts2 to use OGNL}
In struts. xml, if you want to use OGNL, use $ {expression}
Syntax:
% {Name} indicates that the name attribute is obtained first from the object stack in the value stack.
% {# Name} indicates that the name attribute is obtained from the Map in the value stack.
% {# User. name} indicates the property obtained from the user attribute in the map.
# {'K': 'V', 'k2': 'v2'} indicates building a Map
{'E1 ', 'E2'} indicates building a list
Select, radio, General echo solution program architecture ssh2, the page gets an object, select, radio non-struts2 tag
In html, there is a drop-down list and a single-choice button...
How does one implement OA internal text messages?
Why is a new thread required? J2EE is multithreading.
The solution is as follows:
1. When a user logs on to the database, check whether there is any unread information. If so, a form prompt is displayed. How can this problem be solved ?? The next step is to receive information online. Because it is in the B/S structure, it is more troublesome to receive information. You can only use JAVASCRIPT to write a timer, you can use AJAX or Page Submission to retrieve data from the server every time. If any unread content is found, a prompt is displayed.
2. I know that a technology called JMS is used for communication, but I don't know how to use it.
3. Another solution is to build a C/S-structure communication and combine it with your OA. It is not difficult to do one communication, I personally think the best is the third solution.