jsp - <display:column + <html:select -
I am creating an application using struts, where I get a list of people from the list of databases and schools and then I select Html: so that the user can select the school for each element, here's the part of the JSP page where I got stuck.
& lt; Display: table id = "list" name = "myForm .list" & gt; & Lt; Display: column title = "id" property = "id" /> & Lt; Display: column heading = "name" property = "name" ordered = "true" /> & Lt; Exhibit: column title = "school" & gt; & Lt; Html: Selection property = "id school" & gt; & Lt; Logic: notEmpty name = "myForm" property = "SchoolCombo" & gt; & Lt; Bean: define id = "SchoolCombo" name = "myForm" property = "SchoolCombo" /> & Lt; Html: option store = "schoolcomp" property = "id" label property = "name" /> & Lt; / Logic: notEmpty & gt; & Lt; / HTML: Select & gt; & Lt; / Display: Columns & gt; & Lt; / Display: table & gt;
The list on myForm is a list of people with an ID, a name and an IDSchool, which is not an initial value. School combo is a list of schools that came from the database with an ID and a name.
What can I do to do this, for each element of the list, I can set the IDs on jsp page and then, I can use that form which is stored with that person and that school Can be used to?
If I was not clear enough, please ask if I can explain this problem better.
As I understand, I am giving you a general solution to this problem, Which is necessary for a complete solution .. I call it Struts 2 & lt; S: tag & gt;
So, you have changed according to your requirement. First of all, place where you are running through the list and add unique elements in the form of hidden areas. The requests on the server parameters can be recovered from the list of the hidden fields. When you click on any record, it is identified by unique ID that you set as hidden fields (item-less - explained below).
& lt; S: iterator value = "TheListOfItems" status = "ItemRec" & gt; & Lt; S: Hidden name = "TheListOfItems [% {# ItemRec.index}] .ID" value = "% {id}" /> & Lt; S: Hidden name = "TheListOfItems [% {# ItemRec.index}]. Attribute2" value = "% {attribut2}" /> & Lt; S: hidden name = "TheListOfItems [% {# ItemRec.index}]. Attribute3" value = "% {attribut3}" /> & Lt; Real Price / Records Aarti Here & gt; & Lt; / S: iterator & gt; On the server side,
you can do the following to get it done
string id = getRequest (). GetParameter ("id");
Comments
Post a Comment