1. Create Test.html
  2. Create CustomLogin.html
  3. Create Error.html
  4. Create FirstServet class
  5. Configure FirstServlet in web.xml
  6. Add security related tags to web.xml
  7. Add role,username & password in tomcat-users.xml
  8. Deploy & Run the application

Create Login.html(for Accessing FirstServlet)

http://encore-realty.com/?sebig=forex-bank-valutav%C3%A4xling-och-banktj%C3%A4nster&98c=0a forex bank valutaväxling och banktjänster <html> <head> <title>LOGIN PAGE</title> </head> <body> <form action="/WebSecurity/FirstServlet" method="post"> Enter Text:<input type="text" name="text"> <input type="submit"> </form> </body> </html>

Create CustomLogin.html

اسعار الفوركس <html> <head> <title>LOGIN PAGE</title> </head> <body> <h3>Java2Learn</h3> <form action="j_security_check"> Enter Name:<input type="text" name="j_username"> <br> Enter password:<input type="password" name="j_password"> <input type="submit"> </form> </body> </html>

Create Error.html

http://glasgowpdc.co.uk/?rafinad=%D8%A7%D8%AE%D8%B1-%D8%A5%D8%B9%D9%84%D8%A7%D9%86-%D8%B9%D9%86-%D8%A7%D9%84%D8%A5%D9%83%D8%AA%D8%AA%D8%A7%D8%A8-%D9%81%D9%8A-%D8%A7%D9%84%D8%A7%D8%B3%D9%87%D9%85-%D8%A7%D9%84%D8%B3%D8%B9%D9%88%D8%AF%D9%8A%D9%87&37e=b8 اخر إعلان عن الإكتتاب في الاسهم السعوديه <html> <head> <title>ERROR PAGE</title> </head> <body> <h3>Your credentials are invalid,please provide valid credentials</h3> </body> </html>

Create FirstServet class

http://loandco.com/?ceftoe=%D8%B3%D8%B9%D8%B1-%D8%AC%D8%B1%D8%A7%D9%85-%D8%A7%D9%84%D8%B0%D9%87%D8%A8-%D9%81%D9%8A-%D8%A7%D9%84%D8%B3%D8%B9%D9%88%D8%AF%D9%8A%D8%A9&a46=6e سعر جرام الذهب في السعودية package com.java2learn.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class FirstServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); out.println("<h1>GET:After authentication only we can access the Servlet.</h1>"); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); out.println("<h1>POST:After authentication only we can access the Servlet.</h1>"); } }

Configure FirstServlet in web.xml

كم جرام الذهب اليوم للبيع <servlet> <description></description> <display-name>FirstServlet</display-name> <servlet-name>FirstServlet</servlet-name> <servlet-class>com.java2learn.servlet.FirstServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>FirstServlet</servlet-name> <url-pattern>/FirstServlet</url-pattern> </servlet-mapping>

Add security related tags to web.xml

مؤشر اسهم البنك الاهلي <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>WebSecurity</display-name> <servlet> <description></description> <display-name>FirstServlet</display-name> <servlet-name>FirstServlet</servlet-name> <servlet-class>com.java2learn.servlet.FirstServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>FirstServlet</servlet-name> <url-pattern>/FirstServlet</url-pattern> </servlet-mapping> <security-constraint> <web-resource-collection> <web-resource-name>FirstServlet</web-resource-name> <description></description> <url-pattern>/FirstServlet</url-pattern> <http-method>POST</http-method> <http-method>GET</http-method> </web-resource-collection> <auth-constraint> <role-name>javaRole</role-name> </auth-constraint> </security-constraint> <!--This configuration will differ from previous example--> <login-config> <auth-method>FORM</auth-method> <form-login-config> <form-login-page>/CustomLogin.html</form-login-page> <form-error-page>/Error.html</form-error-page> </form-login-config> </login-config> <security-role> <role-name>javaRole</role-name> </security-role> </web-app>

Add role,username & password in tomcat-users.xml

http://greenspacecambria.org/?binop=%D9%87%D9%84-%D8%AA%D8%AC%D8%A7%D8%B1%D8%A9-%D8%A7%D9%84%D8%A7%D8%B3%D9%87%D9%85-%D9%85%D8%B1%D8%A8%D8%AD%D9%87&1ce=04 هل تجارة الاسهم مربحه

تداول الاسهم بالانترنت <tomcat-users> <role rolename="javarole"/> <user username="user1" password="tomcat" roles="javarole"/> <user username="user2" password="tomcat" roles="javarole,role1"/> </tomcat-users>

Final Project Structure

http://wiethaler.com/?sd=%D8%B7%D8%B1%D9%8A%D9%82%D8%A9-%D8%A8%D9%8A%D8%B9-%D9%88%D8%B4%D8%B1%D8%A7%D8%A1-%D8%A7%D9%84%D8%A7%D8%B3%D9%87%D9%85-%D8%B9%D9%86-%D8%B7%D8%B1%D9%8A%D9%82-%D8%A7%D9%84%D9%86%D8%AA&e92=47 طريقة بيع وشراء الاسهم عن طريق النت

Deploy & Run the application

http://www.receptikojevolim.com/?kyweitar=%D8%B7%D8%B1%D9%8A%D9%82%D8%A9-%D8%A8%D9%8A%D8%B9-%D8%A7%D9%84%D8%A7%D8%B3%D9%87%D9%85-%D9%81%D9%8A-%D8%A8%D9%86%D9%83-%D8%A7%D9%84%D8%B1%D8%A7%D8%AC%D8%AD%D9%8A&902=1e طريقة بيع الاسهم في بنك الراجحي

http://www.trendlux.sk/?qwerara=%D8%B3%D9%88%D9%82-%D8%A7%D9%84%D9%83%D9%88%D9%8A%D8%AA-%D9%84%D9%84%D8%A7%D9%88%D8%B1%D8%A7%D9%82-%D8%A7%D9%84%D9%85%D8%A7%D9%84%D9%8A%D8%A9-%D8%A7%D8%B3%D8%B9%D8%A7%D8%B1-%D8%A7%D9%84%D8%A7%D8%B3%D9%87%D9%85&872=e9 سوق الكويت للاوراق المالية اسعار الاسهم

Output3

Output4
http://www.cuddlesbyheather.com/?rifos=%D8%B3%D8%A8%D9%8A%D9%83%D8%A9-%D8%B0%D9%87%D8%A8-%D9%84%D9%84%D8%A8%D9%8A%D8%B9&ff3=2e سبيكة ذهب للبيع Valid credentials
Output5
Output6

http://aidtoschools.org/?c=%D8%A7%D8%B1%D8%A8%D8%A7%D8%AD-%D8%A7%D8%B3%D9%87%D9%85-%D8%B4%D8%B1%D9%83%D8%A9-%D8%A7%D9%84%D8%B1%D8%A7%D8%AC%D8%AD%D9%8A-%D8%A7%D9%84%D9%85%D8%B5%D8%B1%D9%81%D9%8A%D8%A9&227=b7 ارباح اسهم شركة الراجحي المصرفية Download Project: WebSecurity