日期:2014-05-17 浏览次数:20880 次
@Override
public String execute() throws Exception {
Map request = (Map)ActionContext.getContext().get("request");
List<User> list=this.userService.findAll();
/*
* if(page==null){
page=new Page();
firstOpen();
}
this.pageService.pageValue(list,page);
*/
request.put("list",list);
request.put("page",page);
return SUCCESS;
}
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<% System.out.println(request.getAttribute("page")==null);
System.out.println(request.getAttribute("list")==null);%>
@Override
public String execute() throws Exception {
String message = "No username in us";
Map request = (Map) ActionContext.getContext().get("request");
String session = ServletActionContext.getRequest().getSession().getId();
List<User> u = this.userService.findUserByUsername(this.user);
List<Account> list = new ArrayList<Account>();
if (u!=null)
if (u.get(0).getPassword().equals(this.user.getPassword())) {
list = this.accountService.findUserAccount(u.get(0));
request.put("list",list);
request.put("page",0);
return SUCCESS;
} else message = "password error !!";
request.put("message", message);
return ERROR;
}
<package name="ssh2" extends="struts-default">
<action name="register" class="saveUserAction">
<result name="success" type="redirect">listUser</result>
</action>
<action name="listUser" class="listUserAction">
<result name="success">/listall.jsp</result>
</action>
<action name="login" class="loginUserAction">
<result name="success" type="redirect">listUser</result>
<result name="error" type="redirect">/error.jsp</result>
</action>
</package>
<package name="ssh2" extends="struts-default">
<action name="register" class="saveUserAction">
<result name="success" type="redirect">listUser</result>
</action>
<action name="listUser" class="listUserAction">
<result name="success">/listall.jsp</result>
</action>
<action name="login" class="loginUserAction">
<result name="success" type="redirect">/listall.jsp</result>
<result name="error" type="redirect">/error.jsp</result>
</action>
</package>