Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Understanding Struts Action Class: Signature, Parameters, and Configuration, Lecture notes of Java Programming

The role of the action class in the struts framework, providing its signature, parameters, and an example of its configuration in the struts-config.xml file. It also demonstrates how to test an action class by adding a link in the index.jsp file.

Typology: Lecture notes

2011/2012

Uploaded on 08/09/2012

dhanyaa
dhanyaa 🇮🇳

4.7

(3)

62 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download Understanding Struts Action Class: Signature, Parameters, and Configuration and more Lecture notes Java Programming in PDF only on Docsity! Understanding Action Class Here is the signature of the Action Class. public ActionForward execute(ActionMapping mapping, ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.lang.Exception Action Class process the specified HTTP request, and create the corresponding HTTP response (or forward to another web component that will create it), with provision for handling exceptions thrown by the business logic. Return an ActionForward instance describing where and how control should be forwarded, or null if the response has already been completed. Parameters: mapping - The ActionMapping used to select this instance form - The optional ActionForm bean for this request (if any) request - The HTTP request we are processing response - The HTTP response we are creating Throws: Action class throws java.lang.Exception - if the application business logic throws an exception Adding the Action Mapping in the struts-config.xml To test the application we will add a link in the index.jsp <html:link page="/TestAction.do">Test the Action</html:link> Following code under the <action-mappings> tag is used to for mapping the TestAction class. <action path="/TestAction" type="sturtTest.TestAction"> <forward name="testAction" path="/TestAction.jsp"/> </action> To test the new application click on Test the Action link on the index page. The content of TestAction.jsp should be displayed on the user browser. docsity.com
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved