Home Tutorialhelp Comment Sample Code for ForwardAction in Struts

 
 

Comment

Phenol Verma
Sample Code for ForwardAction in Struts,
July 14, 2008 at 3:03 PM

Here I am using ForwardAction with the help of index.jsp wich is connect to MyJsp.jsp and the bean I am using is MyForm. Here you have to create one package name "My" in "src", under this you have to put your "MyFrom". follewing is the code.......

index.jsp:-


<%@ page language="java"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>

<html>
<head>
<title>JSP for myform form</title>
</head>
<body>
<html:form action="/go1">
name : <html:text property="name"/><html:errors property="name"/><br/>
<html:submit/><html:cancel/>
</html:form>
</body>
</html>


MyJsp.jsp:-



<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="My.MyForm" %>

<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-template" prefix="template" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
<head>
<html:base />

<title>MyJsp.jsp</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>

<body>
<%MyForm my =(MyForm)session.getAttribute("myform");
out.println(my.getName());
%>
</body>
</html:html>


struts-config.xml:-


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>
<data-sources />
<form-beans >
<form-bean name="myform" type="My.MyForm" />

</form-beans>

<global-exceptions />
<global-forwards />
<action-mappings >

<action name="myform" scope="session" forward="/MyJsp.jsp" path="/go1" />

</action-mappings>

<message-resources parameter="com.yourcompany.struts.ApplicationResources" />
</struts-config>

Use this code and you can under stand how ForwardAction works in Struts.




View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
Struts Questions

Struts ForwardAction vs Forward tag in jsp - Struts
Struts ForwardAction vs Forward tag in jsp  difference between struts ForwardAction class and Forward tag in jsp 

Struts Examples

Struts Forward Action Example
Struts Forward Action Example  ..... Here in this example you will learn more about Struts Forward Action... about Struts ForwardAction (org.apache.struts.actions.ForwardAction 

Struts Questions

Forward - Struts
Forward  Hi how to get the return value of execute() in Action class. we will write return mapping.findForward("success"); how to get the value of forward. Is there any method to get the which forward is executing 

Struts Questions

struts
struts   <p>hi here is my code can you please help me to solve...; <p><html> <body></p> <form action="login.do">...*; import org.apache.struts.action.*; public class LoginAction extends Action 

Struts Questions

struts
struts  <p>hi here is my code in struts i want to validate my...;gt; &lt;html:form action="reg1.do"&gt; &lt;pre&gt... RegisterAction extends Action { public RegisterAction() { try 

Struts Questions

Struts
;Basically in Struts we have only Two types of Action classes. 1.BaseActions... only i.e ForwardAction,IncludeAction.But all these action classes extends Action...Struts  why in Struts ActionServlet made as a singleton what 

Struts Questions

problem:struts code - Struts
the action class,in action class i gave forward to same form,the problem is if i forward to same page the form displayed with previous fields.if i press refresh...problem:struts code  Hi, Am using struts1.2.I wrote a form 

Struts Questions

STRUTS
STRUTS   1) Difference between Action form and DynaActionForm? 2) How the Client request was mapped to the Action file? Write the code and explain 

Struts Questions

forward error message in struts
forward error message in struts  how to forward the error message got in struts from one jsp to other jsp?   Hello Friend, Use <%@ page.... The code errorPage="errorPage.jsp" forwards the exception message 

Struts Questions

How to validate a form in action class and forward errors to the jsp in struts?
How to validate a form in action class and forward errors to the jsp in struts?  How to validate a form in action class and forward errors to the jsp in struts 

Struts-Tutorials

Understanding Struts Action Class
Understanding Struts Action Class       In this lesson I will show you how to use Struts Action Class and forward a jsp file through it.  What is Action Class? An Action 

Struts Questions

Action Configuration - Struts
Action Configuration  I need a code for struts action configuration in XML 

Struts Questions

Struts Warnings ...About FormBeanConfig & about Cancel Forward - Struts
)WARNING: Unable to find 'cancel' forward. the contents of struts-config.xml...Struts Warnings ...About FormBeanConfig & about Cancel Forward  Hi Friends... I am trying a very small code samples of Contact Application i 

Struts Questions

struts - Struts
struts  Hi, I am new to struts.Please send the sample code for login and registration sample code with backend as mysql database.Please send the code immediately. Please its urgent. Regards, Valarmathi  Hi Friend 

