![]() ![]() Observe that the response message does not include the JSP source codes, but merely the output of the JSP script. Try "View Source" to check the response message received by the browser. Issue this URL (assume that Tomcat is running in port number 8080): INFO: Deploying web application directory hellojsp Xxxx, xxxx xx:xx:xx xx .HostConfig deployDirectory Check the console message to confirm that hellojsp has been deployed: To run this JSP script, launch the Tomcat server. Use a programming text editor to enter the following HTML/JSP codes and save as " first.jsp" under the context root " hellojsp". The " \webapps\hellojsp" directory is known as context root for webapp (web context) " hellojsp". Java EE 6 (December 10, 2009) (Java Servlet 3.0, JSP 2.2/EL 2.2, JSTL 1.2, JSF 2.0, EJB 3.1, JDBC 4.0)įirst of all, create a new web application (aka web context) called " hellojsp" in Tomcat, by creating a directory " hellojsp" under Tomcat's " webapps" directory (i.e., " \webapps\hellojsp" where denotes Tomcat's installed directory).You can run these examples by launching Tomcat, and issue URL JSP Versions Tomcat provides many excellent JSP examples, in " \webapps\examples\jsp". I shall denote Tomcat's installed directory as, and assume that Tomcat server is running in port 8080. Read " How to Install Tomcat and Get Started", if necessary. You need to install Tomcat to try out JSP. Apache Tomcat Server ) is the official reference implementation (RI) for Java servlet and JSP, provided free by Apache ) - an open-source software foundation. JSPs, like servlets, are server-side programs run inside a Java-capable HTTP server. Complementary and extension technologies: MVC Framework (JSF, Struts, Spring, Hibernate), AJAX. Reuse of components and tag libraries: The dynamic contents can be provided by re-usable components such as JavaBean, Enterprise JavaBean (EJB) and tag libraries - you do not have to re-inventing the wheels.This greatly simplifies the creation and maintenance of web contents. Separation of static and dynamic contents: The dynamic contents are generated via programming logic and inserted into the static template.For developers, check out JSP Developer Site. To understand JSP, you need to understand Servlet (and HTTP, and HTML, and Java). In a Model-View-Control (MVC) design, servlets are used for the controller, which involves complex programming logic. JSPs are used for the view, which deals with presentation. The model could be implemented using JavaBeans or Enterprise JavaBeans (EJB) which may interface with a database. JSP is meant to compliment Servlet, not a replacement. JSP is more convenience than servlet for dealing with the presentation, not more powerful. JSP makes the creation and maintenance of dynamic HTML pages much easier than servlet. Whatever you can't do in servlet, you can't do in JSP. We shall also explain later that " Servlet is HTML inside Java", while " JSP is Java inside HTML". In fact, we shall see later that a JSP page is internally translated into a Java servlet. The business programming logic and the presentation are cleanly separated. This allows the programmers to focus on the business logic, while the web designer to concentrate on the presentation. The main page is written in regular HTML, while special tags are provided to insert pieces of Java programming codes. JSP, like ASP, provides a elegant way to mix static and dynamic contents. ![]() JSP is Java's answer to the popular Microsoft's Active Server Pages (ASP). JavaServer Pages (JSP) is a complimentary technology to Java Servlet which facilitates the mixing of dynamic and static web contents. ![]() Programmers, who wrote the servlet, may not be a good graphic designer, while a graphic designer does not understand Java programming. It is even worse to maintain or modify that HTML page produced. However, it is a pain to use a Servlet to produce a presentable HTML page (via the out.prinltn() programming statements). Instead of static contents that are indifferent, Java Servlet was introduced to generate dynamic web contents that are customized according to users' requests (e.g., in response to queries and search requests). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |