File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes About Action objects in Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "About Action objects in Struts" Watch "About Action objects in Struts" New topic
Author

About Action objects in Struts

Val Pecaoco
Ranch Hand

Joined: Dec 05, 2001
Posts: 156
Hi Ranchers,
I have some basic questions about Action objects:
1) Are Action objects servlets or Java beans?
2) If they are servlets, how can you pass initialization params to them? I tried the usual code in the init() method of a servlet, but it does not work.
Thanks in advance for the help.
Ex Animo Java!
-- Val

--------------------------------------------
"In your anger, don't sin." (Ephesians 4:26)


"Knowledge is power, but enthusiasm is the key." -- Lavern Barn
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
1) Are Action objects servlets or Java beans?
Neither. To quote the API, "An Action is an adapter between the contents of an incoming HTTP request and the corresponding business logic that should be executed to process this request".
Remember, a JavaBean is basically just a regular Java object that has the null constructor and getXxx and setXxx methods for its attributes. The Action class does not fit this criteria. Neither is it a Servlet
2) If they are servlets, how can you pass initialization params to them? I tried the usual code in the init() method of a servlet, but it does not work.
Your controller servlet in Struts is an instance of ActionServlet. This is usually implicitly generated based on the contents of the struts-config.xml file.
Val Pecaoco
Ranch Hand

Joined: Dec 05, 2001
Posts: 156
Hi Jason,
Thanks!
I guess I'm grossly mistaken, because I thought that if it's involved in a Web application it must either be a servlet, JSP, or JavaBean.
Does that mean that an "adapter" is a Java class that isn't a servlet, JSP, or JavaBean?
Ex Animo Java!
-- Val
[ July 03, 2002: Message edited by: Val Pecaoco ]
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Did you check the JavaRanch newsletter archive for the article on Struts written by one of our resident dopey sheriffs?


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About Action objects in Struts