Strust2-2

1、ActionContext获取request,session,值栈。将对象压人栈顶:获取值栈,push。<s:属性>:是OGNL,获取栈顶的对象。

2、<result type="json" name="users">
     <param name="root">names</param>
   </result>

3、(1)、 request.setAttribute("s004po", s004po);

                   主题:${s004po.ma002}<br>
                   内容:${s004po.ma003}

        (2)、List<Map<String, Object>> replyList

                   request.setAttribute("replyList", replyList);

                   <s:iterator value="#request.replyList" id="column"> 
                             <s:iterator value="#column" id="map">    
                                      key: <s:property value="#map.key"/>      
                                       value: <s:property value="#map.value"/>  <br>    
                               </s:iterator>
                 </s:iterator>

4、hidden标签中的value我在js脚本中取得hidden中value时为什么得到的是<s:property value="#session.LOGIN_USER"/>,我用<s:textfield value="<s:property value='#session.LOGIN_USER'/>"/>测试时在文本框中的显示也是<s:property value="#session.LOGIN_USER"/>,求教…………

解答:

<s:hidden>标签的value属性的类型是String类型,所以把<s:property value="#session.LOGIN_USER"/>当成是字符串,如果要获取值栈中的数据要用
<s:hidden name="loginUser" id="loginUser" value="%{#session.LOGIN_USER}"/>

5.Struts2文件上传路径的详细解释

http://lj6684.iteye.com/blog/1002279

Struts2文件上传原理及示例

http://blog.sina.com.cn/s/blog_87720b870100zkn2.html

struts2上传文件问题汇总

http://jingyan.baidu.com/article/acf728fd1222d8f8e510a38e.html

 

 

http://localhost:8080/YunVideo/pda/pdaLogin
http://localhost:8080/YunVideo/pda/pdaRegister

<action name="pda*" class="com.hw.hwsafe.pda.action.PdaUserAction" method="pda{1}">
 <result type="json"></result>
</action>

 public void pdaRegister() throws Exception {
     response.setContentType("text/html");
  response.setCharacterEncoding("UTF-8");
     PrintWriter out = null;
     out = response.getWriter();
  out.write("注册");
  out.flush();
  out.close();
 }
 public void pdaLogin() throws Exception {
  response.setContentType("text/html");
  response.setCharacterEncoding("UTF-8");
     PrintWriter out = null;
     out = response.getWriter();
  out.write("登录");
  out.flush();
  out.close();

你可能感兴趣的:(Strust2-2)