wood burning stoves*
The moose likes Struts and the fly likes ActionServlet (struts is screwing me up...) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ActionServlet (struts is screwing me up...)" Watch "ActionServlet (struts is screwing me up...)" New topic
Author

ActionServlet (struts is screwing me up...)

Lukas Alamar
Ranch Hand

Joined: Mar 17, 2004
Posts: 68
hi all! it just seems like my ActionServlet subclass cannot get to the action class nor use the form bean for validation...
i configured everything fine.. i dont get any significant error messages..i put logging statements inside my ActionForm's validate() method and my Action's execute() method, but it never gets there!

i get a 404 - file not found error on my browser ..thats bad



can anybody give me a hint??

im using tomcat 5

thanx
[ June 10, 2005: Message edited by: Lukas Alamar ]

SCJP 1.4
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I suspect there may be something wrong with your class that extends ActionServlet. Any methods you override should call the superclass's implementation of the method before proceeding with their own extension of the logic.

It might be helpful to show us the method that you are overrriding.

The other question is: Why are you overriding ActionServlet in the first place? Doing this is kind of an extreme measure that you adopt only after you've tried and failed to get Struts to do what you want it to. There are usually other less extreme measures you can take to get the desired result.
[ June 10, 2005: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
make sure you changed your web.xml servlet mapping to the right package name and servlet name. i do agree with merrill on extending this core component of struts. this should only be done when absolutely necessary.

i have 1 app in which i do this to inherit form bean definitions declaratively. i used to do my authentication/user profile set up in the custom ActionServlet also, but i pulled that out into a Filter.
[ June 10, 2005: Message edited by: alan do ]

-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
Lukas Alamar
Ranch Hand

Joined: Mar 17, 2004
Posts: 68
hi, thanx for your replies..ehm i got it round .. it was just a wrong url in the calling jsp's form :roll: i mean i wrote <form action="select.do"> instead of <form action="../select.do"> ..im new to web dev so its kind of weird all this syntax..

anyway i subclassed ActionServlet cause i needed an entry point for configuring my logger (im using log4j), so i overrode init() in order to call PropertyConfigurator.configure() ..is it really so bad? (i thought that ActionServlet's init() was a good place) is there another/better way to do so (if you know of one please tell me)

how can you tell struts where to find log4j's properties file?


thanx again
[ June 10, 2005: Message edited by: Lukas Alamar ]
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
uh...put that in another servlet, say StartUpServlet, and add the servlet to to the web.xml. this way you can do other things at start up while leaving the ActionServlet alone.
Lukas Alamar
Ranch Hand

Joined: Mar 17, 2004
Posts: 68
thank you!

ill do that.. looks smarter (nice site)
[ June 11, 2005: Message edited by: Lukas Alamar ]
Rahul Sarojakshakurup
Greenhorn

Joined: Jun 14, 2006
Posts: 1
copying the log4j.properties files under classes folder will solve ur problem..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ActionServlet (struts is screwing me up...)
 
Similar Threads
Servlet: "action" failed to preload on startup in Web application: "gunjanWeb"
ActionServlet called but not executed
MVC2-buzz-buzz
html:options values getting appended
Servlet action is not available