Struts Questions

struts - Struts
-config.xml Action Entry: Difference between Struts-config.xml...struts  hi, what is meant by struts-config.xml and wht are the tags... 2. wht is the difference b/w the web.xml and struts-config.xml 3. what 

Struts Questions

STRUTS
STRUTS   Request context in struts? SendRedirect () and forward how to configure in struts-config.xml 

Struts Questions

servlet action not available - Struts
servlet action not available  hi i am new to struts and i am.... Struts Blank Application action org.apache.struts.action.ActionServlet config /WEB-INF/struts-config.xml 2 action *.do 

Struts Questions

Struts - Struts
with source code to solve the problem. For read more information on Struts visit...Struts  Hello I have 2 java pages and 2 jsp pages in struts registration.jsp for client to register user registeraction.java to forward 

Struts Questions

I have a doubt regarding action - Struts
struts,I got response through jsp and once again it redirecting to action..., Please check Action Mapping in the struts-config.xml. If you have any problem...://www.roseindia.net/struts/struts-forward-action.shtml Thanks. Amardeep 

Struts Questions

Sending large data to Action Class error. Struts code - Struts
Sending large data to Action Class error. Struts code  I have a jsp... in this d:\srideviMannem\ folder only 4. Create a sample database named 'myName...);} and in action class i want to get the value of variable 'val'.But since this is large 

Struts Questions

Struts - Struts
in struts 1.1 What changes should I make for this?also write struts-config.xml and jsp code. Code is shown below...().getRequestDispatcher("/src/saving.jsp").forward(request,response 

Struts Examples

Struts Dispatch Action Example
Struts Dispatch Action Example       Struts Dispatch Action... function. Here in this example you will learn more about Struts Dispatch Action 

Struts Questions

Struts - Struts
in struts? please it,s urgent...........  session tracking? you mean session management? we can maintain using class HttpSession. the code follows... for later use in in any other jsp or servlet(action class) until session exist 

Struts Questions

no action mapped for action - Struts
no action mapped for action  Hi, I am new to struts. I followed...: There is no Action mapped for action name HelloWorld 

Struts 1 Tutorials

STRUTS ACTION - AGGREGATING ACTIONS IN STRUTS
STRUTS ACTION - AGGREGATING ACTIONS IN STRUTS... of Action classes for your project. The latest version of struts provides classes... action. In this article we will see how to achieve this. Struts provides four 

Struts Questions

Struts Action Chaining
Struts Action Chaining  Struts Action Chaining 

Struts Questions

struts
, Richard Hightower 3)Struts in Action By Ted N. Husted, Cedric Dumoulin, George...struts  which is the best book to study struts on own? please tell me   You can learn struts through the following books: 1)Programming 

Struts Questions

struts
, Richard Hightower 3)Struts in Action By Ted N. Husted, Cedric Dumoulin, George...struts  which is the best book to study struts on own? please tell me   You can learn struts through the following books: 1)Programming 

Java Beginners

struts
struts  hi i would like to have a ready example of struts using "action class,DAO,and services" for understanding.so please guide for the same. thanks  Please visit the following link: Struts Tutorials 

Struts Questions

Struts dispatch action - Struts
Struts dispatch action  i am using dispatch action. i send the parameter="addUserAction" as querystring.ex: at this time it working fine. but now my problem is i want to send another value as querystring for example 

Development process Questions

how to forward select query result to jsp page using struts action class
how to forward select query result to jsp page using struts action class  how to forward select query result to jsp page using struts action class 

Java Beginners

struts
struts  hi i would like to have a ready example of struts using"action class,DAO,and services" so please help me 

Struts Questions

struts
struts  how to generate bar code for continuous numbers in a loop using struts ... or atleast for a given number 

Struts Questions

Browser Back/Forward - Struts
Browser Back/Forward  Hi, Greetings to all. I have developed a web application using Struts 2. Now, i want to enable browser back/forward... on Struts 2 visit to : http://www.roseindia.net/struts/struts2/index.shtml 

Struts Questions

jsp to struts 2 action conversion problem - Struts
jsp to struts 2 action conversion problem  i have one jsp page... page to a struts2 action?among that one jsp page is wrritten using jpivot,wct tags(i.e no java code is involved).remaining pages involve java code.  Hi 

