01. Choose File>New Project
02. Select Java Web under Categories>Web Application under the
Projects and Click Next
03. Give Project Name in the Project Name box. In mine FirstWebApplication
and click Next(If you want to change Default Project location click Browse
and select the location).
04. Select your server and click Finish.
05. Right click the source package node and chose New>Package
06. Enter Package Name and click Finish
07. Right click on your package and choose New>Java Class
08. Enter Class Name and click Finish.
09. In the Source Editor Enter following code.
String name;
public SayHello() {
name=null;
}
public SayHello() {
name=null;
}
10. Right click name and choose Refactor>Encapsulate Fields
11. Now we are going to create accessor(Getter & Setter) methods to field
called name. Click Refactor.
12. Now your class look similar to the following.
13. Now go to the index.jsp and edit it as follows.
14.Now right click web pages in Project window an choose New>JSP
15. Give a filename as response and click Finish.
16. Now go to the response.jsp and edit it as follows
17. Now right click your project and choose Run.
Now your first Web Application run in your web browser.It look like as follows
Thanks for your grateful informations, this blogs will be really help for Java tutorials.
ReplyDelete