• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ParametersInterceptor doesn't understand my parameters

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic