Write A Login Forward

Here in this section we are going to create a JSP View where Action Servlet forward the request coming from Action class .This request is forwarded to client as a response.
The Action Servelet decides JSP View on the behalf of key returned by Action class.


For this create a JSP page (e.g. success.jsp ).
Configure this JSP page in struts-cinfig.xml in tag .e.g Here success (name=”success”) is key returned by subclass of appropriate Action class. The action class may return any key. As par as key we can configure JSP

SourceCode:


               <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts      Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd">
               <struts-config>
               <form-beans>
               <form-bean name="LoginForm" type="com.wisedeveloper.LoginForm"/>
               </form-beans>
               <action-mappings>
               <action input="/login.jsp" name="LoginForm" path="/Login" scope="session" type="com.wisedeveloper.LoginAction">
               <forward name="success" path="/success.jsp" />
               <forward name="failure" path="/login.jsp" />
               </action>
               </action-mappings>
               <message-resources parameter="com.wisedeveloper.ApplicationResources"/>
               </struts-config>

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More