Struts Questions

struts
struts   i have one textbox for date field.when i selected date from datecalendar then the corresponding date will appear in textbox.i want code for this in struts.plz help me 

Struts Questions

Struts(1.3) action code for file upload
Struts(1.3) action code for file upload  Hi All, I want to upload... application using HttpUrlConnection. How can i write my struts(1.3) action code... action or let me how the upload request is post to struts action. Thanks   

Struts Questions

code - Struts
code  How to write the code for multiple actions for many submit buttons.  use dispatch action 

Struts Questions

First Struts Application - Struts
First Struts Application  Hello, Hello, I have created a struts simple application by using struts 1.2.9 and Jboss 4.0.4. I am getting... action as unavailable ERROR [[/project1]] Servlet /project1 threw load 

Struts Questions

WRITE A CODE IN STRUTS ACTION CLASS FOR CHECK BOXES AND RADIO BUTTONS - Struts
WRITE A CODE IN STRUTS ACTION CLASS FOR CHECK BOXES AND RADIO BUTTONS  Hello frnds, I am sending this second time help me out. i need help from u esteemed and talented people.iwould like to write code in struts action class 

Struts Questions

struts
the checkbox.i want code in struts 

Struts Questions

struts - Struts
Struts dispatchaction vs lookupdispatchaction  What is struts...; Hi,Please check easy to follow example at http://www.roseindia.net/struts/understandingstruts_action_class.shtmlThanks 

Struts Questions

struts - Struts
struts  when the action servlet is invoked in struts?  Hi Friend, Please visit the following link: http://www.roseindia.net/struts/ Thanks 

Eclipse Plugins

Struts-It
to create all Struts artifacts like Form-bean, Action, Exception, etc... Action class other Struts-related classes like configuration... Struts-It       

Struts Questions

Struts Example - Struts
Struts Example  Hi Deepak My name is dendi i want some good example in struts framework with sample code , hw to add and delete insert and update data into database by using sql, nw i am learning java struts u can help me 

Struts Questions

Struts - Struts
Struts  What is Struts Framework?  Hi,Struts 1 tutorial with examples are available athttp://www.rosindia.net/strutsand Struts 2 Tutorials with code are available at http://www.rosindia.net/struts/struts2If you 

Struts Questions

Calling Action on form load - Struts
Calling Action on form load  Hi all, is it possible to call... this list is coming from the action which i m calling before the page is being... to direct user directly to this page i m calling an action which is preparing a list 

Struts Questions

Struts - Struts
Struts  Dear Sir , I m very new to struts how to make a program in struts and how to call it in action mapping to to froward another location. Acctually i m using netbeans ide when i select a new web application for struts its 

Struts-Tutorials

Struts Articles
; Strecks is built on the existing Struts 1.2 code base, adding a range of productivity... application. The example also uses Struts Action framework plugins in order to initialize the scheduling mechanism when the web application starts. The Struts Action 

Struts Questions

Struts Action Class
Struts Action Class  What happens if we do not write execute() in Action class 

Struts Questions

struts 2.0 - Struts
struts 2.0  i am new to struts2.0. i have to use struts 2.0 in my project. give sample examples for storing retrieving the data using oracle 10g. give examples on insertions(using struts2.0+oracle 10g). and send the code 

Struts Questions

Struts - Struts
code will help you learn Struts 2.Thanks...Java Bean tags in struts 2  i need the reference of bean tags in struts 2. Thanks!  Hello,Here is example of bean tags in struts 2:http 

Struts Questions

Struts - Struts
Struts  hi, I am new in struts concept.so, please explain example login application in struts web based application with source code . what are needed the jar file and to run in struts application ? please kindly 

Struts Questions

Regarding tiles and struts - Struts
Regarding tiles and struts  Hi, i have a struts application which...). So, redirect will not work. You can use the action class to conditionally forward to some page.Thanks 

Struts Questions

Struts - Struts
Struts  how to set value in i want to set Id in checkBox from the struts action.  Hi friend, For more information,Tutorials and Examples on Checkbox in struts visit to : http://www.roseindia.net 

Struts Questions

Struts - Struts
Struts  Hi, I m getting Error when runing struts application. i... /WEB-INF/struts-config.xml 1...... action org.apache.struts.action.ActionServlet application 

Struts Questions

