aspose file tools*
The moose likes Struts and the fly likes [Struts 2] execute not called - strange error message 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 "[Struts 2] execute not called - strange error message" Watch "[Struts 2] execute not called - strange error message" New topic
Author

[Struts 2] execute not called - strange error message

K Fleischer
Greenhorn

Joined: Jun 25, 2008
Posts: 5
Hey experts.

I'm writing a web service. I have thise action handler hierarchy:



The interesting part of my struts configuration:


When I first call "rateKeywords.action" everything runs as designed and the KeywordRating.jsp shows up.
Whenever I send the form from this jsp back to this action something strange happens:
1. Struts seems to be called correctly
2. the action handler (KWRatingAction) is created (I had a breakpoint in the default constructor)
3. Than something is called - I don't know what - that returns "input" to struts. The execute() Methode of my action handler (KWRatingAction) is NOT called.

The strange thing is, that the return value "input" is only used on two places in my webapp. I had put breakpoints to this places, and they where NOT passed during the round trip.

The Question is: From where comes this return value INPUT??


4. You can see from the code above that no result for "input" is specified so finally the following error occures:


[ June 26, 2008: Message edited by: K Fleischer ]
[ June 26, 2008: Message edited by: K Fleischer ]
K Fleischer
Greenhorn

Joined: Jun 25, 2008
Posts: 5
To give you some more information:

If I change the language by doing this:



This will return an 404 error (because of the problem I descriped). But when I than press F5 and reload the website, the new language is used.
So the language is changed in Struts. The problem of the "injected input" must arise in a later stage.
[ June 26, 2008: Message edited by: K Fleischer ]
K Fleischer
Greenhorn

Joined: Jun 25, 2008
Posts: 5
Just for a test i've add a result so the struts.xml looks like this:


(It must be "input" and not "INPUT")
Now, the site shows up again, but without all propertys. It seems (and this would fit to the things I already had written) that the action handler class was not executed and the properties are not set in the handler.

So somehow the request is "hijacked" by some other handler. I don't understand this right now.

If you have an idea, please write. If you need more information please tell me.
K Fleischer
Greenhorn

Joined: Jun 25, 2008
Posts: 5
I've got it!!!

And it's a bit strange.

The fault was - of course - on my side. BUT the reaction of struts was not propper.

I had those two properties declared in my action handler:


But - thanks to a copy paste error - in the JSP there where both fields set to "false". So the the conversion to at least int was the reason for this "hijacking".

What is strange is, that struts had not reported me a conversion error. This had cost me a dozend of hours of my lifetime.

But now I'm happy! It works!
Stan Taylor
Greenhorn

Joined: Oct 02, 2009
Posts: 1
I know this is a very old topic, but I came across something similar today that I thought I'd share.

Same exact symptons as the guy above; get punted out of the action class after the constructor but before the execute() method. Tracked it down to an action error I added via ActionSupport.addActionError() during SessionAware.setSession().

Turns out if there are any action errors present, then your execute() function gets preempted, changing the addActionError() to addActionMessage() fixed it. I'm sure the exact location of "return(INPUT)" could be found by searching the source code of the interceptor classes in the default interceptor stack, but no time for that now...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [Struts 2] execute not called - strange error message