java - How to iterate a list of objects in jstl inside jsp -
I am trying to replicate the list of objects in my JSP using jstl. I want a dropdown with ultimate values for each of the ultimate names.
jsp code:
& lt; C: if test = "$ {fn: length (ListOfParams) gt}" & gt; & Lt; H2 & gt; Yo yo & lt; / H2 & gt; & Lt; C: forEach var = "param" item = "$ {listOfParams}" & gt; & Lt; H3 & gt; $ {Param.paramName} & lt; / H3 & gt; & Lt; Select name = "$ {param.paramName}" id = "$ {param.paramName}" square = "target"> & Lt; C: forEach var = "listOfParamValue" item = "$ {param.listOfParamValue}" & gt; & Lt; Options & gt; & Lt; C: out value = "$ {listOfParamValue}" /> & Lt; / Options & gt; & Lt; / C: foreach & gt; & Lt; / Select & gt; & Lt; / C: foreach & gt; & Lt; / C: If & gt;
Administrator code:
DTEJob dteJob2 = new DTEJob (); DteJob2.setParamName ("ABC"); DteJob2.addTolistOfParamValue ("VAL1"); DteJob2.addTolistOfParamValue ("val2"); DteJob2.setDefault (true); ParamList.add (dteJob2); Model.addAttribute ("listOfParams", paralysis);
OUTPUT:
Yo Yo and 2 empty dropdowns.
Can someone help me, why am I unable to get values in jstl? Any help would be appreciated because I am new to jsp and jstl.
My Bean class is:
Private string is the name; Private listing & lt; String & gt; ListOfParamValue = New ArrayList & lt; String & gt; (); Public listing & lt; String & gt; GetListOfParamValue () {Return invoice value; } Public string getParamName () {return nickname; }
to var = "param"
> Var = "p" or param
except for anything param
is used to access the request parameter.
& lt; C: forEach var = "p" items = "$ {listOfParams}" & gt;
$ {param.paramName}
means the request parameter in the form of Access paramName
that is not there.
the ultimate:
one request parameter name for the map < Read more about / html
Comments
Post a Comment