struts2学习遇到的小问题和小经验

    xiaoxiao2026-08-15  7

    一       .Strusts2 中将actioncontext.getcontext()

    在Action中通过Actioncontext.getcontext().put(“list”,List<Object>)将request放进去

    通过Actioncontext.getcontext().getSession.put(“user”,user)将Session方巾气

    通过Actioncontext.getcontext().getApplication(“countor”,countor)放进Application

    通过<body><h3>${sessionScope.user.username},${requestScope.greeting}。<br>本站的访问量是:${applicationScope.counter}</h3></body>  

    在jsp中调用

    详情请看 http://blog.csdn.net/smcfy/article/details/5693481这个方法没测

    这个测试了   如果context中是个list <c:forEach var=”name” items=”${list}”>

      <tr>

      <tb>${name.属性name}</tb>

      <tb>${name.属性name}</tb>

      <tb>${name.属性name}</tb>

      <tb>${name.属性name}</tb>

      </tr>

      </c:forEach>

     

     

    二   . Struts Jsp页面中#的用法,1取得根目录,2赋值maP, 3过滤

      %的用法,强势解释可执行的字符串

      $在Struts 2配置文件中,引用OGNL表达式

    详情请看:http://jlins.iteye.com/blog/567954

    一 .Struts2入门实例,一直出现类似于找不到Action

    这样的错误,后来下了个正确的例子,然后一部一部分解着把自己的添加进去,应该是Action类出错,具体不明,莫名奇妙好了,应该是后面的method=“方法名”错了,但是如果最后retrunSUCCESS 不是success出来的界面是空的

     

     

    二 。Exception occurred during processing request: nulljsp中的字段属性和Action中不匹配,要么两者不统一,要么缺失

     

    转载请注明原文地址: https://ju.6miu.com/read-1311203.html
    最新回复(0)