
Using Container Security in Application
Once we define the username and password we need to map the security in the web.xml file of the web application. The following is the code need to be added in web.xml file for the same.
<?xml version =" 1.0 " encoding =" UTF-8 "?>
<web-app version =" 2.4 " xmlns =" http://java.sun.com/xml/ns/j2ee " xmlns:xsi =" http://www.w3.org/2001/XMLSchema-instance " xsi:schemaLocation =" http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">
<security-constraint>
<web-resource-collection>
<web-resource-name> application </web-resource-name>
<url-pattern> /*.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name> admin </role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method> BASIC </auth-method>
<realm-name> securityapp </realm-name>
</login-config>
<security-role>
<description> Testing the Application Security </description>
<role-name> admin </role-name>
</security-role>
</web-app>
When we call any jsp page in the application then it will prompt for username and password and following screen will be displayed before the actual jsp page. If you supply the wrong credntials then it will not deisplay the page
Jsp Discussion
- - Two forms in one JSP
- - PASS VARIABLES BETWEEN 2
- - Table data
- - Unable to laod the image
- - The Ultimate Web UI Frame




