Friday, 11 July 2014
This is a step-by-step tutorial to show how to create your first website in J2EE. Some people also call it as Advanced Java. We have a .JSP page to display the website and a Java class i.e. a Action Servlet to handle the request generated in the .JSP page.

NOTE :- To create this website, you must have installed the IDE i.e. NetBeans with Apache Tomcat Server.

Here are the steps :-

Step 1 :- Create a new project.

File->New Project->Java Web->Web Application

Step 2:- 

Give it a name.

 

Step 3:- Choose the server

Please choose Apache Tomcat. If your IDE is not showing  it, then you have to reinstall the IDE and make sure that during re-installation, you customize the installation of by choosing the server. After choosing the server, click FINISH.

Step 4:-

After clicking finish button, your IDE will look like this. It means your project has been created.


Step 5:- 

Now next you have to do is edit the code in .JSP file i.e. index.jsp file.

CODE:-

    <body>
        <form action="ActionServlet" method="POST">
            <input type="text" name="text" value="" />
            <input type="submit" value="Ok" />
        </form>
    </body>

Step 6:- Create a new servlet.

Just right click the project -> New -> Servlet


Step 7:-

Give the name of servlet. THe name of the servlet must be same as you have set the value of action attribute in form. We have used " <form action="ActionServlet" method="POST"> ", so name of the servlet should be ActionServlet.


Step 8:- Configuration of Servlet Deployment

Remember to check the checkbox saying "Add information to deployment descriptor(Web.xml). It will add the information of the Servlet in Web.xml file for mapping. After that click FINISH.

Step 9:- 

Now your servlet will be created. Please change your servlet code as following.




Now your website is done. All you have to do is run your project and see your output.

Download the sample project :- Click Here

Please do comment if you have any queries. We value your comments.
byteKoding

byteKoding

byteKoding.com is started with an intention to provide every updates related to technology and programming. It is specially for helping people in developing software projects in different programming languages like C/C++, Java, C#.Net, ASP.Net etc. The details that we share here can be very much useful in creating your software a great success.

This is the most recent post.
Older Post

0 comments