js动态的添加HTML标签以及接受request.setAttribute封装的list
后台代码封装 request.setAttribute("votemsg",voteList);
js中代码获取并拼接HTML标签 其中 VoteRecord 是list封装的实体类 后台 List<VoteRecord> voteList= new ArrayList<VoteRecord>();
<%
ArrayList list=(ArrayList)request.getAttribute("votemsg");
for(int i=0;i<list.size();i++){
VoteRecord voterecord=(VoteRecord)list.get(i);
%>
var fundurl= "<%=rp.getPropertieValue("SITEURL")%>"+getUrlByFundcode(<%=voterecord.getFundcode()%>); //----获取url路径并拼接
var tableContent = " ";
tableContent += ' <tr class="gray">';
tableContent += ' <td align="center"><a class="col333" href="'+fundurl+'" target="_blank"> <%=voterecord.getFundname()%></a></td>';
tableContent += '<td align="center"><%=voterecord.getFundcode()%></td> ';
tableContent += '<td align="center"><%=voterecord.getBeginDate()%> </td>';
tableContent += '<td align="center"><%=voterecord.getEndDate()%></td>';
tableContent += '<td align="center"><%=voterecord.getVoteStatus()%></td> ';
tableContent += ' <td align="center"><a href="#" onclick=checkVote("<%=voterecord.getFundcode()%>","<%=voterecord.getFundname()%>","<%=voterecord.getSurveyId()%>") class="link2">投票</a></td> ';
$("#view_config_view_trade_myfund_otherfundlist").append($(tableContent));
<% } %>