Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ActionServlet (struts is screwing me up...)

 
Lukas Alamar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
alan do
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Lukas Alamar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 354
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you!

ill do that.. looks smarter (nice site)
[ June 11, 2005: Message edited by: Lukas Alamar ]
 
Rahul Sarojakshakurup
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
copying the log4j.properties files under classes folder will solve ur problem..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic