Hi Rob, thank's for its attention. He would like to say that I am reading its book Pro Spring and has been very good.
He follows my code all.
Not I understood because the ModelAndView is not redirecting for correct jsp. And nor because any inserted URL there not cause errors.
Code:
public class ExcluirUsuariosControlador extends AbstractCommandController{
private Usuario usuario;
public ExcluirUsuariosControlador(){
this.setCommandClass(UsuarioBean.class);
}
protected ModelAndView handle(HttpServletRequest request, HttpServletResponse response,
Object obj, BindException erros) throws Exception {
UsuarioBean bean = (UsuarioBean)obj;
usuario.atualizaStatus(new Integer(DominioStatus.INATIVO), bean.getCodigoUsuario());
return new ModelAndView("Success");
}
public void setUsuario(Usuario usuario) {
this.usuario = usuario;
}
}
Code:
<bean id="listaUsuariosControlador" class="br.com.rodobens.web.usuario.ListaUsuariosControlador" >
<property name="sessionForm" value="true"/>
<property name="commandName" value="usuario"/>
<property name="commandClass" value="br.com.rodobens.beans.usuario.UsuarioBean"/>
<!-- <property name="validator" ref="usuarioValidacao"/> -->
<property name="formView" value="controleAcesso/ListaUsuarios"/>
<property name="successView" value="controleAcesso/ListaUsuarios"/>
<property name="usuario" ref="usuario"/>
<property name="grupo" ref="grupo"/>
</bean>
<bean id="excluirUsuariosControlador" class="br.com.rodobens.web.usuario.ExcluirUsuariosControlador">
<property name="usuario" ref="usuario"/>
</bean>
.
.
.
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/controleAcesso/excluirUsuarios.lpw">excluirUsuariosControlador</prop>
<prop key="/controleAcesso/listaUsuarios.lpw">listaUsuarios</prop>
</props>
</property>
</bean>
.
.
.
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property>
<property name="prefix"><value>/WEB-INF/views/</value></property>
<property name="suffix"><value>.jsp</value></property>
</bean>
The Success.jsp, for example, is in /WEB-INF/views and any outhers controllers show it's view.
In the truth I would like that this my ModelAndView was for/acontroleacesso/listaUsuarios.lpw