não estou sacando qual e o problema desse codigo. alguem pode me ajudar ???
public class WizardAction extends ActionSupport implements
ModelDriven<Usuario>, Preparable {
private Usuario usuario;
private String nome;
private String sobrenome;
public void setNome(String nome) {
this.nome = nome;
}
public void setSobrenome(String sobrenome) {
this.sobrenome = sobrenome;
}
@Override
public Usuario getModel() {
// TODO Auto-generated method stub
return usuario;
}
@Override
public void prepare() throws Exception {
// TODO Auto-generated method stub
usuario = new Usuario(nome, sobrenome);
}
}
<%@taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<s:form action="Wizard">
<s:textfield label="nome" name="nome"></s:textfield>
<s:textfield label="sobrenome" name="sobrenome"></s:textfield>
<s:submit></s:submit>
</s:form>
</body>
</html>
<struts>
<package name="mypacke" extends="struts-default">
<interceptors>
<interceptor-stack name="eventStack">
<interceptor-ref name="scope">
<param name="session">model</param>
<param name="autoCreateSession">true</param>
</interceptor-ref>
<interceptor-ref name="paramsPrepareParamsStack" />
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="eventStack"></default-interceptor-ref>
<action name="Wizard" class="TesteAction.action.WizardAction">
<interceptor-ref name="eventStack">
<param name="scope.type">start</param>
</interceptor-ref>
<result name="success">/Form1.jsp</result>
</action>
</package>
</struts>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@page import="negocios.Usuario"%>
<%@page import="java.util.Enumeration"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
out.println(session.getAttribute("nome"));
out.println(session.getAttribute("model.nome"));
%>
</body>
</html>
os 2 resultados estão dando null !!
não estou conseguindo colocar informações dentro da session com o interceptador scope… alguem poderia ver o que tem de errado nesse codigo ???