Struts Action Classes
Struts Action Classes  1) Is necessary to create an ActionForm to LookupDispatchAction. If not the program will not executed. 2) What is the beauty of Mapping Dispatch Action 

Struts Questions

struts - Struts
struts  am retrieving data from the mysql database so the form bean will be null for that action.... if i give it in struts config it is asking me to have a form bean.... how to solve this problem 

Struts Questions

struts - Struts
struts  we are using Struts framework for mobile applications,but we are not using jsps for views instead of jsps we planning to use xhtmls.In struts ,we writing the action ="action class name"in jsp,here in xhtml what we have 

Struts Questions

struts - Struts
struts  we are using Struts framework for mobile applications,but we are not using jsps for views instead of jsps we planning to use xhtmls.In struts ,we writing the action ="action class name"in jsp,here in xhtml what we have 

Struts 1 Tutorials

Struts 1 Tutorial and example programs
better.   - Struts Forward Action...Struts 1 Tutorials and many example code to learn Struts 1 in detail. Struts 1... to the Struts Action Class This lesson is an introduction to Action Class 

Struts Questions

action tag - Struts
action tag  Is possible to add parameters to a struts 2 action tag? And how can I get them in an Action Class. I mean: xx.jsp Thank you 

Struts Questions

struts code - Struts
struts code   In STRUTS FRAMEWORK we have a login form with fields USERNAME: PASSWORD: In this admin can login and also narmal uses can log...://www.roseindia.net/struts/struts-login-form.shtml http://www.roseindia.net/struts/ Thanks 

Struts Questions

Struts - Struts
Struts  Is Action class is thread safe in struts? if yes, how it is thread safe? if no, how to make it thread safe? Please give me with good...://www.roseindia.net/struts/ Thanks 

Struts Questions

Login Action Class - Struts
Login Action Class  Hi Any one can you please give me example of Struts How Login Action Class Communicate with i-batis 

Struts Questions

Struts - Struts
Struts  Hello I like to make a registration form in struts inwhich... compelete code. thanks  Hi friend, Please give details with full source code to solve the problem. Mention the technology you have used 

Struts Questions

Struts 2 RequiredFieldValidator - Struts
What is Struts 2 RequiredFieldValidator? Need an Example or Code  What is Struts 2 RequiredFieldValidator? Need an Example or Code on Field Validation in Struts 2.  Please follow the following instruction:1. index.jsp 

Struts Questions

Struts Code - Struts
Struts Code  How to add token , and encript token and how decript token in struts.  Hi friend, Using the Token methods The methods we... more information,Tutorials and Examples on struts visit to : http 

Struts Questions

Struts code - Struts
Struts code   Hi Friend, Is backward redirection possible in struts.If so plz explain me 

Struts Questions

struts code - Struts
struts code  how to call lookup dispatchAction class method using on change of JavaScript 

Struts Questions

Action classes in struts
Action classes in struts  how many type action classes are there in struts   Hi Friend, There are 8 types of Action classes: 1.ForwardAction class 2.DispatchAction class 3.IncludeAction class 4.LookUpDispatchAction 

Struts Questions

