You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Nicola de Saint-Aubert <ns...@lavanguardia.es> on 2010/04/16 11:28:24 UTC

JSP local scope / include con object domain visibility control

We wonder how to control the visibility of object put in the stack when
including a jsp in another one.

 

We do know the action/request/page . scope and the include tag
specification. 

 

But we have a need for another (added to the others) JSP level scope and
include tag with the following characteristic:

 

-          the scope has the JSP life time 

-          the visibility is restricted to the JSP file (excluding its
struts:included files)

-          some (input) scope objects can be injected from a parent jsp via

the include tag into a the child jsp scope

-          some (output) scope objects can be backwarded from a child jsp

into the parent jsp scope when returning the include tag.

-          we want to access the JSP scope variables using the common Struts

way (# operator), this scope being the prior one.

 

We insist that we want to pass object that might be complex (and not only

strings)

 

 

Did any one have to face with this problem? Is their a way for implementing
such a feature in struts (we thing about a hash in the Page Scope modifying
the struts:include tag .)? Or do we miss sthg in the jsp framework that
performs that specification?

 

 

Example:

 

-----------------Parent.jsp:

 

<s:set name="myParentScopeObjectName" value="%{myObj}" scope="JSP"/>

 

 

 

<s:include value="Child.jsp">

 

            <s:inputparam name="myParentScopeObjectName" to="myInputName"/>
//myInputName is injected in the Child JSP scope as reference to the object
myParentScopeObject

 

            <s:outputparam name="myChildScopeObjectName"  to="myOutputName"

// myChildScopeObjectName (of Child JSP scope) is injected in Parent JSP
scope as myOutputName

 

</s:include>

 

 

 

<s:property value="#myOutputName"/>

 

 

 

---------------Child.jsp:

 

<s:property value="#myInputName"/>

 

<s:set name=" myChildScopeObjectName" value="%{myChildObj}" scope="JSP"/>