JBoss application server

1.) download JBoss developer tool from www.jboss.org - „Red Hat JBoss Developer Studio”

2.) start jbdevstudio.bat

3.) create a „dynamic web project” –> name of it should be „First”

4.) create an index.html file into the WebContent folder

5.) right click on the project and select Run as/Run on Server

6.) locate http://localhost:8080/First/ in your browser

Create a servlet

1.) right click on project and click new/servlet 2.) servlet name: MyServlet 3.) package: org.ait 4.) finish 5.) add the following code as doGet() method:

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  	String p1 = request.getParameter("number1");
  	String p2 = request.getParameter("number2");
  	
  	int result = Integer.parseInt(p1) + Integer.parseInt(p2); 
  	
  	PrintWriter writer = response.getWriter();
  	
  	writer.print("<html> <body> result = " + result + " </body> </html>");
  		
  	writer.flush();
  	writer.close();
  }

6.) locate http://localhost:8080/First/MyServlet?number1=1&number2=2 in your browser