oscar perez wrote:
Hi all,
I've been struggling trying to get working the s:include with the nested
s:params but I have to give up. It really puzzles me..
My problem is that I have no idea on how to access the parameters from the
included file.
There is a fine example in the struts 2 documentation (
http://struts.apache.org/2.0.11/docs/include.html) that tells you how to use
the s:incude component; however I found no references on how to retrieve the
parameters from the included file.
I can access to it via JSTL ,e.g. ${params.xxx}  but no success on getting
the values from the value stack or via #request or #parameters.
I figure this note on struts 2 documentation has something to do with my
problem..:

*Note: Any additional params supplied to the included page are not
accessible within the rendered page through the <s:property...> tag!

*However, I really don't get the full meaning of this statement. Does this
mean I cannot access the parameters via the s:property tag or I cannot
access the parameters via any s tag at all?
Thank you in advance,
Oscar

Hi Oscar,

I see that page isn't very clear. Struts2 creates an context for your action that includes some of the common objects (request map, session map etc) and the ValueStack. See the diagram at [1]. Your included page can access the same context, so to pass parameters in put it into an appropriate part of the context using the s:set or s:push tags.

The params of include tag are for the invocation as if they were request parameters, but they are not placed in the request map.

[1] See the diagram here: http://struts.apache.org/2.x/docs/ognl.html

I'll also mention I never use s:include because the paths break too easily as when refactor the website. I always use Tiles2 instead (tiles:insertDefinition) as its easier, safer and more flexible to manage your page fragments. Struts2 also includes a plugin in case you want to return tiles as results, but that's just optional [2]

[2] http://struts.apache.org/2.x/docs/tiles-plugin.html

regards,
Jeromy Evans


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

Reply via email to