Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Struts Novice: Using Action/ActionForms?

Reply
Thread Tools

Struts Novice: Using Action/ActionForms?

 
 
gilgantic
Guest
Posts: n/a
 
      02-04-2004
Few random questions about Struts:
(Note: I left out ActionServlet and Model classes out of my questions)
1. Should every JSP have one "ActionForm" and "Action" class associated with it?
2. Is Action-to-Action (Action Chaining) possible? If so, is it a good practice?
3. Is the normal flow JSP (POST)-> Action -> ActionForward -> ActionForm -> JSP?
 
Reply With Quote
 
 
 
 
Sudsy
Guest
Posts: n/a
 
      02-04-2004
gilgantic wrote:
> Few random questions about Struts:
> (Note: I left out ActionServlet and Model classes out of my questions)
> 1. Should every JSP have one "ActionForm" and "Action" class associated with it?
> 2. Is Action-to-Action (Action Chaining) possible? If so, is it a good practice?
> 3. Is the normal flow JSP (POST)-> Action -> ActionForward -> ActionForm -> JSP?


Start here:
<http://www.sudsy.net/technology/struts-arch.html>
Then read the other articles in the same family.
To answer your questions:
1. Not necessarily. That's not ducking the question, BTW. You might have
a search facility included on the page which would submit to a
different action.
2. Certainly possible but you'd have to carefully consider the potential
for side-effects.
3. No. POST->ActionForm->Action->ActionForward->JSP. The article I cited
includes a nice flow-chart.

 
Reply With Quote
 
 
 
 
Larry
Guest
Posts: n/a
 
      02-07-2004
See below...

"gilgantic" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Few random questions about Struts:
> (Note: I left out ActionServlet and Model classes out of my questions)


> 1. Should every JSP have one "ActionForm" and "Action" class associated

with it?
Normally, yes. If your JSP has a <form> tag and POST, then you should have
an ActionForm for validation of the form data and an Action to process the
form.

> 2. Is Action-to-Action (Action Chaining) possible? If so, is it a good

practice?
An Action class is just a hybrid Servlet, so and Action class can call
another action class. Typically, you would call another JSP to display
results, etc. We have used Actions to call another Action in special cases
(like passing data from a process type Action to an Action that generates a
list of that data).

> 3. Is the normal flow JSP (POST)-> Action -> ActionForward ->

ActionForm -> JSP?
The processing flow is JSP -> ActionServlet -> ActionForm -> Action -> JSP.
ActionServlet (the Controller) is called behind-the-scenes via your mapping
in struts-config.xml, which in turn calls your ActionForm. The ActionForm
(just a JavaBean container for data) must be loaded with the data from your
JSP so the Action can "execute" it.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it safe to point to Internet for locating struts DTD files in struts TLDs and XML files? Katie Wright Java 8 01-07-2005 03:37 PM
[Struts] Newbie - For ActionForm population, must I use Struts taglib? Pratap Das Java 2 04-05-2004 07:42 PM
[Struts]output javascript in struts perform() sin Java 3 02-22-2004 08:27 AM
Integrate a Struts app with a non-struts app jc1771 Java 0 12-28-2003 06:36 PM
Struts Installation - missing struts.tld??? Jason Us Java 0 10-03-2003 11:36 PM



Advertisments