救命啊 利用struts2开发Portlet怎么取request和session的值
Actionpackage struts2TestPortlet.action;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import struts2TestPortlet.bean.User;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
public class Login extends ActionSupport {
private User user;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String login(){
Map request=(Map)ActionContext.getContext().get("request");
Map session=ActionContext.getContext().getSession();
List<User> list=new ArrayList<User>();
System.out.println("jin login");
User u=new User();
u.setUsername("du");
u.setPassword("pwd");
list.add(user);
list.add(u);
session.put("user", user);
request.put("ulist", list);
if (user.getUsername().equals("du") && user.getPassword().equals("pwd")) {
return "success";
} else {
return "fail";
}
}
}
jsp
<%@page
language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030" session="false"%>
<%@taglib uri="http://java.sun.com/portlet" prefix="portlet"%><portlet:defineObjects />
<%@ taglib uri="/struts-tags" prefix="ss"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<p>no</p>
${session.user.username}<br/>
${session.user.password}<br/>
<ss:iterator var="list" value="#request.ulist">
name=<ss:property value="username" />
pass=<ss:property value="password" />
</ss:iterator>
<ss:iterator var="list" value="#request.ulist">
pass=${password}
name=${username}
</ss:iterator>
action能取到jsp输入的值
但是跳转后的jsp取不到request的值
要怎么才能取得request的值呢
补充:企业软件 , WebSphere