Saturday, January 11, 2014

Java JSP - Servlet Tutorial -- Part 2


JSP in Eclipse 

After completed the configuration of Tomcat , now we can try to run a JSP file..

BTW,  JavaServer Pages (JSP) are text documents, which are similar to HTML Files. But you find also
java code in the JSP File. JavaServer Pages allow you to mix regular static HTML with dynamic
generated contents of Java code. The java code is inserted in the HTML document on a JSP File,
differently to a servlet, where the HTML code is embedded in the java code.

Creating JSP in Eclipse IDE with Tomcat server

  • Create a Dynamic web project
  • create a jsp
  • start tomcat server and deploy the project

1) Create the dynamic web project
For creating a dynamic web project click on File Menu -> New -> dynamic web project -> write your project name e.g. first -> Finish.






2) Create the JSP file in eclipse IDE
For creating a jsp file explore the project by clicking the + icon -> right click on WebContent -> New ->jsp -> write your jsp file name e.g. index -> next -> Finish.







Your JSP code will be over here


3) Next ,we need to start the server and deploy the project:
For starting the server and deploying the project in one step Right click on your project -> Run As -> Run on Server -> choose tomcat server -> next ->addAll -> finish.

If you are using Eclipse IDE first time, you need to configure the tomcat server First.
Now start the tomcat server and deploy project
For starting the server and deploying the project in one step Right click on your project -> Run As -> Run on Server -> choose tomcat server -> next ->addAll -> finish.





Thats it with Hello JSP by running 




No comments:

Post a Comment