使用的是webwork 框架
写cookie 
 Cookie c1 = new Cookie("userName", userName);
Cookie c2 = new Cookie("realName", realName); Cookie[] cookies = new Cookie[2];
cookies[0] = c1;
cookies[1] = c2;
ActionContext context = ActionContext.getContext();
HttpServletResponse hsr = (HttpServletResponse) context
.get(ServletActionContext.HTTP_RESPONSE);
for (int i = 0; i < 2; i++) {
// cookies[i].setMaxAge(3600);
cookies[i].setPath("/");
hsr.addCookie(cookies[i]);

}
提交到b.jsp
在页面中读取cookie
<%
int i = 0;
Cookie[] cookies = request.getCookies();
if(cookies==null||cookies.length==0)
{
out.println("there is no cookies");
return ;
}
int len = cookies.length;
out.println("Cookies Count: " + len);
out.println("<br>"); for (i = 0; i < len; i++) {
Cookie cc = cookies[i];
if (cc == null) {
continue;
}
if (cc.getName().trim().equals("userName"))
out.println("userName= "+ com.linkage.dps.util.CryUtil.decrypt(java.net.URLDecoder.decode(cc.getValue())) + "<br>");
else if (cc.getName().trim().equals("realName"))
out.println("realName= "+ com.linkage.dps.util.CryUtil.decrypt(java.net.URLDecoder.decode(cc.getValue())) + "<br>");
else
out.println("Other is called,cookie Name:"+cc.getName() + "<br>"); }
%>然而,只有刷新一下b.jsp时,才能读取到cookie
求助!!