35
Struts Material What is web application? 1) A web application is a collection of web resource programs and each web resource program generates one web page. What is Architecture? 1) Architecture gives plan and flow of execution to the programmer to develop the applications. What is plug-in? 1) Plug-in is a piece of software which can enhance (improve (or) add) the functionalities of existing software (or) software application. In java plug-ins come as jar files. What is Struts Configuration File? 1) Struts configuration file (struts-config.xml) is heart of the struts application. It is useful to provide the guidelines and instructions to the ActionServlet to generate the integration logic dynamically and to decide the flow of execution. This file contains the following configurations. 1) Formbean class configuration 2) Action class configuration 3) ActionForward configuration 4) plug-in configuration 5) Properties file configuration and etc. 1) Servlet container reads web.xml file. 2) ActionServlet reads struts-config.xml file. 3) Servlet container is responsible to create and manage ActionServlet class object. 4) ActionServlet is responsible to create and manage Formbean and Action class object. What is <action-mappings> tag in struts configuration file? 1) The process of linking Formbean and ActionForwards (result pages) with Action class is technically called as “Action Mapping Operation”. 1) A Formbean is identified through its logical name. 38

Struts Interview Material

  • Upload
    vaka

  • View
    15

  • Download
    0

Embed Size (px)

DESCRIPTION

Struts

Citation preview

Struts MaterialWhat is web application?1) A web application is a collection of web resource programs and each web resource program generates one web page.What is Architecture?1) Architecture gives plan and flow of execution to the programmer to develop the applications.What is plug-in?1) Plug-in is a piece of software which can enhance (improve (or) add) the functionalities of existing software (or) software application. In java plug-ins come as jar files.What is Struts Configuration File?1) Struts configuration file (struts-config.xml) is heart of the struts application. It is useful to provide the guidelines and instructions to the ActionServlet to generate the integration logic dynamically and to decide the flow of execution. This file contains the following configurations.1) Formbean class configuration2) Action class configuration3) ActionForward configuration4) plug-in configuration5) Properties file configuration and etc.1) Servlet container reads web.xml file.2) ActionServlet reads struts-config.xml file.3) Servlet container is responsible to create and manage ActionServlet class object.4) ActionServlet is responsible to create and manage Formbean and Action class object.What is tag in struts configuration file?1) The process of linking Formbean and ActionForwards (result pages) with Action class is technically called as Action Mapping Operation.1) A Formbean is identified through its logical name.2) An Action class is identified through its action path.3) An ActionForward is identified through its logical name.Explain about jsp tag library?1) Jsp tag library is a library that contains set of readily available jsp tags.2) Tag handler class defines the functionality of jsp tag.3) Each tag handler class must extend from javax.servlet.jsp.tagext.TagSupport class.4) Every jsp tag library contains one tld file (Tag library descriptor (xml)). This tld file contains following configurations.1) Jsp tag name2) Tag handler class name3) attribute names4) Possible values of each attribute and etc. Every tag of jsp tag library must be accessed through prefix. This prefix word (or) letter is programmer choice. If two jsp tags of two different jsp tag libraries are having same name in order to use both tags in a single jsp program we can differentiate them through prefixes.Can I place parameterized constructor in our Formbean class and Action class of struts application?1) Internally ActionServlet uses zero argument constructor while creating objects for Formbean and struts Action classes. So make sure that zero argument constructor is available in Formbean and Action classes directly (or) indirectly. In every struts Action class the ActionServlet class is visible with fixed name servlet.How many tag libraries are available in struts application?In struts we have 5 jsp tag libraries. They are:1) Html tag library2) Bean tag library3) Logic tag library4) Nested tag library5) Tiles tag libraryThese tag libraries are useful to develop jsp programs of web application as java codeless jsp programs.What is Struts?Struts is a open source framework given by the Apache software foundation. It is used to develop web applications in java with mvc2 architecture.Another Def1) Struts is a open source framework given by the Apache software foundation.2) Framework is a piece of software. This software contains a solution for rapidly occurred problems in every project.3) For example, If we use servlets and jsp's in our project, programmer write the singleton java classes, front controller servlet class, perform the IOC operation 4) And write the code to perform the form validations. But if we use struts framework, struts people have provided all these features along with the struts framework.Why ActionServlet should be configured as Front Controller?1) In struts, Action class is an ordinary java class. 2) So it can't take http request directly from the client (or) browser even though it contains business logic to process the request. 3) To overcome this problem ActionServlet is configured as front controller servlet. 4) For this Directory Match (or) Extension Match URL pattern should be specified in web.xml file.What is Front Controller Servlet?1) Front Controller is a special web resource program in the web application.2) It is capable of trapping and taking request coming to other web resource programs of web application.3) Servlet (or) jsp program becomes front controller only when it contains extension match (or) directory match URL pattern.There are 3 ways to provide url-pattern to a servlet program:Exact Match: This URL pattern must begin with "/" symbol and should not contain "*" symbol. Example1: /abcExample2: /abc/xyzExample3: /abc.do

