1 / 12

Java Server Pages (JSPs)

Java Server Pages (JSPs). Like Perl and PHP, Server-side scripting Similar to PHP Static HTML/XML components Special JSP tags Snippets of code written in Java (called scriptlets). Java Server Pages (JSPs). Scriptlets written in Java  access to complete Java environment  scalability

Download Presentation

Java Server Pages (JSPs)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java Server Pages (JSPs) • Like Perl and PHP, Server-side scripting • Similar to PHP • Static HTML/XML components • Special JSP tags • Snippets of code written in Java (called scriptlets)

  2. Java Server Pages (JSPs) • Scriptlets written in Java •  access to complete Java environment •  scalability •  portability

  3. Java Server Pages (JSPs) • <html> • <title>Demo a simple JSP program</title> • <body> • <%= “Hello world” %> • </body></html>

  4. Java Server Pages (JSPs) • JSP implicit objects • Among others (will visit later): • out, a JspWriter object that writes into the output stream.

  5. Java Server Pages (JSPs) • <html> • <title>Demo a simple JSP program</title> • <body> • <% • out.print( “Hello world” ); • %> • </body></html>

  6. Java Server Pages (JSPs) • Can run JSPs on your own computer, even without an Internet connection • Install tomcat (servlet/jsp engine)

  7. Installing and running Tomcat • Download jakarta-tomcat-7.0.37 • Just unzip the file, no installation needed • Can unzip the file anywhere

  8. Installing and running Tomcat • Find bin directory in jakarta-tomcat-7.0.37 directory • Edit the file startup.bat • SET JAVA_HOME = c:\…\jdk7 • // whatever your file path is for the java • // version installed on your computer

  9. Installing and running Tomcat • From command line inside bin directory, start tomcat: • startup • // that should open another window … • // tomcat is running, you can run JSPs

  10. Installing and running Tomcat • Open your browser and go to: • http://localhost:8080 • 8080 is the default port so make sure it is not taken by another program • If it is, you can change tomcat’s default port by editing server.xml

  11. Installing and running Tomcat • Your browser ends up in jakarta-tomcat-7.0.37/webapps/ directory • From there, call a jsp file with the appropriate file path

  12. Installing and running Tomcat • You should place your files in the webapps directory • To access heelo.jsp from a web browser: • http://leda.capitol-college.edu:8180/hfranceschi/hello.jsp

More Related