1

I've been trying to solve this, and have been getting stuck, so I thought I'd ask.

Imagine two ActionBeans, A and B.

A.jsp has this section in it:

...
<jsp:include page="/B.action">
  <jsp:param name="ponies" value="on"/>
</jsp:include>
<jsp:include page="/B.action">
  <jsp:param name="ponies" value="off"/>
</jsp:include>
...

Take it as read that the B ActionBean does some terribly interesting stuff depending on whether the "ponies" parameter is set to either on or off.

The parameter string "ponies=on" is visible when you debug into the request, but it's not what's getting bound into the B ActionBean. Instead what's getting bound are the parameters to the original A.action.

Is there some way of getting the behaviour I want, or have I missed something fundamental?

wombleton
  • 8,336
  • 1
  • 28
  • 30

2 Answers2

1

So are you saying that in each case ${ponies} on your JSP page prints out "on"?

Because it sounds like you are confusing JSP parameters with Stripes action beans. Setting a JSP parameter simply sets a parameter on that JSP page, that you can reference as shown above, it doesn't actually set anything on the stripes action bean.

rustyshelf
  • 44,963
  • 37
  • 98
  • 104
  • http://java.sun.com/products/jsp/syntax/2.0/syntaxref2020.html says: "If the resource is dynamic, it acts on a request and sends back a result that is included in the JSP page." From looking under the hood it looks to me more like jsp:param builds URLs than sets attributes. No? – wombleton Oct 06 '08 at 08:15
  • yes setting a parameter that way is equivalent to putting it on the end of the URL, eg: ?ponies=on – rustyshelf Oct 06 '08 at 09:52
  • So can you go over again why a request parameter on a url wouldn't bind into an included ActionBean? – wombleton Oct 06 '08 at 12:01
  • the simple answer is because the stripes action bean is an attribute on your page. Request.getAttribute("actionBean"); is what it's bound to. A parameter is a parameter, not an attribute. Request.getParameter("paramName");. The shorter answer is you're using stripes wrong... – rustyshelf Oct 09 '08 at 23:53
1

The reason that this wasn't working was because of massaging done by our implementation of HttpServletRequest.

It works fine with the "normal" implementation.

wombleton
  • 8,336
  • 1
  • 28
  • 30