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

Struts标签问题 在线等 急! 谢谢高手指教
<%
int[]   inte   =     new   int[4];
inte[0]=1;
inte[1]=2;
inte[2]=3;
inte[3]=4;
request.setAttribute( "show ",inte);
%>

<logic:iterate   id= "show "   name   =   "show "   scope= "request ">
${XXXX}
</logic:iterate>


请问XXXX的内容应该怎么写   才能输出inte数组中的第一个元素的值(输出1)
谢谢高手指教


------解决方案--------------------
{show[0]}
可以吗?
------解决方案--------------------
<logic:iterate id= "show " scope= "request ">
<bean:write name= "show "/>
</logic:iterate>
------解决方案--------------------
正解是使用iterate的offset和length属性


<%@ page language= "java " contentType= "text/html; charset=GBK " pageEncoding= "GBK "%>
<%@ taglib uri= "http://struts.apache.org/tags-bean " prefix= "bean " %>
<%@ taglib uri= "http://struts.apache.org/tags-logic " prefix= "logic " %>
<%
int[] inte = new int[4];
inte[0]=1;
inte[1]=2;
inte[2]=3;
inte[3]=4;
request.setAttribute( "show ",inte);
%>

<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=GB18030 ">
<title> Insert title here </title>
</head>
<body>

<logic:iterate id= "show " name = "show " scope= "request " offset= "0 " length= "1 ">
<bean:write name= "show "/>
</logic:iterate>


</body>
</html>