MultiBox's use

xiaoxiao2021-03-06  67

Struts tag library HTML: MultiBox's use

The label of is added in the page, always error, "Parameter type does not match", Matid is an ArrayList type, which is this type in Form and Action, and page There is no problem with the front end display. I don't know where it is. Later, I saw some information, as if MultiBox can only put the String [] type parameter. So change the MATID to the String type, no longer reported.

There is a problem that you can't understand: Why can I use the arraylist type parameter when displaying, but the submission always reports wrong? strange!

The following is to reference other:

If this check box is not selected, the browser will not submit a value for this control. Instead, if selected, the Name of this control will be submitted. This behavior is why there is a reset () method in Actionform. Because the browser never marks the checkbox without being selected, the only solution of all Boxes is to check if the Boxes exists in Request. The MultiBox control is designed to use an array of String. Each element of it represents a Checked Box. In order to check a Box, add a String type Box value to this array, delete the elements in the data for those who are not selected. When passing a value, the Element in the MultiBox control scanned array see if it matches. If you match, the box is selected, otherwise, Box is not selected. If the user selects BOX and then submits the FORM, the value of this BOX will be included in the request. The control will add this Box to the selected array. If there is no thing being selected, there will be no things submitted, and there is no thing that will be added to the selected array. If the Actionform Bean still maintains session contezt, in two request pieces, the reset () method needs to set the length of the selected array to 0 (but this array itself is not null) example Each Checkbox Labels is the value of his Property, and the list of Items selected is in an array called SelectedItems. Items that are not selected will not appear in the array SelectEdItems. Multio is current Item, checks the SelectedItems array. If he appears in SelectedItems, write a selected Checkbox, if this is not the case, he wrote an unselected Checkox.

String [] s = new string [];

转载请注明原文地址:https://www.9cbs.com/read-111875.html

New Post(0)