日期:2014-05-18  浏览次数:20792 次

求助(js于java对象转化问题)
<c:forEach   var= "item "   items= "${items} ">

var   obj=${item};//我想把java对象给obj,然后遍历其属性,这点不知道怎么赋值
/* for(var   p   in   obj){

if(obj[p]!=null||obj[p]!= ' '){
alert(obj[p]);
Dcellweb1.D(spitStringToCol(obj[p]),spitStringToRow(obj[p]),index,spitStringToValue(obj[p]));
}
}*/
// <c:if   test= "${!empty   item.col1} ">
// Dcellweb1.SetCellNumType(spitStringToCol( " <c:out   value= '${item.col1} '/> "),spitStringToRow( " <c:out   value= '${item.col1} '/> "),index,1)
// Dcellweb1.D(spitStringToCol( " <c:out   value= '${item.col1} '/> "),spitStringToRow( " <c:out   value= '${item.col1} '/> "),index,spitStringToValue( " <c:out   value= '${item.col1} '/> "))
// </c:if>
</c:forEach>

------解决方案--------------------
<script language= "javascript ">
function showitem(var obj)
{
for(var p in obj){

if(obj[p]!=null||obj[p]!= ' '){
alert(obj[p]);
Dcellweb1.D(spitStringToCol(obj[p]),spitStringToRow(obj[p]),index,spitStringToValue(obj[p]));
}
}
showitem( <%request.getAttribute( "item ") %> );
</script>