You need the page load action specified by the <action> element in your URL mapping configuration. First, you need a bean method, for example:
@Named("bean") @RequestScoped public class LoginBean { public String loadLoggedUser() { if ( userId != null ) { this.user = user.findById(userId); return null; } return "failure"; } }
Secondly, you need to add <action> to your URL mapping:
<url-mapping id="view"> <pattern value="/user/view/#{bean.userId}/" /> <view-id value="/userview.jsf" /> <action>#{bean.loadLoggedUser}</action> </url-mapping>
Here we defined the action of the page to be performed on the bean, #{bean.loadLoggedUser} , when the URL matching our pattern is requested. For example: /user/view/2 .
source share