views:

491

answers:

2

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?

+1  A: 

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
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
yes setting a parameter that way is equivalent to putting it on the end of the URL, eg: ?ponies=on
rustyshelf
So can you go over again why a request parameter on a url wouldn't bind into an included ActionBean?
wombleton
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
A: 

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