JSF Page Navigation. The first example we ll look at is available as jsf_ex2a.zip on your notes page.

Size: px
Start display at page:

Download "JSF Page Navigation. The first example we ll look at is available as jsf_ex2a.zip on your notes page."

Transcription

1 JSF Page Navigation In this section, we ll look at how page navigation works using JSF. The examples in this section and the other sections are modified examples from courses.coresevlets.com. The first example we ll look at is available as jsf_ex2a.zip on your notes page. In this example, we ll start with a redirect from index.jsp to a page named register.jsp. register.jsp has a form on it with an action that goes back to itself. faces-config.xml will always direct output to a file named result.jsp, which the user will see no matter what. index.jsp looks like this: <% response.sendredirect("register.faces"); %>

2 web.xml contains this: <?xml version = '1.0' encoding = 'windows-1252'?> <web-app xmlns:xsi=" xsi:schemalocation=" version="2.4" xmlns=" <description>empty web.xml file for Web Application</description> <servlet> <servlet-name>faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.facesservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>faces Servlet</servlet-name> <url-pattern>*.faces</url-pattern> </servlet-mapping> <filter> <filter-name>faces-redirect-filter</filter-name> <filter-class>facesredirectfilter</filter-class> </filter> <filter-mapping> <filter-name>faces-redirect-filter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <session-config> <session-timeout>35</session-timeout> </session-config> <mime-mapping> <extension>html</extension> <mime-type>text/html</mime-type> </mime-mapping> <mime-mapping> <extension>txt</extension> <mime-type>text/plain</mime-type> </mime-mapping> </web-app> The servlet-mapping tag will cause all files that end with.faces to be handled by the FacesServlet class.

