如何将request中的值填写到jsp页面中
在Action中我放了一个list到request中,现在我想将此值返回到jsp页面的textarea中,请问各位如何编写jsp中的代码?
Acrion中:
Java code:
List<String> list = ……;
ActionContext.getContext().put("IdCode", list);
JSP中:
HTML code:
<!--想把数据输出到textarea中该怎样写代码?-->
<textarea cols="30" rows="15" id="txt"></textarea>
谢谢各位!!!
<textarea cols="30" rows="15" id="txt">
<%=out.println("abc")%>
</textarea>
ActionContext.getContext().put("IdCode", list);
用struts 标签
回楼上:用不用struts标签无所谓!现在是打算用。
还有怎样遍历传过来的list?
首先导入包 <%@ page import="java.util.List" %>
<textarea cols="30" rows="15" id="txt">
<%
List idList = (List)request.getAttribute("IdCode");
for(int i = 0; i < idList.size(); i++){
out.println(idList.get(i).toString());
}
&nb
相关问答:
我的开发的平台是Myeclipes6.0 + tomcat5.x + mysql
我所有的编码方式都是用的UTF-8
我只用了Strtus框架
在一个form中如下用的是post的提交方式:
<form class="form" action=&quo ......
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
我的程序如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv=&q ......
一个JSP页面接收其他页面提交过来的FORM表单,但是要求只接收当前站点及其子站点提交过来的FORM表单,其他站点提交过来的表单不接收,这个怎么设置?
用过滤器
filter
将当前站点及其子站点放一个目录
然 ......