struts codenips


1.
ActionMessage errors=new ActionMessage();
errors.add(“username“,new ActionMessage (“hello.no.username.errpr“));
return errors;

2.
每一个actionBean执行execute方法最后调用return (mapping.findForward("SayHello"));
如果局部的mapping找不到就到全局global forward里面去找.


3.

      <html:link forward="BeanServlet">
        BeanServlet
      </html:link>


    <forward   name="BeanServlet"           path="/BeanServlet.jsp"/>


4.
     <bean:cookie id="cookie" name="/tags/cookiedemo" value="firsttime"/>
     <%
       if (cookie.getValue().equals("firsttime")) {
         Cookie c = new Cookie("/tags/cookiedemo", "Hi Linda!");
         c.setComment("A test cookie");
         c.setMaxAge(3600); //60 seconds times 60 minutes
         response.addCookie(c);
       }
       %>
     The cookie value is: <bean:write name="cookie" property="value"/>






posted on 2004-09-16 20:27  笨笨  阅读(433)  评论(0编辑  收藏  举报

导航