2:用session的setAttribute和getAttribute方法
3:
getAttribute(java.lang.String name)
Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.getParameter(java.lang.String name)
Returns the value of a request parameter as a String, or null if the parameter does not exist.
3:
getAttribute(java.lang.String name)
Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.getParameter(java.lang.String name)
Returns the value of a request parameter as a String, or null if the parameter does not exist.
getSession(boolean create)
Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session.getSession()Returns the current session associated with this request, or if the request does not have a session, creates one.
所以默认是true
2 A和B什么关系,除非是include关系,否则就是两个HTTP请求,也就是两个request
3 parameter是读取对应的HTML form表单内容的,所以是只读的,没有对应的setParameter方法;attribute用以存放整个处理request过程中(形象点讲,也就是用户发出请求,到最后生成页面之间)的一些数据
4 这个是Struts对应的标签库,通过MessageResources读取多国语言,默认读取你WEB-INF\ApplicationResources.properties (..._zh.properties, ..._zh_CN.prop..., ..._zh_TW.prop..., ..._en....,..._en_US...)当然也可以配置和扩展MessageResourcesFactory/MessageResources来改为读取数据库等其他方式
这怎么设置呢..
<%
request.setAttribute("name","张三");
%> 怎么样能才在B.jsp页面中用以下代码取出A.jsp中set进request的值
<%
out.println(request.getAttribute("name")); //总输出null,怎么样才能输出"张三"
String str=()
%>
out.println((String)request.getAttribute("name")); //总输出null,怎么样才能输出"张三"