aspose file tools*
The moose likes Struts and the fly likes ParametersInterceptor doesn't understand my parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ParametersInterceptor doesn Watch "ParametersInterceptor doesn New topic
Author

ParametersInterceptor doesn't understand my parameters

Jennifer Lautenschlager
Greenhorn

Joined: Jul 23, 2007
Posts: 4
I'm a Struts newbie, trying to use Struts2 and DOJO. Here's my problem.

I want to call a Struts2 action from javascript so that there are parameters associated with it. This happens in DOJO in the TreeRPCController for loading data into a Tree widget, but it's a general question.

Now, suppose I have a URL link in javascript that's defined as 'DoSpiffyThings.action?data=ImportantStuffHere'. I'd like to be able to get that data parameter information in my action, via the ActionContext. Problem is I never see to get any parameter information, and the log shows me SEVERE errors with the ParametersInterceptor.

Now, I'm getting parameter information through a form I made with the Struts taglib. I see there's a <s:url> tag with the taglib, and it even takes parameters as a property or some such. I think I need to use this to make my URL in a Struts-happy way, so the ParametersInterceptor doesn't have problems, and I can access my parameters? Assuming this is true, it leads to two issues:

1. I can create this in the JSP with something like:

<s:url value="DoSpiffyThings.action">
<s aram name="data" value="ImportantStuffHere" />
</s:url>

But that's in the JSP taglib. What if I want to do this in Javascript?

2. Question 2: In the DOJO TreeRPCController implementation, you give it a base URL, and then it 'automagically' appends these two parameters to it when it calls that URL. That code is in the library, more or less untouchable. But I need it to attach parameters in such a way that it doesn't get the Struts2 ParametersInterceptor upset. How do I do this?
Jennifer Lautenschlager
Greenhorn

Joined: Jul 23, 2007
Posts: 4
Okay, replying to my own post, a sure sign of madness.

My ParametersInterceptor problem was because I was passing two attributes via parameters (data and action) and needed the corresponding methods on my action, which extended ActionSupport. So I just set up a little setData() and setAction() and life was much happier. And hey. I didn't have to track down my parameters, spiffy.

However, I still think I might have woes with the URL issue. Right now I have cookies turned on, so I assume Struts is using that to track session information. But if cookies turned off, doesn't it need to do some sort of URL rewriting? I'm just passing in a plain old URL that points to my action. So I think I still have a problem, and I'm hoping that this <s:url> tag worries about cookies vs URL rewriting, and that I can somehow access it in my javascript (which is now in a JSP).

So should I be worrying about URL rewrites, or no?
 
 
subject: ParametersInterceptor doesn't understand my parameters
 
Similar Threads
datetimepicker + Struts2 + Ajax
Struts2: s:param not adding parameters to s:url
struts2 with Jquery javascript issue
migration to Struts2
struts2 properties file reload