Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to pass parameters to included url

 
Rob Dennett
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to pass a request parameter to a url that is included in a jsp with a jsp:include tag. I have tried



and




I also tried



and



I put a breakpoint in the method that is mapped to "/myUrl" and each time the value of myParam is null. I examined the requestURL and found that it was the URL which returned the jsp which contains this code and the query string was null. Can someone tell me what I am or might be doing wrong here?

Thanks,
Rob
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks OK to me, but I never do it this way so I might just be off-base.

Rather than an include, I'd define a tag file or custom tag so that the value could be explicitly specified as a tag attribute. That way, it can also be something other than a string.

If, for some reason, I didn't want to do that, I'd pass the data as a request-scoped scoped variable. Params would be my last choice.

Can you include an SSCCE? If so, I'll see if I can put aside some time to give it a whirl on this end
 
Rob Dennett
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I decided to punt and use a request attribute. Thanks anyway.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad that's working for you. I think that's a better approach than a parameter, as it's not necessary to serialize the data to string. But thing I don't like about either of the param or scoped variable approach is that they're implicit and there's no way to force the value to be set or to type check.

With the tag approach, a required attribute to the tag can explicitly enforce that a value be passed, and of the expected type.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic