public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
// Beanをセッションに設定
UserData data = new UserData();
data.setUserId("id01");
data.setUserName("name01");
request.setAttribute("usrdata", data);
// Stringデータをセッションに設定
request.setAttribute("stringData", "ABCDEFG");
return mapping.findForward("success");
} }
ーーーーーーーーーー UserData ーーーーーーーーーーーーー
package sample.bean;
public class UserData {
private String userId;
private String userName;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
} }
|