struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicola de Saint-Aubert" <nsaintaub...@lavanguardia.es>
Subject JSP local scope / include con object domain visibility control
Date Thu, 08 Apr 2010 11:53:43 GMT
Hi,

 

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 JSP level scope and include tag with the
following characteristic:

-          the scope has the JSP life time

-          some (input) scope objects can be injected from a parent jsp via
a 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?

 

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”/>

 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message