WebWork's processing of the page, such as the form element like checkbox, if we just simply set the Boolean value of the field, just like the following processing method, such as If the user selects this check box, the browser will send "user.lockedout = true" in the query string, and OGNL executes action.getuser (). setLockedout (TRUE). If the user does not select the check box, the browser will not send the query string, so at the beginning, make sure that LockedOut is false: private boid setlockedout = false; public void setlockedout (Boolean Lockedout) {m_lockedout = lockedout;}
But more cases, we use it as a check (multiple options), there are two cases to set a collection with checkbox: Yi. CHECKBOX NAME stores many permissions in a STRING type set collection Checkbox's HTML is as follows: ratio, one user selection two, the browser will send this query string: user.priv = boss & user.priv = admin. OGNL will process the query string: action.getuser (). SetPriv (String [] {"boss", "admin"}). The method in action will be like this: set m_privileges = new hashset ();
Public void setpriv (string [] privs) {for (int i = 0; i
The following is an example of a slightly complicated point to deepen the understanding of the List collection process, and other processing methods are similar to the same work. MultiSelect.jsp file <% @ Page PageEncoding = "GB2312" ContentType = "text / html; charset = GB2312"%> <% @ taglib prefix = "ww" URI = "Webwork"%>