problème redirection : JSF+Spring
Bonjour à tous
Je tente de faire une redirection apres un click mais la redirection ne se fait pas
j'ai essaye de regarder ce qui clochait mais en vain
voici mon web.xml
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| <?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>Supervision JSF</display-name>
<!-- Spring Config -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:application-context.xml</param-value>
</context-param>
<!-- context-param> <param-name>javax.faces.CONFIG_FILES</param-name> <param-value>WEB-INF/faces-config.xml</param-value>
</context-param -->
<filter>
<filter-name>filtre richface</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>filtre richface</filter-name>
<servlet-name>faces Servlet</servlet-name>
</filter-mapping>
<!-- Listeners -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<servlet>
<servlet-name>faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
</web-app> |
faces-config.xml
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| <?xml version="1.0"?>
<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
<navigation-rule>
<display-name>test</display-name>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>detail</from-outcome>
<to-view-id>/userdetail.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>list</from-outcome>
<to-view-id>/userlist.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
</faces-config> |
jsp "userlist.jsp"
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| <h:form id="mainForm">
<rich:dataTable id="userList" value="#{userBean.listUser}"
var="userCourant" style=" width : 211px;">
<rich:column id="userId">
<f:facet name="header">
<h:outputText value="Id_User" />
</f:facet>
<h:outputText value="#{userCourant.userId}" />
</rich:column>
<rich:column id="login">
<f:facet name="header">
<h:outputText value="login" />
</f:facet>
<h:outputText value="#{userCourant.login}" />
</rich:column>
<rich:column id="password">
<f:facet name="header">
<h:outputText value="password" />
</f:facet>
<h:outputText value="#{userCourant.password}" />
</rich:column>
<rich:column id="actions">
<f:facet name="header">
<h:outputText value="actions" style="FONT-STYLE: italic;" />
</f:facet>
<h:commandLink id="actionView" action="#{userBean.vueDetail}"
value="action">
<f:param name="userIdParam" value="#{userCourant.userId}" />
</h:commandLink>
</rich:column>
</rich:dataTable>
</h:form> |
bean
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| @Controller
@Scope("session")
public class UserBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Autowired
private UserService userService;
private User userCourant;
private User user;
private List<User> listUser;
private UIDataTable dataTable;
private int numero;
@PostConstruct
public void init(){
listUser=userService.findAll();
}
public String vueNouveau(){
setUserCourant(new User());
return "detail";
}
public String vueDetail(){
HttpServletRequest req = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
userCourant = (User)req.getAttribute("userCourant");
System.out.println(userCourant.getNom());;
return "detail";
}
//getters and setters
} |
Merci d'avance