Directory Match: This URL pattern must begin with "/" symbol and end with "*" symbol. Example1 :/xyz/abc/*Example2 :/xyz/*Example3 :/x/y/abc/*

Extension Match: This url-pattern must begin with "*" symbol and must end with extension word (or) letter.Example1 :*.doExample2 :*.123

Every servlet is a single instance multiple threads component. ActionServlet is also servlet then what is the need of giving ActionServlet class as Singleton java class?1) Servlet is a single instance and multiple threads component.2) That means even though we are sending multiple requests from different browsers to our servlet program, the servlet container creates only one object to our servlet program and starts multiple threads for multiple requests.3) But some servers violate the servlet specification rules by creating multiple objects for a single servlet class. 4) So to overcome this problem apache people have made ActionServlet as a Singleton java class.5) Singleton java class allows us to create the object to the class only once per JVM.

Diagram:

What is RequestProcessor?1) RequestProcessor is a predefined java class.2) It is available in "org.apache.struts.action" package.3) This class acts as a helper class to the ActionServlet.4) That means this class will take lot of operations on behalf of the ActionServlet.5) Similarly this class can also be used to pass additional instructions to the ActionServlet.RequestProcessor Methods:1) public void process(HttpServletRequest request,HttpServletResponse response);2) protected Action processActionCreate(HttpServletRequest request,HttpServletResponse response,ActionMapping mapping);3) protected ActionForm processActionForm(HttpServletRequest request,HttpServletResponse response,ActionMapping mapping);4) protected ActionForward processActionPerform(HttpServletRequest request,HttpServletResponse response,Action action,ActionForm form,ActionMapping mapping);5) protected ActionForward processException(HttpServletRequest request,HttpServletResponse response,Exception exception,ActionForm form,ActionMapping mapping);6) protected void processLocale(HttpServletRequest request,HttpServletResponse response);7) protected ActionMapping processMapping(HttpServletRequest request,HttpServletResponse response,String path);8) protected String processPath(HttpServletRequest request,HttpServletResponse response);9) protected boolean processValidate(HttpServletRequest request,HttpServletResponse response,ActionForm form,ActionMapping mapping);

What is Abstract Controller? (Or) Explain Abstract Controller Design Pattern?Problem: Hard coding main logics directly in Intercepting Filter Program (Servlet Filter), Front Controller is not recommended process because it kills the flexibility of modification.Solution: Develop helper java class for Intercepting Filter Program/Front Control Program having main logics to get the flexibility of modification. This helper class is nothing but Abstract Controller.Diagram: See in the Design Pattern Notes.1) Abstract controller class is very useful to customize the logics of Front Controller Program (or) Intercepting Filter Program being from outside of those programs. 2) In struts 1.x environment RequestProcessor class is Abstract Controller for Front Controller ActionServlet similarly in struts 2.x environment Interceptors are the Abstract Controllers for Intercepting Filter (or) Controller called Filter Dispatcher.What is form bean class? What is the need of form bean class?1) According to mvc2 architecture the controller servlet is responsible to perform the form validations.2) But in struts, ActionServlet act as a controller servlet and it is a predefined servlet.3) So programmer can't edit the source code of ActionServlet by placing form validation logic in ActionServlet.4) To overcome this problem struts people have provided predefined ActionForm class in a package called "org.apache.struts.action".5) It is abstract class which contains no abstract methods.6) So we must extend that class with our class and override validate() method in our class to provide the code for validations.Note:1) ActionServlet is responsible to create the object to form bean class by calling the processActionForm() method of RequestProcessor class, Then ActionServlet Call the reset() method and store the data in form bean object by calling setter methods of form bean class.2) Now this form bean object is added to the specified scope.3) Now ActionServlet calls the processValidate() method of RequestProcessor class to check the validate attribute value in struts configuration file.What is Dependency Injection(or) IOC?1) If the underlying software (or) framework (or) container (or) server (or) special resource of the application is assigning values to our resource dynamically (or) automatically then that process is called as dependency injunction.Explain VO (or) DTO design pattern?1) Transferring huge amount of data one by one for multiple times it is not recommended because it increases round trips.2) Instead of that combine all these values into a single object and send that object from source layer to the destination layer. 3) This process reduces round trips between source and destination layer and makes sending and receiving operations as easy.Note: In struts application form bean class act as a VO (or) DTO class. 4) In struts application ActionServlet reads the multiple values from the form and store all these values into form bean object and send that form bean object to the struts action class of execute() method as a parameter.Can I write both web.xml and struts configuration file related xml entries in a single xml file?1) Not possible, because servlet container will reads the contents from web.xml file and ActionServlet will reads the contents from struts configuration file. That means both are different resources so they must be write in two different files.How to pass data from struts Action class to result jsp pages?1) In Struts, Action class & its result page are using same request and response object. So use request attribute otherwise we can use session attribute (or) application attribute (ServletContext).What is ActionMapping class? What is the need of ActionMapping class?1) ActionMapping is a predefined java class.2) It is available in "org.apache.struts.action" package.3) ActionServlet will create the object to ActionMapping class by calling the processMapping() method of RequestProcessor class.4) The "mapping" object represents of struts configuration file.5) Using this object we can know current request related details of current Action class from the source code of current Action class.6) This object is also useful to generate ActionForward object representing result page of Action class.7) This object can also be used to make current Action class communicate with another Action class.What is ActionForward class? What is the need of ActionForward class?1) ActionForward is a predefined java class.2) It is available in "org.apache.struts.action" package.3) ActionServlet will create the object to ActionForward class by calling the processActionPerform() method of RequestProcessor class.4) This object is always points to the result pages.What is Action class? What is the need of Action class?1) According to mvc2 architecture the controller servlet is responsible to communicate with model component. 2) But in struts ActionServlet is a predefined controller servlet.3) So programmer can't edit the source code of ActionServlet.4) To overcome this problem ActionServlet takes the support of Action class to communicate with model component.5) Here Action class means a class which is a subclass of "org.apache.struts.action.Action" is called Action class.6) Because Action class is a programmer supplied java class it contains the logic to communicate with model component.There are 2 approaches to work with jsp tag library in our java web application (or) struts application.Approach 1: By using user defined taglib uri.Note: Our StrutsApp Project is using approach 1 to work with struts supplied html tag library.Approach 2: By using fixed taglib uri.Procedure to work with approach 1 based JSP tag libraries utilization:1) Keep tag handler classes related jar files (struts-taglib-1.3.10.jar and struts-tiles-1.3.10.jar) in WEB-INF/lib folder.2) Place required tld files in WEB-INF folder of web application.3) Configure jsp tag library in web.xml file having user defined taglib uri. xyz /WEB-INF/struts-html.tld

4) Use jsp tags of tag library in jsp programs of web application by specifying that user defined taglib uri.

UserName:PassWord:

Every jsp tag library related tld file contains one fixed tag lib uri. We can collect from the tag of that tld file.Struts supplied jsp tag library related fixed taglib uris.

Procedure to work with jsp tag library based on approach 2:1) Keep jar files in WEB-INF\lib folder which represents tag handler classes and tld files of jsp tag library (struts-taglib-1.3.10.jar and struts-tiles-1.3.10.jar).2) Gather fixed taglib uri from tld file and specify in jsp program then start working with tags of tag library(the uri's as shown above).3) Register.jsp with fixed uri of struts supplied html tag library.

UserName:PassWord:

Note:1) Approach-2 is recommended.2) There is no need of adding any tld files in WEB-INF folder.3) Configuration of in web.xml file is not required.

1) When source servlet uses rd.forward() method to communicate with destination web resource program directly. The source and destination programs will use same request and response objects.2) When source servlet program uses response.sendRedirect() method to communicate with destination web resource program. The source and destination programs will not use same request and response objects.3) Generally ActionServlet and struts Action class uses same request and response objects and also ActionServlet and result page uses same request and response objects. So we can say struts Action class and its result page will also use same request and response objects.4) Redirect="false" indicates ActionServlet internally uses rd.forward() method to communicate with result page. Due to this ActionServlet and its result page, Action class and its result page will be using same request and response objects.5) False is the default value of redirect attribute.6) Redirect="true indicates ActionServlet internally uses response.sendRedirect() method to communicate with result page. Due to this ActionServlet and its result page, Action class and its result page will not use same request and response objects.How to pass result values (or) data from Action classes to result page of struts application?1) If Action class and its result page uses same request and response objects (redirect=false) then use request attributes otherwise use session attributes (when redirect=true).Diagram

1) In the above diagram ServletOne, ServletTwo and ServletThree are participating in a servlet chaining so they use same request and response objects.2) Request attribute created in ServletOne program is visible and accessible in ServletTwo and ServletThree but not in ServletFour.3) Session attribute created in ServletOne program is visible and accessible if remaining servlet programs only when they get request from same browser window1.4) ServletContext attribute is created in ServletOne program is visible and accessible if remaining servlet programs getting the request from the same browser window (or) different browser window.Case 1:When i Send a request from the browser window 1 to ServletOne with the URL http://localhost:9999/ServletApp/servletone. Then we get the following output on the browser window.

Case 2:When I send a request from the browser window 1 to ServletTwo with the URL http://localhost:9999/ServletApp/servlettwo. Then we get the following output on the browser window.

Case 3:When I send a request from the browser window 1 to ServletThree with the URL http://localhost:9999/ServletApp/servletthree. Then we get the following output on the browser window.

Case 4:When I send a request from the browser window 1 to ServletFour with the URL http://localhost:9999/ServletApp/servletfour. Then we get the following output on the browser window.

Note: In the above 4 cases I perform the operation without closing the browser window 1.Case 5: Now I close browser window 1 and does not stop the server and send request from the browser window 2 to the ServletTwo, ServletThree and ServletFour. Then we get the following output on the browser window.URL: http://localhost:9999/ServletApp/servlettwo

URL: http://localhost:9999/ServletApp/servletthree

URL: http://localhost:9999/ServletApp/servletfour

Case 6: Now I close browser window 2 and stop the server and send request from the browser window 3 to the ServletTwo, ServletThree and ServletFour. Then we get the following output on the browser window.URL: http://localhost:9999/ServletApp/servlettwo

Struts Register ApplicationRegisterAction.javapackage app;import org.apache.struts.action.*;import javax.servlet.ServletContext;import javax.servlet.http.*;public class RegisterAction extends Action{public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response)throws Exception{int a=10;int result1=a;int result2=a*a;String s="bhaskarreddy";//create request attributerequest.setAttribute("attr1",new Integer(result1));//create the session attributeHttpSession session=request.getSession();session.setAttribute("attr2",result2);//create application scopeServletContext application=servlet.getServletContext();application.setAttribute("attr3",s);RegisterForm rf = (RegisterForm)form;String user = rf.getUsername();String pass = rf.getPassword();if(user.equals("bhaskar") && pass.equals("java"))return mapping.findForward("ok");elsereturn mapping.findForward("fail");}}

RegisterForm.javapackage app;import org.apache.struts.action.*;public class RegisterForm extends ActionForm{private String username = null;private String password = null;public void setUsername(String username){this.username = username;}public String getUsername(){return username;}public void setPassword(String password){this.password = password;}public String getPassword(){return password;}}

1) In the above code redirect=true means ActionServlet uses response.sendRedirect() method to transfer the control to result page(success.jsp)that means ActionServlet and result page ,Action class and result page will not use same request and response objects.2) In this case on the browser we will get the following output.

3) Redirect=false (default value) means ActionServlet uses rd.forward() method to send the control to result page(failure.jsp). This indicates ActionServlet and result page, Action class and result page will use same request and response objects.4) In this case on the browser we will get the following output.

Note: ActionServlet and Action class uses same request and response objects irrespective of whether redirect=true/false.1) Attribute is a logical name that holds java object as a value and can carry data from one web resource program to another web resource program like Action class to result page.2) To write above code in success.jsp/failure.jsp to make those jsp programs as java codeless jsp programs we can work with the struts supplied bean, logic tag library tags.3) The can be used to read any scope attribute value, where as tag can be used to check whether given attribute value is null/empty value or not.4) We can write code in success.jsp/failure.jsp as shown below to make them as java code less jsp program.

Request Attribute Value is:

Session Attribute Value is:

Application Attribute Value is :

5) In , the scope option is optional. Because these tags can verify for the given attributes in multiple scopes (like request, session and application scopes).Request Attribute Value is:

Session Attribute Value is:

Application Attribute Value is :

6) When scope attribute is not specified the and tag internally use pageContext.findForward() method to verify the attribute in multiple scopes.if(pageContext.findAttribute("attr1")!=null){Request Attribute value is :out.println(pageContext.findAttribute("attr1"));}

7) We can use tag to read the form data from formbean properties.The given form data is

How to display the struts action class generated result on the form page itself using which request is generated?Step1: Configure the form page(register.jsp) as result page for struts Action class(RegisterAction.java).

Step2: Write the following code in the execute() method of struts Action class to store the business logic generated result as request attribute values.1) Same as RegisterAction.java

Step3: Write the following code at the end of register.jsp to read and display the request attribute values.

UserName:PassWord: Request Attribute Value is:

Session Attribute Value is:

Application Attribute Value is :
The given form data is

Note:1) In the above jsp format attribute is required only when attribute value is numeric value otherwise we will get the following exception on the browser window.javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE

Output on the browser window

How can you count no of request coming to struts based web application? (Or)Is there any need of developing user defined ActionServlet class?1) Since the front controller ActionServlet traps and takes all the request coming to struts application you think to place the above said request counting logic in ActionServlet. But we can't do that work because ActionServlet is a predefined servlet.2) To overcome these problem develop our own servlet class extending from ActionServlet and configure that servlet class as front controller of struts application.Step1: Develop our own servlet class extending from ActionServlet having counter logic as shown below.package app;import java.io.IOException;import javax.servlet.ServletContext;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.ActionServlet;public class MyActionServlet extends ActionServlet {int count=0;public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {count++;//get ServletContext objectServletContext application=getServletContext();//keep counter value in application(ServletContext) attribute valueapplication.setAttribute("cnt",count);//auto boxing feature is used//call doGet(-,-) method of predefined ActionServlet classsuper.doGet(request,response);}//doGetpublic void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {doGet(request, response);}//doPost(-,-)}//class

Step2: Configure our servlet in web.xml file having extension match url pattern as front controller. myaction app.MyActionServlet config /WEB-INF/struts-config.xml 1 myaction *.do

Step3: Read and display application attribute value (ServletContext attribute created in step1) from all the jsp programs of struts application.In register.jsp/success.jsp/failure.jspNumber of Requests are :

Out on the browser window

Working with properties fileWhat is properties file? A text file that maintains the entries in the form of (key=value) pairs is called as properties file.Example:

We use properties file in the struts application in the following areas.1) To gather presentation logic labels from outside the jsp programs and to make them re-usable in multiple jsp programs.2) To maintain form validation error messages.3) To develop I18N applications.4) To make jdbc details like driver class name, URL, username, and password as flexible and reuse them in multiple action classes.Procedure to add properties file to the struts application having presentation logic labels of the form pageStep1: Add properties file in WEB-INF/classes folder of struts application as shown below.

Step2: Configure the properties file in struts configuration file.

Step3: Read presentation logic labels from properties file being from jsp program as shown below.


:
:

Note:1) Dont keep more than 500 lines in one property file for better performance.2) Properties file is also known as Resource Bundle File (or) Application Resource File.Internationalization(I18N)1) Making our application (or) webapplication specific to one "Locale" is called as "localization".2) Making our webapplication ready to work with multiple "Locales" is called as Internationalization(I18N).Locale means Country+Language.

Examplesen-US,fr-FR,de-DE,fr-CA,hi-IN

3) To enable I18N we need to work with multiple properties files and each properties file should have one locale specific presentation logic labels.4) In stand alone and regular classic web applications we need to use "java.util.ResourceBundle" class for I18N effect.5) Struts gives built in support to work with I18N concepts.6) Struts 1.x and 2.x gives built in support to enable I18N on strutsbased webapplication.Procedure to enable I18N on struts 1.x ApplicationStep1: Prepare multiple properties files having base file and locale specific files having presentation logic labels.

Step2: Configure only base properties file in struts configuration file.

Step3: Use tag to read the presentation logic labels from the activated properties file.

Step4: Deploy the struts application in web server in regular manner.Step5: Choose accept-language header through browser setting and send request to that struts application. If accept-language header value is fr then it looks for App-fr.properties file if not available then it looks for application properties file (base file).Struts Validator Framework ExampleExample for Server Side Validations1. Prototype:

2. PatientRegister.jsp

Registration Screen

3. Patient-config.xml(struts-config.xml)

4. Patient.xml(validation.xml)mask^[a-zA-Z]*$minlength10min20max100datePatternyyyy-MM-ddmask ^\d{5,10}$

5. Patient.properties(MessageResources.properties)# Struts Validator Error Messageserrors.header=List of error(s)errors.footer=errors.required={0} is required.errors.minlength={0} can not be less than {1} characters.errors.maxlength={0} can not be greater than {1} characters.errors.invalid={0} is invalid.

errors.byte={0} must be a byte.errors.short={0} must be a short.errors.integer={0} must be an integer.errors.long={0} must be a long.errors.float={0} must be a float.errors.double={0} must be a double.

errors.date={0} is not a date.errors.range={0} is not in the range {1} through {2}.errors.creditcard={0} is an invalid credit card number.errors.email={0} is an invalid e-mail address.

my.error.id=
IDmy.error.name=
Namemy.error.address=
Addressmy.error.email=
Emailmy.error.age=
Agemy.error.doj=
Date of Joiningmy.error.telephone=
Telephone Numbermy.error.mask.name=
Please provide only alphabets for Namemy.error.mask.telephone=
Please provide 5 (or) 10 integer digit Telephone Nomber

#RegisterPatient.jsp page labelsregistration.id=Patient IDregistration.name=Patient Nameregistration.email=E-Mail Addressregistration.address=Resedential Addressregistration.doj=Date of Joining (YYYY-MM-DD)registration.age=Ageregistration.telephone=Telephone Number

6. Web.xmlaction org.apache.struts.action.ActionServletapplicationPatient config /WEB-INF/patient-config.xml 1 action*.do Register.jsp /tags/struts-html /WEB-INF/struts-html.tld /WEB-INF/struts-bean.tld/WEB-INF/struts-bean.tld

7. PatientRegisterAction.javaimport javax.servlet.http.*;import org.apache.struts.action.*;import java.sql.*;import org.apache.struts.validator.DynaValidatorForm;public class PatientRegisterAction extends Action {public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {Connection con = null;PreparedStatement ps = null;String status = null;try{ DynaValidatorForm b=(DynaValidatorForm)form; Class.forName("oracle.jdbc.driver.OracleDriver");con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "system", "admin");ps = con.prepareStatement("INSERT INTO PATIENT VALUES(?,?,?,?,?,?,?)");ps.setInt(1, Integer.parseInt((String)b.get("id")));ps.setString(2, (String)b.get("name"));ps.setString(3, (String)b.get("address"));ps.setString(4, (String)b.get("email"));ps.setDate(5, java.sql.Date.valueOf((String)b.get("doj")));ps.setInt(6, new Integer((String)b.get("age")).intValue());ps.setString(7, (String)b.get("telephone"));status = null;if(ps.executeUpdate() == 0)status = "fail";elsestatus = "ok";}catch(ClassNotFoundException ce){ce.printStackTrace();}catch(SQLException se){se.printStackTrace();}finally{try{if(ps != null)ps.close();}catch(SQLException se){}try{if(con != null)con.close();}catch(SQLException se){}} return mapping.findForward(status); } // execute()} // class

8. Success.html

Registration Successful !!!

9. Failure.jsp

The following error(s) were encountered :


Try Again ?

10. Failure.html

Registration Failure !!!

39