请问,struts2 的问题 如何将一个变量传到一个中?

sdbgs 2008-07-30 05:05:45
<s:iterator value="%{fileIDList}" id="fid">

<img src="/information/ShowImage?id=<s:property ></s:property>">
<br />
<jsp:include page="/ShowImageNotes?id=<s:property ></s:property>" ></jsp:include>

</s:iterator>

<img src="/information/ShowImage?id=<s:property ></s:property>">可以,但是
<jsp:include page="/ShowImageNotes?id=<s:property ></s:property>" flush="false"></jsp:include>不行
...全文
159 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sdbgs 2008-07-30
  • 打赏
  • 举报
回复
求各位给改成个利用struts2标签的。
fileIDList 为从action中发返回的List<Integer>

jsp如下:

<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.sql.*, java.util.ArrayList,java.util.List" errorPage="" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>修改新闻</title>
<style type="text/css">
<!--
.STYLE1 {
font-size: 18px;
color: #0000FF;
font-weight: bold;
}
-->
</style>
</head>

<body>

<%
Object obj = request.getAttribute("fileIDList");
System.out.println(obj);

String objstr = "";
objstr = obj.toString();

if(objstr != ""){
objstr = objstr.substring(1,objstr.length()-1);

String [] idarray = objstr.split(",");
if(idarray.length>0){
for(int i =0; i < idarray.length; i++){

%>
<div>
<img src="/information/ShowImage?disSize=600&id=<%=idarray[i].trim() %>">
</div>

<div>
<jsp:include page="/ShowImageNotes" flush="true" >
<jsp:param name="id" value="<%=idarray[i].trim() %>" />
</jsp:include>
</div>
<%
}
}
}

%>

<br />
</label></td>
</tr>


</table>

</body>
</html>
sdbgs 2008-07-30
  • 打赏
  • 举报
回复
ShowImageNotes 是一个 Servlet ,没有问题
sdbgs 2008-07-30
  • 打赏
  • 举报
回复
fileIDList 是一个 由 struts2的action中传过来的整数集合List<Integer>

81,117

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