An update for those interested: struts.properties defines
"struts.dispatcher.parametersWorkaround" (false by default), and says it's
for some app servers that don't handle HttpServletRequest.getParameterMap()
(including mine, OC4J):

http://struts.apache.org/2.x/docs/strutsproperties.html

This sounds very closely related, but changing it to true didn't solve the
problem. I made sure the relevant boolean flag got set and affected behavior
in org.apache.struts2.Dispatcher, where the prepare(HttpServletRequest,
HttpServletResponse) method executes request.getParameter("foo") if
paramsWorkaroundEnabled is set. The comment: 'simply read any parameter
(existing or not) to "prime" the request'.

My guess is that this forces the request to process the ServletInputStream
and build the parameter map; not sure, though. No (URL) parameters have yet
appeared. Looking at the byte[] in the ServletInputStream, it's easy to find
the original URL with all parameters intact, but the offset (several
hundred) seems to indicate that something has already processed it.


JBL wrote:
> 
> We have a link to a Struts 2 action that includes a URL parameter
> (.../something_method.action?name=NAME), and the URL parameter is getting
> lost -- it doesn't show up in the action, the request map (when we
> implement RequestAware), the parameter map (when we implement
> ParameterAware), or a custom interceptor we put at the top of the
> interceptor stack.
> 
> When we submit a form to the same action with the same parameter (<input
> type="text" name="name" value="NAME"/>), it comes through just fine for
> both maps (request and parameters), and ParametersInterceptor transfers
> the form parameter values to the action just as you'd expect.
> 
> We've tried hard-coding the method name in struts.xml, figuring the
> wildcard processor might chop off the request parameter; no luck. As early
> as we can pick things out of the request cycle, the URL parameters appear
> to be gone.
> 
> struts.xml looks like:
> 
> <struts>
>   <package name="..." namespace="..." extends="struts-default">
>     ...
>     <action name="something_*" class="...SomethingAction" method="{1}">
>       <result>/WEB-INF/... .jsp</result>
>     </action>
>   </package>
> </struts>
> 
> We're using Struts 2.0.8.
> 
> There's a similar question in the Struts 2 FAQs about the
> ParametersInterceptor not setting values, but the answer there turns out
> to be that your setter and getter have to use the same type. (See
> http://struts.apache.org/2.x/docs/faqs.html, in the Interceptors section.)
> 
> Ian Roughley has a handy book available as a free PDF on InfoQ.com
> (http://www.infoq.com/minibooks/starting-struts2 - please forgive the
> plug); it suggests on page 23 that you should be able to see URL
> parameters via the ParametersInterceptor. Nothing I've seen elsewhere
> contradicts this, though the ParametersInterceptor page
> (http://struts.apache.org/2.x/docs/parameters-interceptor.html) says that
> it would "typically" be used to apply form parameters to an action.
> 
> Any help would be appreciated.
> 
> Thanks,
> 
> Jon
> 

-- 
View this message in context: 
http://www.nabble.com/Struts-2-URL-parameters-lost-tf4196254.html#a11953312
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to