My question is, when i log in my web application as a specific role (e.g. admin) on a login page, how do I define in deployment descriptor to which file would this role be redirected after successful login.
My web.xml code:
<display-name>Fitnes</display-name>
<welcome-file-list>
<welcome-file>/Javno/index.jsp</welcome-file>
</welcome-file-list>
<security-constraint>
<display-name>SecurityConstraint</display-name>
<web-resource-collection>
<web-resource-name>WRCollection1</web-resource-name>
<url-pattern>/Zasebno/Trener/*</url-pattern>
<url-pattern>/images/*</url-pattern>
<url-pattern>/css/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>trener</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>ApplicationRealm</realm-name>
<form-login-config>
<form-login-page>/Javno/Prijava.jsp</form-login-page>
<form-error-page>/Javno/PrijavaError.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>trener</role-name>
</security-role>
After login, not all roles would be redirected to index.jsp, but different files. Let's say when i log in as "trener", I would like to be redirected to "Trener.jsp"..
For example:
<web-resource-collection>
<web-resource-name>WRCollection1</web-resource-name>
<url-pattern>/Zasebno/Trener/*</url-pattern>
<url-pattern>/images/*</url-pattern>
<url-pattern>/css/*</url-pattern>
<welcome-file>/Zasebno/Trener/Trener.jsp</welcome-file>
</web-resource-collection>
You can't. The Servlet specification does not support the feature you describe. You'd have to code this yourself e.g. with a welcome page that forwards to the correct page based on role.