3 We now also have filter and filter-mapping tags. Any reference that has a.jsp extension will be passed along to the FacesRedirectFiller class, which is defined inside the project. This class will redirect to a version of the file with a.faces extension. import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** Filter that redirects all requests sent to blah.jsp to blah.faces. * Fixes the very annoying error messages you get if you access * JSF pages with.jsp extensions. However, this filter assumes 3 things: * The extension is.faces. You can change this in web.xml, but this * code will not pick up the change automatically. * You have no non-jsf JSP pages that you want to access with.jsp * The welcome-file name is index.jsp. If the URL ends with / and the * system forwards to a.jsp page, the filter is invoked but is not * told the file name. */ public class FacesRedirectFilter implements Filter { private final static String EXTENSION = "faces"; public void dofilter(servletrequest req, ServletResponse res, FilterChain chain) throws ServletException, IOException { HttpServletRequest request = (HttpServletRequest)req; HttpServletResponse response = (HttpServletResponse)res; String uri = request.getrequesturi(); if (uri.endswith(".jsp")) { int length = uri.length(); String newaddress = uri.substring(0, length-3) + EXTENSION; //System.out.println("Redirecting to " + newaddress); response.sendredirect(newaddress); else { // Address ended in "/" //System.out.println("Redirecting to index.faces"); response.sendredirect("index.faces"); public void init(filterconfig config) throws ServletException { public void destroy() {

4 register.jsp is this: taglib uri=" prefix="f" %> taglib uri=" prefix="h" %> <f:view> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD><TITLE>New Account Registration</TITLE> <LINK REL="STYLESHEET" HREF="./css/styles.css" TYPE="text/css"> </HEAD> <BODY> <CENTER> <TABLE BORDER=5> <TR><TH CLASS="TITLE">New Account Registration</TH></TR> </TABLE> <P> <h:form> address: <h:inputtext/><br> Password: <h:inputsecret/><br> <h:commandbutton value="sign Me Up!" action="register"/> </h:form> </CENTER></BODY></HTML> </f:view> Notice the <h:form> tag defining the form. The action of the form is automatically the current URL and the method is automatically POST. Within the form, we have three form elements inputtext, inputsecret, and commandbutton. The inputtext and inputsecret don t really do anything they don t even have names. The commandbutton contains a value attribute (the text inside the button) and an action attribute (register). If we are doing static navigation, the action attribute is just a string for the action of the commandbutton.

5 In faces-config.xml, we now have a navigation-rule tag. <?xml version="1.0" encoding="windows-1252"?> <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" " <faces-config xmlns=" <from-view-id>/register.jsp</from-view-id> <from-outcome>register</from-outcome> <to-view-id>/web-inf/results/result.jsp</to-view-id> </faces-config> The general form of a navigation-rule is: <from-view-id>/the-input-form.jsp</from-view-id> <from-outcome>string-from-action</from-outcome> <to-view-id>/web-inf/ /something.jsp</to-view-id> The <from-view-id> tag defines the input-form page. For each page we might be going to, we need a The <from-outcome> defines the action, and the <to-view-id> defines the location we re going to. By putting the page inside /WEB-INF, it cannot be directly accessed. The URL doesn t change when we go to the new page it remains register.faces. Note: input-form jsps can t be put inside /WEB-INF. That s why we use the filter so all.jsp files will be treated as.faces.

6 Here, result.jsp is pretty simple: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD><TITLE>Success</TITLE> <LINK REL="STYLESHEET" HREF="./css/styles.css" TYPE="text/css"> </HEAD> <BODY> <CENTER> <TABLE BORDER=5> <TR><TH CLASS="TITLE">Success</TH></TR> </TABLE> <H2>You have registered successfully.</h2> </CENTER> </BODY></HTML> The next example will do dynamic navigation, instead of the static navigation from the first example. We ll use the project located in jsf_ex2b.zip on your notes page. We ll again start with index.jsp, which does a redirect to signup.faces (really signup.jsp). <% response.sendredirect("signup.faces"); %>

7 signup.jsp is below. Note the empty h:inputtext and h:textarea tags. The action of the h:commandbutton is #{healthplancontroller.signup. This means the signup property of the healthplancontroller bean gets called. taglib uri=" prefix="f" %> taglib uri=" prefix="h" %> <f:view> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD><TITLE>Health Plan Signup</TITLE> <LINK REL="STYLESHEET" HREF="./css/styles.css" TYPE="text/css"> </HEAD> <BODY> <CENTER> <TABLE BORDER=5> <TR><TH CLASS="TITLE">Health Plan Signup</TH></TR> </TABLE> <P> <h:form> First name: <h:inputtext/><br> Last name: <h:inputtext/><br> SSN: <h:inputtext/><br> Complete medical history since the day you were born:<br> <h:inputtextarea/><br> <h:commandbutton value="sign Me Up!" action="#{healthplancontroller.signup"/> </h:form> </CENTER></BODY></HTML> </f:view>

8 faces-config.xml: <?xml version='1.0' encoding='utf-8'?> <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" " <faces-config> <managed-bean> <managed-bean-name>healthplancontroller</managed-bean-name> <managed-bean-class> HealthPlanController </managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean> <from-view-id>/signup.jsp</from-view-id> <from-outcome>accepted</from-outcome> <to-view-id>/web-inf/results/accepted.jsp</to-view-id> <from-outcome>rejected</from-outcome> <to-view-id>/web-inf/results/rejected.jsp</to-view-id> </faces-config> We again have a navigation-rule, but we now also have a managed-bean declared. The bean has a name (the name we ll use for the bean in our files), a class (here it s HealthPlanController), and a scope (here it s request so it stays active with the request, as opposed to session or application). By the way, it doesn t matter in what order you write the nodes and the <managed-bean> nodes.

9 The HealthPlanController class is pretty simple the signup method will randomly accept or reject an applicant. Notice that the method returns a String either accepted or rejected. public class HealthPlanController { public String signup() { if (Math.random() < 0.2) { return("accepted"); else { return("rejected"); Let s now look at that navigation-rule inside faces-config.xml: <from-view-id>/signup.jsp</from-view-id> <from-outcome>accepted</from-outcome> <to-view-id>/web-inf/results/accepted.jsp</to-view-id> <from-outcome>rejected</from-outcome> <to-view-id>/web-inf/results/rejected.jsp</to-view-id> So from signup.jsp, there are two navigation-cases if the from-outcome is accepted, we go to accepted.jsp. If it was rejected, we go to rejected.jsp.

10 Here are these files: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD><TITLE>Accepted!</TITLE> <LINK REL="STYLESHEET" HREF="./css/styles.css" TYPE="text/css"> </HEAD> <BODY> <CENTER> <TABLE BORDER=5> <TR><TH CLASS="TITLE">Accepted!</TH></TR> </TABLE> <H2>You are accepted into our health plan.</h2> Congratulations. </CENTER> </BODY></HTML> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD><TITLE>Rejected!</TITLE> <LINK REL="STYLESHEET" HREF="./css/styles.css" TYPE="text/css"> </HEAD> <BODY> <CENTER> <TABLE BORDER=5> <TR><TH CLASS="TITLE">Rejected!</TH></TR> </TABLE> <H2>You are rejected from our health plan.</h2> Get lost. </CENTER> </BODY></HTML>

11 Let s think about some other things we can do. We can use * as a wildcard in a navigation rule. In the example below, all forms will go to success.jsp. <from-view-id>*</from-view-id> <from-outcome>success</from-outcome> <to-view-id>/web-inf/results/success.jsp</to-view-id> The following shows the advantage of doing this. We want to do the same thing from two different views when we see unknown-user. <from-view-id>/page1.jsp</from-view-id> <from-outcome>condition1</from-outcome> <to-view-id>/web-inf/results/result1.jsp</to-view-id> <from-outcome>unknown-user</from-outcome> <to-view-id>/web-inf/results/unknown.jsp</to-view-id> <from-view-id>/page2.jsp</from-view-id> <from-outcome>condition2</from-outcome> <to-view-id>/web-inf/results/result2.jsp</to-view-id> <from-outcome>unknown-user</from-outcome> <to-view-id>/web-inf/results/unknown.jsp</to-view-id>

12 It s simpler like this: <from-view-id>*</from-view-id> <from-outcome>unknown-user</from-outcome> <to-view-id>/web-inf/results/unknown.jsp</to-view-id> <from-view-id>/page1.jsp</from-view-id> <from-outcome>condition1</from-outcome> <to-view-id>/web-inf/results/result1.jsp</to-view-id> <from-view-id>/page2.jsp</from-view-id> <from-outcome>condition2</from-outcome> <to-view-id>/web-inf/results/result2.jsp</to-view-id> 44 If we omit the from-outcome, it means all other return conditions match (except for null, which always means re-display the form). So here, if we have condition1 returned, we go to result1.jsp. If null was returned, we go back to some-page.jsp. But if anything else was returned, we go to default.jsp. <from-view-id>/some-page.jsp</from-view-id> <from-outcome>condition1</from-outcome> <to-view-id>/web-inf/results/result1.jsp</to-view-id> <to-view-id>/web-inf/results/default.jsp</to-view-id>

13 If you had two commandbuttons on a form (each with a different method call), you can have a different navigation case for each. But you would then need to have a <from-action> tag. This would allow you have a different response for the same String that was returned. <from-view-id>/somepage.jsp</from-view-id> <from-action>#{beanname.method1</from-action> <from-outcome>error</from-outcome> <to-view-id>/web-inf/results/err1.jsp</to-view-id> <from-action>#{beanname.method2</from-action> <from-outcome>error</from-outcome> <to-view-id>/web-inf/results/err2.jsp</to-view-id> The JSF controller methods do not have direct access to request and response. You would have to use this code to get it: ExternalContext context = FacesContext.getCurrentInstance().getExternalContext(); HttpServletRequest request = (HttpServletRequest)context.getRequest(); HttpServletResponse response = (HttpServletResponse)context.getResponse(); But, you don t need to do this to get request parameters these come to the bean automatically, as we ll see.

14 Many errors will cause the current form to be re-displayed. This isn t helpful in finding a problem! Use System.out.println statements to help you figure out where you are. Some common errors where pushing the button causes nothing to happen: 1. Return value of controller method does not match from-outcome of navigation-case Remember values are case sensitive 2. Using from-action instead of from-outcome <from-action>accepted</from-action> Should be from-outcome, not from-action <to-view-id>/web-inf/results/accepted.jsp</to-view-id> This is really a special case of (1), since there is now no from-outcome 3. Forgetting # in action of h:commandbutton <h:commandbutton value="button Label" action="{beanname.methodname"/> Should have # here This is really a special case of (1), since action="beanname.methodname" means the literal String "beanname.methodname" is the from-outcome In this situation and several others, it is very helpful to put a print statement in controller method to see if/when it is invoked 4. Typo in from-view-id This is a special case of (1), since the from-outcome applies to nonexistent page 5. Controller method returns null This is often done on purpose to redisplay the form, but can be done accidentally as well. 6. Type conversion error You declare field to be of type int, but value is not an integer when you submit. Behavior of redisplaying form is useful here. See validation section.

15 7. Missing setter method You associate textfield with bean property foo, but there is no setfoo method in your bean. Debugging hint: You will see printout for bean being instantiated, but not for controller method 8. Missing h:form If you use h:inputtext with no surrounding h:form, textfields will still appear but nothing will happen when you press submit button

Copyright Descriptor Systems, Course materials may not be reproduced in whole or in part without prior written consent of Joel Barnum

Copyright Descriptor Systems, Course materials may not be reproduced in whole or in part without prior written consent of Joel Barnum JEE application servers at version 5 or later include the required JSF libraries so that applications need not configure them in the Web app. Instead of using JSPs for the view, you can use an alternative

More information

JSF Validating User Input

JSF Validating User Input JSF Validating User Input Two tasks that almost every Web application needs to perform: Checking that all required form fields are present and in the proper format Redisplaying the form when values are

More information

Contents. 1. JSF overview. 2. JSF example

Contents. 1. JSF overview. 2. JSF example Introduction to JSF Contents 1. JSF overview 2. JSF example 2 1. JSF Overview What is JavaServer Faces technology? Architecture of a JSF application Benefits of JSF technology JSF versions and tools Additional

More information

JSF Building input forms with the h library

JSF Building input forms with the h library JSF Building input forms with the h library We ve already seen some of the most commonly used tags: h:form No ACTION specified (it is current page automatically) You must use POST h:inputtext NAME generated

More information

Example jsf-cdi-and-ejb can be browsed at

Example jsf-cdi-and-ejb can be browsed at JSF-CDI-EJB Example jsf-cdi-and-ejb can be browsed at https://github.com/apache/tomee/tree/master/examples/jsf-cdi-and-ejb The simple application contains a CDI managed bean CalculatorBean, which uses

More information

Author: Sascha Wolski Sebastian Hennebrueder Tutorials for Struts, EJB, xdoclet and eclipse.

Author: Sascha Wolski Sebastian Hennebrueder   Tutorials for Struts, EJB, xdoclet and eclipse. JavaServer Faces Developing custom converters This tutorial explains how to develop your own converters. It shows the usage of own custom converter tags and overriding standard converter of basic types.

More information

Three hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Friday 21 st May Time:

Three hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Friday 21 st May Time: COMP67032 Three hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE Building Web Applications Date: Friday 21 st May 2010 Time: 14.00 17.00 Answer Question 1 from Section A and TWO questions out

More information

Java TM. JavaServer Faces. Jaroslav Porubän 2008

Java TM. JavaServer Faces. Jaroslav Porubän 2008 JavaServer Faces Jaroslav Porubän 2008 Web Applications Presentation-oriented Generates interactive web pages containing various types of markup language (HTML, XML, and so on) and dynamic content in response

More information

04/29/2004. Step by Step Guide for Building a simple JSF Application (Guess a Number) - V1.0

04/29/2004. Step by Step Guide for Building a simple JSF Application (Guess a Number) - V1.0 Step by Step Guide for Building a simple JSF Application (Guess a Number) - V1.0 1 Sang Shin sang.shin@sun.com www.javapassion.com Java Technology Evangelist Sun Microsystems, Inc. 2 Disclaimer & Acknowledgments

More information

Session 24. Introduction to Java Server Faces (JSF) Robert Kelly, Reading.

Session 24. Introduction to Java Server Faces (JSF) Robert Kelly, Reading. Session 24 Introduction to Java Server Faces (JSF) 1 Reading Reading IBM Article - www.ibm.com/developerworks/java/library/jjsf2fu1/index.html Reference Sun Tutorial (chapters 4-9) download.oracle.com/javaee/6/tutorial/doc/

More information

Introduction to Java Server Faces(JSF)

Introduction to Java Server Faces(JSF) Introduction to Java Server Faces(JSF) Deepak Goyal Vikas Varma Sun Microsystems Objective Understand the basic concepts of Java Server Faces[JSF] Technology. 2 Agenda What is and why JSF? Architecture

More information

JSF & Struts 1, 4, 7, 2, 5, 6, 3 2, 4, 3, 1, 6, 5, 7 1, 4, 2, 5, 6, 3, 7 1, 2, 4, 5, 6, 3, 7

JSF & Struts 1, 4, 7, 2, 5, 6, 3 2, 4, 3, 1, 6, 5, 7 1, 4, 2, 5, 6, 3, 7 1, 2, 4, 5, 6, 3, 7 1. Following are the steps required to create a RequestProcessor class specific to your web application. Which of the following indicates the correct sequence of the steps to achieve it? 1. Override the

More information

JSF. What is JSF (Java Server Faces)?

JSF. What is JSF (Java Server Faces)? JSF What is JSF (Java Server Faces)? It is application framework for creating Web-based user interfaces. It provides lifecycle management through a controller servlet and provides a rich component model

More information

Getting Started Guide. Version 1.7

Getting Started Guide. Version 1.7 Getting Started Guide Version 1.7 Copyright Copyright 2005-2008. ICEsoft Technologies, Inc. All rights reserved. The content in this guide is protected under copyright law even if it is not distributed

More information

JSP. Common patterns

JSP. Common patterns JSP Common patterns Common JSP patterns Page-centric (client-server) CLIENT JSP or Servlet CLIENT Enterprise JavaBeans SERVER DB Common JSP patterns Page-centric 1 (client-server) Page View request response

More information

Servlet Basics. Agenda

Servlet Basics. Agenda Servlet Basics 1 Agenda The basic structure of servlets A simple servlet that generates plain text A servlet that generates HTML Servlets and packages Some utilities that help build HTML The servlet life

More information

Development of the Security Framework based on OWASP ESAPI for JSF2.0

Development of the Security Framework based on OWASP ESAPI for JSF2.0 Development of the Security Framework based on OWASP ESAPI for JSF2.0 Autor Website http://www.security4web.ch 14 May 2013 1. Introduction... 3 2. File based authorization module... 3 2.1 Presentation...

More information

Jakarta Struts: Declarative Exception Handling

Jakarta Struts: Declarative Exception Handling Jakarta Struts: Declarative Exception Handling Struts 1.2 Version Core Servlets & JSP book: More Servlets & JSP book: www.moreservlets.com Servlet, JSP, Struts, JSF, and Java Training Courses: courses.coreservlets.com

More information

Java Enterprise Edition. Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1

Java Enterprise Edition. Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1 Java Enterprise Edition Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1 Java Beans Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 2 Java Bean POJO class : private Attributes public

More information

Managed Beans III Advanced Capabilities

Managed Beans III Advanced Capabilities 2015 Marty Hall Managed Beans III Advanced Capabilities Originals of slides and source code for examples: http://www.coreservlets.com/jsf-tutorial/jsf2/ Also see the PrimeFaces tutorial http://www.coreservlets.com/jsf-tutorial/primefaces/

More information

&' () - #-& -#-!& 2 - % (3" 3 !!! + #%!%,)& ! "# * +,

&' () - #-& -#-!& 2 - % (3 3 !!! + #%!%,)& ! # * +, ! "# # $! " &' ()!"#$$&$'(!!! ($) * + #!,)& - #-& +"- #!(-& #& #$.//0& -#-!& #-$$!& 1+#& 2-2" (3" 3 * * +, - -! #.// HttpServlet $ Servlet 2 $"!4)$5 #& 5 5 6! 0 -.// # 1 7 8 5 9 2 35-4 2 3+ -4 2 36-4 $

More information

Configuring Tomcat for a Web Application

Configuring Tomcat for a Web Application Configuring Tomcat for a Web Application In order to configure Tomcat for a web application, files must be put into the proper places and the web.xml file should be edited to tell Tomcat where the servlet

More information

Servlets1. What are Servlets? Where are they? Their job. Servlet container. Only Http?

Servlets1. What are Servlets? Where are they? Their job. Servlet container. Only Http? What are Servlets? Servlets1 Fatemeh Abbasinejad abbasine@cs.ucdavis.edu A program that runs on a web server acting as middle layer between requests coming from a web browser and databases or applications

More information

Chapter 2 How to structure a web application with the MVC pattern

Chapter 2 How to structure a web application with the MVC pattern Chapter 2 How to structure a web application with the MVC pattern Murach's Java Servlets/JSP (3rd Ed.), C2 2014, Mike Murach & Associates, Inc. Slide 1 Objectives Knowledge 1. Describe the Model 1 pattern.

More information

SERVLET AND JSP FILTERS

SERVLET AND JSP FILTERS SERVLET AND JSP FILTERS FILTERS OVERVIEW Filter basics Accessing the servlet context Using initialization parameters Blocking responses Modifying responses FILTERS: OVERVIEW Associated with any number

More information

SAP NetWeaver J2EE Preview: User Interfaces with JSF

SAP NetWeaver J2EE Preview: User Interfaces with JSF SDN Contribution SAP NetWeaver J2EE Preview: User Interfaces with JSF Applies to: SAP NetWeaver J2EE Preview Summary Learn how to develop JSF-based front end. Author(s): SAP NetWeaver Product Management

More information

Session 8. Introduction to Servlets. Semester Project

Session 8. Introduction to Servlets. Semester Project Session 8 Introduction to Servlets 1 Semester Project Reverse engineer a version of the Oracle site You will be validating form fields with Ajax calls to a server You will use multiple formats for the

More information

Advanced Web Technology - Java Server Faces

Advanced Web Technology - Java Server Faces Berne University of Applied Sciences Advanced Web Technology - Java Server Faces Dr. E. Benoist Bibliography: Mastering Java Server Faces B.Dudney et al. - Wiley November 2005 1 Table of Contents Model

More information

Servlet and JSP Review

Servlet and JSP Review 2006 Marty Hall Servlet and JSP Review A Recap of the Basics 2 JSP, Servlet, Struts, JSF, AJAX, & Java 5 Training: http://courses.coreservlets.com J2EE Books from Sun Press: http://www.coreservlets.com

More information

2007 Marty Hall Marty Hall. 5 J2EE training: Marty Hall Marty Hall

2007 Marty Hall Marty Hall. 5 J2EE training: Marty Hall Marty Hall Topics in This Section JSF: The Ajax4jsf Library Originals of Slides and Source Code for Examples: http://www.coreservlets.com/jsf-tutorial/ Ajax motivation Installation Main Ajax4jsf Elements a4j:commandbutton

More information

Session 9. Introduction to Servlets. Lecture Objectives

Session 9. Introduction to Servlets. Lecture Objectives Session 9 Introduction to Servlets Lecture Objectives Understand the foundations for client/server Web interactions Understand the servlet life cycle 2 10/11/2018 1 Reading & Reference Reading Use the

More information

TheServerSide.com TheServerSide.NET Ajaxian.com

TheServerSide.com TheServerSide.NET Ajaxian.com TechTarget Application Development Media TheServerSide.com TheServerSide.NET Ajaxian.com SearchSoftwareQuality.com SearchWebServices.com SearchVB.com TheServerSide Java Symposium The Ajax Experience E-Guide

More information

Building Web Applications With The Struts Framework

Building Web Applications With The Struts Framework Building Web Applications With The Struts Framework ApacheCon 2003 Session TU23 11/18 17:00-18:00 Craig R. McClanahan Senior Staff Engineer Sun Microsystems, Inc. Slides: http://www.apache.org/~craigmcc/

More information

JSF: The "h" Library Originals of Slides and Source Code for Examples:

JSF: The h Library Originals of Slides and Source Code for Examples: 2012 Marty Hall JSF: The "h" Library Originals of Slides and Source Code for Examples: http://www.coreservlets.com/jsf-tutorial/ This somewhat old tutorial covers JSF 1, and is left online for those maintaining

More information

Welcome To PhillyJUG. 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation

Welcome To PhillyJUG. 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation Welcome To PhillyJUG 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation Web Development With The Struts API Tom Janofsky Outline Background

More information

JSF: The Ajax4jsf Library

JSF: The Ajax4jsf Library 2007 Marty Hall JSF: The Ajax4jsf Library Originals of Slides and Source Code for Examples: http://www.coreservlets.com/jsf-tutorial/ Customized J2EE Training: http://courses.coreservlets.com/ Servlets,

More information

More reading: A series about real world projects that use JavaServer Faces:

More reading: A series about real world projects that use JavaServer Faces: More reading: A series about real world projects that use JavaServer Faces: http://www.jsfcentral.com/trenches 137 This is just a revision slide. 138 Another revision slide. 139 What are some common tasks/problems

More information

Unit-4: Servlet Sessions:

Unit-4: Servlet Sessions: 4.1 What Is Session Tracking? Unit-4: Servlet Sessions: Session tracking is the capability of a server to maintain the current state of a single client s sequential requests. Session simply means a particular

More information

JSP Scripting Elements

JSP Scripting Elements JSP Scripting Elements Core Servlets & JSP book: More Servlets & JSP book: www.moreservlets.com Servlet and JSP Training Courses: courses.coreservlets.com 1 Slides Marty Hall, http://, book Sun Microsystems

More information

Struts. P. O. Box Austin, TX Fax: +1 (801) (877) 866-JAVA

Struts. P. O. Box Austin, TX Fax: +1 (801) (877) 866-JAVA Struts P. O. Box 80049 Austin, TX 78708 Fax: +1 (801) 383-6152 information@middleware-company.com +1 (877) 866-JAVA Copyright 2002 Agenda In this presentation we will discuss: Struts Overview Where to

More information

STRUTS 2 - VALIDATIONS FRAMEWORK

STRUTS 2 - VALIDATIONS FRAMEWORK STRUTS 2 - VALIDATIONS FRAMEWORK http://www.tutorialspoint.com/struts_2/struts_validations.htm Copyright tutorialspoint.com Now we will look into how Struts's validation framework. At Struts's core, we

More information

Advanced Web Technologies 8) Facelets in JSF

Advanced Web Technologies 8) Facelets in JSF Berner Fachhochschule, Technik und Informatik Advanced Web Technologies 8) Facelets in JSF Dr. E. Benoist Fall Semester 2010/2011 1 Using Facelets Motivation The gap between JSP and JSF First Example :

More information

web.xml Deployment Descriptor Elements

web.xml Deployment Descriptor Elements APPENDIX A web.xml Deployment Descriptor s The following sections describe the deployment descriptor elements defined in the web.xml schema under the root element . With Java EE annotations, the

More information

Servlets by Example. Joe Howse 7 June 2011

Servlets by Example. Joe Howse 7 June 2011 Servlets by Example Joe Howse 7 June 2011 What is a servlet? A servlet is a Java application that receives HTTP requests as input and generates HTTP responses as output. As the name implies, it runs on

More information

Université du Québec à Montréal

Université du Québec à Montréal Laboratoire de Recherches sur les Technologies du Commerce Électronique arxiv:1803.05253v1 [cs.se] 14 Mar 2018 Université du Québec à Montréal How to Implement Dependencies in Server Pages of JEE Web Applications

More information

Developing Web Applications using JavaServer Faces

Developing Web Applications using JavaServer Faces Developing Web Applications using JavaServer Faces In the previous two chapters we covered how to develop web applications in Java using Servlets and JSPs. Although a lot of applications have been written

More information

Common-Controls Quickstart

Common-Controls Quickstart Common-Controls Quickstart Version 1.1.0 - Stand: 20. November 2003 Published by: SCC Informationssysteme GmbH 64367 Mühltal Tel: +49 (0) 6151 / 13 6 31 0 Internet www.scc-gmbh.com Product Site http://www.common-controls.com

More information

文字エンコーディングフィルタ 1. 更新履歴 2003/07/07 新規作成(第 0.1 版) 版 数 第 0.1 版 ページ番号 1

文字エンコーディングフィルタ 1. 更新履歴 2003/07/07 新規作成(第 0.1 版) 版 数 第 0.1 版 ページ番号 1 1. 2003/07/07 ( 0.1 ) 0.1 1 2. 2.1. 2.1.1. ( ) Java Servlet API2.3 (1) API (javax.servlet.filter ) (2) URL 2.1.2. ( ) ( ) OS OS Windows MS932 Linux EUC_JP 0.1 2 2.1.3. 2.1.2 Web ( ) ( ) Web (Java Servlet

More information

3.2 Example Configuration

3.2 Example Configuration 3.2 Example Configuration Navigation Example Configuration Index Page General Information This page gives a detailed example configuration for Ext-Scripting for installation details please visit the setup

More information

CS506 Web Design & Development Final Term Solved MCQs with Reference

CS506 Web Design & Development Final Term Solved MCQs with Reference with Reference I am student in MCS (Virtual University of Pakistan). All the MCQs are solved by me. I followed the Moaaz pattern in Writing and Layout this document. Because many students are familiar

More information

JSF: The Ajax4jsf Library

JSF: The Ajax4jsf Library 2012 Marty Hall JSF: The Ajax4jsf Library Originals of Slides and Source Code for Examples: http://www.coreservlets.com/jsf-tutorial/ This somewhat old tutorial covers JSF 1, and is left online for those

More information

INTRODUCTION TO SERVLETS AND WEB CONTAINERS. Actions in Accord with All the Laws of Nature

INTRODUCTION TO SERVLETS AND WEB CONTAINERS. Actions in Accord with All the Laws of Nature INTRODUCTION TO SERVLETS AND WEB CONTAINERS Actions in Accord with All the Laws of Nature Web server vs web container Most commercial web applications use Apache proven architecture and free license. Tomcat

More information

11.1 Introduction to Servlets

11.1 Introduction to Servlets 11.1 Introduction to Servlets - A servlet is a Java object that responds to HTTP requests and is executed on a Web server - Servlets are managed by the servlet container, or servlet engine - Servlets are

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2411 1 Review:

More information

JavaServer Pages (JSP)

JavaServer Pages (JSP) JavaServer Pages (JSP) The Context The Presentation Layer of a Web App the graphical (web) user interface frequent design changes usually, dynamically generated HTML pages Should we use servlets? No difficult

More information

Database Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실

Database Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실 데이타베이스시스템연구실 Database Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실 Overview http://www.tutorialspoint.com/jsp/index.htm What is JavaServer Pages? JavaServer Pages (JSP) is a server-side programming

More information

Table of Contents Fast Track to JSF 2

Table of Contents Fast Track to JSF 2 Table of Contents Fast Track to JSF 2 Fast Track to JavaServer Faces (JSF 2) 1 Workshop Overview / Student Prerequisites 2 Workshop Agenda 3 Typographic Conventions 4 Labs 5 Release Level 6 Session 1:

More information

Hello Worldwide Web: Your First JSF in JDeveloper

Hello Worldwide Web: Your First JSF in JDeveloper Now I Remember! Hello Worldwide Web: Your First JSF in JDeveloper Peter Koletzke Technical Director & Principal Instructor There are three things I always forget. Names, faces, and the third I can t remember.

More information

Unit 5 JSP (Java Server Pages)

Unit 5 JSP (Java Server Pages) Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic, platform-independent method for building Web-based applications. It focuses more on presentation logic

More information

The Struts MVC Design. Sample Content

The Struts MVC Design. Sample Content Struts Architecture The Struts MVC Design Sample Content The Struts t Framework Struts implements a MVC infrastructure on top of J2EE One Servlet acts as the Front Controller Base classes are provided

More information

a. Jdbc:ids://localhost:12/conn?dsn=dbsysdsn 21. What is the Type IV Driver URL? a. 22.

a. Jdbc:ids://localhost:12/conn?dsn=dbsysdsn 21. What is the Type IV Driver URL? a. 22. Answers 1. What is the super interface to all the JDBC Drivers, specify their fully qualified name? a. Java.sql.Driver i. JDBC-ODBC Driver ii. Java-Native API Driver iii. All Java Net Driver iv. Java Native

More information

Integrating Servlets and JavaServer Pages Lecture 13

Integrating Servlets and JavaServer Pages Lecture 13 Integrating Servlets and JavaServer Pages Lecture 13 Core Servlets & JSP book: More Servlets & JSP book: www.moreservlets.com Servlet and JSP Training Courses: courses.coreservlets.com 1 Slides Marty Hall,

More information

Introduction to Servlets. After which you will doget it

Introduction to Servlets. After which you will doget it Introduction to Servlets After which you will doget it Servlet technology A Java servlet is a Java program that extends the capabilities of a server. Although servlets can respond to any types of requests,

More information

sessionx Desarrollo de Aplicaciones en Red EL (2) EL (1) Implicit objects in EL Literals José Rafael Rojano Cáceres

sessionx Desarrollo de Aplicaciones en Red EL (2) EL (1) Implicit objects in EL Literals José Rafael Rojano Cáceres sessionx Desarrollo de Aplicaciones en Red José Rafael Rojano Cáceres http://www.uv.mx/rrojano EL Expression Language Write the code in something else, just let EL call it. EL () EL stand for Expression

More information

JavaServer Pages. What is JavaServer Pages?

JavaServer Pages. What is JavaServer Pages? JavaServer Pages SWE 642, Fall 2008 Nick Duan What is JavaServer Pages? JSP is a server-side scripting language in Java for constructing dynamic web pages based on Java Servlet, specifically it contains

More information

Web. 2 Web. A Data Dependency Graph for Web Applications. Web Web Web. Web. Web. Java. Web. Web HTTP. Web

Web. 2 Web. A Data Dependency Graph for Web Applications. Web Web Web. Web. Web. Java. Web. Web HTTP. Web Web A Data Dependency Graph for Web Applications Summary. In this paper, we propose a data dependency graph for web applications. Since web applications consist of many components, data are delivered among

More information

JSF - Facelets Tags JSF - template tags

JSF - Facelets Tags JSF - template tags JSF - Facelets Tags JSF - template tags Templates in a web application defines a common interface layout and style. For example, a same banner, logo in common header and copyright information in footer.

More information

How to structure a web application with the MVC pattern

How to structure a web application with the MVC pattern Objectives Chapter 2 How to structure a web application with the MVC pattern Knowledge 1. Describe the Model 1 pattern. 2. Describe the Model 2 (MVC) pattern 3. Explain how the MVC pattern can improve

More information

Advanced Graphics Components Using JavaServer Faces Technology. Christophe Jolif Architect ILOG S.A.

Advanced Graphics Components Using JavaServer Faces Technology. Christophe Jolif Architect ILOG S.A. Advanced Graphics Components Using JavaServer Faces Technology Christophe Jolif Architect ILOG S.A. http://www.ilog.com Goal of the Session Learn how to build JavaServer Faces technology advanced graphics

More information

Servlet Fudamentals. Celsina Bignoli

Servlet Fudamentals. Celsina Bignoli Servlet Fudamentals Celsina Bignoli bignolic@smccd.net What can you build with Servlets? Search Engines E-Commerce Applications Shopping Carts Product Catalogs Intranet Applications Groupware Applications:

More information

A.1 JSP A.2 JSP JSP JSP. MyDate.jsp page contenttype="text/html; charset=windows-31j" import="java.util.calendar" %>

A.1 JSP A.2 JSP JSP JSP. MyDate.jsp page contenttype=text/html; charset=windows-31j import=java.util.calendar %> A JSP A.1 JSP Servlet Java HTML JSP HTML Java ( HTML JSP ) JSP Servlet Servlet HTML JSP MyDate.jsp

More information

Questions and Answers

Questions and Answers Q.1) Servlet mapping defines A. An association between a URL pattern and a servlet B. An association between a URL pattern and a request page C. An association between a URL pattern and a response page

More information

FINALTERM EXAMINATION Spring 2009 CS506- Web Design and Development Solved by Tahseen Anwar

FINALTERM EXAMINATION Spring 2009 CS506- Web Design and Development Solved by Tahseen Anwar FINALTERM EXAMINATION Spring 2009 CS506- Web Design and Development Solved by Tahseen Anwar www.vuhelp.pk Solved MCQs with reference. inshallah you will found it 100% correct solution. Time: 120 min Marks:

More information

HttpServlet ( Class ) -- we will extend this class to handle GET / PUT HTTP requests

HttpServlet ( Class ) -- we will extend this class to handle GET / PUT HTTP requests What is the servlet? Servlet is a script, which resides and executes on server side, to create dynamic HTML. In servlet programming we will use java language. A servlet can handle multiple requests concurrently.

More information

Java Server Faces - The View Part

Java Server Faces - The View Part Berne University of Applied Sciences Dr. E. Benoist Bibliography: Core Java Server Faces David Geary and Cay Horstmann Sun Microsystems December 2005 1 Table of Contents Internationalization - I18n Motivations

More information

To follow the Deitel publishing program, sign-up now for the DEITEL BUZZ ON-

To follow the Deitel publishing program, sign-up now for the DEITEL BUZZ ON- Ordering Information: Advanced Java 2 Platform How to Program View the complete Table of Contents Read the Preface Download the Code Examples To view all the Deitel products and services available, visit

More information

S imilar to JavaBeans, custom tags provide a way for

S imilar to JavaBeans, custom tags provide a way for CREATE THE TAG HANDLER S imilar to JavaBeans, custom tags provide a way for you to easily work with complex Java code in your JSP pages. You can create your own custom tags to suit your needs. Using custom

More information

Session 8. JavaBeans. Reading & Reference. Reading. Reference. Session 8 Java Beans. 2/27/2013 Robert Kelly, Head First Chapter 3 (MVC)

Session 8. JavaBeans. Reading & Reference. Reading. Reference. Session 8 Java Beans. 2/27/2013 Robert Kelly, Head First Chapter 3 (MVC) Session 8 JavaBeans 1 Reading Reading & Reference Head First Chapter 3 (MVC) Reference JavaBeans Tutorialdocs.oracle.com/javase/tutorial/javabeans/ 2 2/27/2013 1 Lecture Objectives Understand how the Model/View/Controller

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Java Server Pages (JSP) Dr. Basem Suleiman Service Oriented Computing Group, CSE, UNSW Australia Semester 1, 2016, Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2442

More information

CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, JSPs 1

CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, JSPs 1 CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, 2004 JSPs 1 As we know, servlets, replacing the traditional CGI technology, can do computation and generate dynamic contents during

More information

Integrating Servlets and JSP: The MVC Architecture

Integrating Servlets and JSP: The MVC Architecture Integrating Servlets and JSP: The MVC Architecture Core Servlets & JSP book: More Servlets & JSP book: www.moreservlets.com Servlet and JSP Training Courses: courses.coreservlets.com 2 Slides Marty Hall,

More information

AJP. CHAPTER 5: SERVLET -20 marks

AJP. CHAPTER 5: SERVLET -20 marks 1) Draw and explain the life cycle of servlet. (Explanation 3 Marks, Diagram -1 Marks) AJP CHAPTER 5: SERVLET -20 marks Ans : Three methods are central to the life cycle of a servlet. These are init( ),

More information

Introduction to JSP and Servlets Training 5-days

Introduction to JSP and Servlets Training 5-days QWERTYUIOP{ Introduction to JSP and Servlets Training 5-days Introduction to JSP and Servlets training course develops skills in JavaServer Pages, or JSP, which is the standard means of authoring dynamic

More information

Java Technologies Web Filters

Java Technologies Web Filters Java Technologies Web Filters The Context Upon receipt of a request, various processings may be needed: Is the user authenticated? Is there a valid session in progress? Is the IP trusted, is the user's

More information

Structure of a webapplication

Structure of a webapplication Structure of a webapplication Catalogue structure: / The root of a web application. This directory holds things that are directly available to the client. HTML-files, JSP s, style sheets etc The root is

More information

JavaEE Interview Prep

JavaEE Interview Prep Java Database Connectivity 1. What is a JDBC driver? A JDBC driver is a Java program / Java API which allows the Java application to establish connection with the database and perform the database related

More information

Building Componentized Web Interfaces with Clay Instead of Tiles

Building Componentized Web Interfaces with Clay Instead of Tiles Interfaces with Clay Instead of Tiles Hermod Opstvedt Chief Architect DnB NOR ITU Hermod Opstvedt Page 1 A little history lesson Hermod Opstvedt Page 2 Struts Came about in June 2000. Introduced by Craig

More information

How To... Convert And Validate Data

How To... Convert And Validate Data SAP NetWeaver How-To Guide How To... Convert And Validate Data Applicable Releases: SAP NetWeaver Composition Environment 7.1 Topic Area: User Productivity Development and Composition Capability: User

More information

STRUTS 2 - HELLO WORLD EXAMPLE

STRUTS 2 - HELLO WORLD EXAMPLE STRUTS 2 - HELLO WORLD EXAMPLE http://www.tutorialspoint.com/struts_2/struts_examples.htm Copyright tutorialspoint.com As you learnt from the Struts 2 architecture, when you click on a hyperlink or submit

More information

Web Browser and Web Server Interaction View Static Webpage (p.3) View static webpage stored on a web server machine

Web Browser and Web Server Interaction View Static Webpage (p.3) View static webpage stored on a web server machine Object Oriented Programming and Internet Application Development Unit 7 Browser Based Internet Software Web Development with Java Servlet JavaServer Page (JSP) JavaServer Face (JSF) 07 - Browser Based

More information

Stateless -Session Bean

Stateless -Session Bean Stateless -Session Bean Prepared by: A.Saleem Raja MCA.,M.Phil.,(M.Tech) Lecturer/MCA Chettinad College of Engineering and Technology-Karur E-Mail: asaleemrajasec@gmail.com Creating an Enterprise Application

More information

Table of Contents. Introduction... xxi

Table of Contents. Introduction... xxi Introduction... xxi Chapter 1: Getting Started with Web Applications in Java... 1 Introduction to Web Applications... 2 Benefits of Web Applications... 5 Technologies used in Web Applications... 5 Describing

More information

CIS 764 Tutorial: Log-in Application

CIS 764 Tutorial: Log-in Application CIS 764 Tutorial: Log-in Application Javier Ramos Rodriguez Purpose This tutorial shows you how to create a small web application that checks the user name and password. Overview This tutorial will show

More information

sessionx Desarrollo de Aplicaciones en Red A few more words about CGI CGI Servlet & JSP José Rafael Rojano Cáceres

sessionx Desarrollo de Aplicaciones en Red A few more words about CGI CGI Servlet & JSP José Rafael Rojano Cáceres sessionx Desarrollo de Aplicaciones en Red José Rafael Rojano Cáceres http://www.uv.mx/rrojano A few more words about Common Gateway Interface 1 2 CGI So originally CGI purpose was to let communicate a

More information

Creating your first JavaServer Faces Web application

Creating your first JavaServer Faces Web application Chapter 1 Creating your first JavaServer Faces Web application Chapter Contents Introducing Web applications and JavaServer Faces Installing Rational Application Developer Setting up a Web project Creating

More information

CHAPTER 2 LIFECYCLE AND PAGE NAVIGATION

CHAPTER 2 LIFECYCLE AND PAGE NAVIGATION CHAPTER 2 LIFECYCLE AND PAGE NAVIGATION OBJECTIVES After completing Lifecycle and Page Navigation, you will be able to: Describe the JSF framework in terms of singleton objects that carry out tasks behind

More information

Fast Track to Java EE 5 with Servlets, JSP & JDBC

Fast Track to Java EE 5 with Servlets, JSP & JDBC Duration: 5 days Description Java Enterprise Edition (Java EE 5) is a powerful platform for building web applications. The Java EE platform offers all the advantages of developing in Java plus a comprehensive

More information

2. Follow the installation directions and install the server on ccc. 3. We will call the root of your installation as $TOMCAT_DIR

2. Follow the installation directions and install the server on ccc. 3. We will call the root of your installation as $TOMCAT_DIR Installing a Web Server 1. Install a sample web server, which supports Servlets/JSPs. A light weight web server is Apache Tomcat server. You can get the server from http://tomcat.apache.org/ 2. Follow

More information

COURSE 9 DESIGN PATTERNS

COURSE 9 DESIGN PATTERNS COURSE 9 DESIGN PATTERNS CONTENT Applications split on levels J2EE Design Patterns APPLICATION SERVERS In the 90 s, systems should be client-server Today, enterprise applications use the multi-tier model

More information

PORTIONS (PORTlet actions) User Guide

PORTIONS (PORTlet actions) User Guide PORTIONS (PORTlet actions) User Guide Controller Specification of the application's controller portlet.xml

More information