![]() ![]() Facelets is much more suited to JSF than JSP. JSF is a component based MVC framework which is built on top of the Servlet API and provides components via taglibs which can be used in JSP or any other Java based view technology such as Facelets. Both objects are available as method arguments inside any of the overridden methods of HttpServlet, such as doGet() and doPost(). You can access the request data by HttpServletRequest and handle the response by HttpServletResponse. The same instance will be reused for every incoming request whose URL matches the servlet's URL pattern. When a Servlet is first requested or during web app startup, the servlet container will create an instance of it and keep it in memory during the web app's lifetime. You can configure HttpServlets to listen to a certain HTTP URL pattern, which is configurable in web.xml, or more recently with Java EE 6, with annotation. A well-known example is the HttpServlet which provides methods to hook on HTTP requests using the popular HTTP methods such as GET and POST. Servlet is a Java application programming interface (API) running on the server machine, which intercepts requests made by the client and generates/sends a response. On a JSP request, the servlet container will execute the compiled JSP class and send the generated output (usually just HTML/CSS/JS) through the web server over a network to the client side, which in turn displays it in the web browser. In for example Tomcat, it's the /work directory. You can find the generated source code in the server's work directory. When a JSP is requested for the first time or when the web app starts up, the servlet container will compile it into a class extending HttpServlet and use it during the web app's lifetime. JSP also supports Expression Language, which can be used to access backend data (via attributes available in the page, request, session and application scopes), mostly in combination with taglibs. JSP supports taglibs, which are backed by pieces of Java code that let you control the page flow or output dynamically. JSP is a Java view technology running on the server machine which allows you to write template text in client side languages (like HTML, CSS, JavaScript, ect.). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |