The data is displayed in the list, but the font color of the data must be added to js. The font color is js.
1. requirement: the data is displayed on the foreground, but the color of each record must be a bit different. 1. Processing of java background data
String ids = "";
For (int x = 0; x <sign. size (); x ++ ){
Int id = sign. get (x). getId ();
Ids + = id + ",";
}
String sids = ids. substring (0, ids. length ()-1 );
Req. setAttribute ("sids", sids );
2. jsp page processing
<Input type = "hidden" id = "sid" value = "$ {sids}"/>
<C: forEach items = "$ {sign}" var = "sign">
<Li> <a href = "#" id = "choice _ $ {sign. id}" >$ {sign. signword} </a> </li>
</C: forEach>
Js:
<Script type = "text/javascript">
$ (). Ready (function (){
Var id = 1;
Var linoleic = "addcolor ";
Var sids = $ ("# sid"). val ();
Var sid = new Array (); // defines an Array
Sid = sids. split (","); // delimiter
For (I = 0; I <sid. length; I ++)
{
$ ("A [id ^ = 'choice _" + sid [I] + "']"). attr ("class", linoleic + I );
}
});
</Script>