struts <html:select> - Struts
struts   i am new to struts.when i execute the following code i am...=db.getDbConnection(); PreparedStatement ps=con.prepareStatement("select Dealer_Code from op... DealerForm(); String dcode=rs.getString(1); dform.setD_code(dcode 

Struts Questions

struts - Struts
struts  Hi, I need the example programs for shopping cart using struts with my sql. Please send the examples code as soon as possible. please send it immediately. Regards, Valarmathi   Hi Friend, Please 

Struts-Tutorials

Struts Tutorial
the information to them. Struts Controller Component : In Controller, Action class... equal forward greaterEqual iterate Struts Integration With Other Framework...In this section we will discuss about Struts. This tutorial will contain 

Struts Questions

struts - Struts
struts  hi, i have formbean class,action class,java classes and i configured all in struts-config.xml then i dont know how to deploy and test this application.Tell me the procedure.Iam using Tomcat5.5 server and eclipse 

Struts Questions

Java - Struts
in struts-config file i wrote the following action tag... doubt is when we are using struts tiles, is there no posibulity to use action class...Java  hello friends, i am using struts, in that i am using tiles 

Struts Questions

struts - Struts
struts  how to handle multiple submit buttons in a single jsp page of a struts application  Hi friend, Code to help in solving the problem : In the below code having two submit button's its values 

Struts Questions

validation problem in struts - Struts
project using struts framework. so i made a user login form for user authentication. nd i write d code for sql connection and user athunetication in d action class... 1st user d authentication condition is nt working . My action calss code 

Struts Questions

Struts - Struts
Struts  Dear Sir , I am very new in Struts and want to learn about validation and custom validation. U have given in a such nice way... and specify the type. 5 6 Zip Code needs to between 

Struts Questions

struts code - Struts
struts code  Hi all, i am writing one simple application using struts framework. In this application i thought to bring the different menus of my application in a tree view.Like what we have in window explorer when we click 

Struts Questions

Struts Code - Struts
Struts Code  Hi I executed "select * from example" query and stored all the values using bean . I displayed all the records stored in the jsp using struts . I am placing two links Update and Delete beside each record . Now I 

Struts Questions

java - Struts
java  i want to display a list through struts what code i writen in action, class , struts config.xml and jsp please tell me thnks for solving my probelm  Hi friend, To solve the problem to visit this link 

Struts Questions

Unable to understand Struts - Struts
{ /* forward name="success" path="" */ private static final String SUCCESS = "success"; /** * This is the action called from the Struts 

Struts Questions

struts - Struts
struts  how to solve actionservlet is not found error in dispatch action 

Struts Questions

Struts - Struts
Struts  is it correct to pass the form object as arg from action to service 

Struts Questions

java - Struts
friend. what can i do. In Action Mapping In login jsp   Hi friend, You change the same "path" and "action" in code : In Action Mapping In login jsp For read more information on struts 

Struts Questions

Need acode for struts implementation - Struts
Need acode for struts implementation  I want a code to generate dynamic table with a text field and a drop down list and to retrieve that data in the action class and store in the data base 

JavaScript Questions

struts application
not enter any data that time also it will saved into databaseprint("code sample...struts application  hi, i can write a struts application in this first i can write enter data through form sidthen it will successfully saved 

Struts Questions

struts - Struts
is taking different action.. as per my problem if we click on first two submit buttons it is going to action in the form tag.. but if we click on third submit... included third sumbit button on second form tag and i given corresponding action 

Struts Questions

Code Problem - Struts
Code Problem  Sir, am using struts for my application.i want to uses session variable value in action class to send that values as parameter... calling action class,in action class i want to pass userid to some other 

Struts Questions

Code Problem - Struts
Code Problem  i want to insert multiple row values (from html table... values.now i want to insert these 10 row values into databse usinf struts form beans and/or action with dao class 

Struts Questions

multiple configurstion file in struts - Struts
the solution. I have three configuration file as 'struts-config.xml','struts-module.xml' and 'struts-comp.xml'.I have three jsp pages as 'index1.jsp','index2.jsp', 'index3.jsp' .I want to know that when any action occurs in these jsp pages 

Struts Questions

Struts - Struts
*; public class UserRegisterForm extends ActionForm{ private String action="add...(); return errors; } public String getAction() { return action; } public void setAction(String action) { this.action = action; } public 

Struts Questions

Struts - Struts
UserRegisterForm extends ActionForm{ private String action="add"; private...() { return action; } public void setAction(String action) { this.action = action; } public String getAddress 

Struts Questions

Error - Struts
Error  Hi, I downloaded the roseindia first struts example and configured in eclips. It is working fine. But when I add the new action and I create the url for that action then "Struts Problem Report Struts has detected 

Struts Questions

STRUTS
STRUTS  MAIN DIFFERENCES BETWEEN STRUTS 1 AND STRUTS

Struts Questions

Struts
Struts   How to retrive data from database by using Struts 

Struts Questions

STRUTS
STRUTS  MAIN DIFFERENCES BETWEEN STRUTS 1 AND STRUTS

Struts Questions

Struts + HTML:Button not workin - Struts
Struts + HTML:Button not workin  Hi, I am new to struts. So pls... is called. JSP code -------- Actionclass... check accordingly in action class. But it displays null. Please let me know what 

Struts Examples

Struts LookupDispatchAction Example
;     Struts LookupDispatch Action... in the action tag through struts-config.xml file). Then this matching key is mapped... is the code for Action Class package roseindia.net 

Advertisements Advertisements
 

 

 

DMCA.com