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/19 14:14:50 UTC

s:property tag evolution ?

Hi,

 

I m a little bit confused about the struts 2 set and property tags with
scope attributes. I ran the following test consisting of setting struts
variables in each stack and retrieving it through s:property tag.

 

You can see that the Page variables only be retrieved through the $ jsp
specification character; furthermore isn t that a little fuzzy for the jsp
developer to retrieve a value seeing the result of the test ?

 

What about making s:property working such $ jsps specification tag (adding
it the actions operations access) and resolving in all stacksw/scope ? Is
there something I m missing ?

 

 

 

Codigo
============================================================================
========

Action
----------------------------------------------------------------------------
--

public class DummyAction extends ActionSupport {

             

       public String getActionAttr(){

             return "OK";

       };

}

 

JSP -----------------------------------------

<s:set name="pageScopeVar" value="%{'OK'}" scope="page"/>

<s:set name="actionScopeVar" value="%{'OK'}" scope="action"/>

<s:set name="requestScopeVar" value="%{'OK'}" scope="request"/>

<s:set name="sessionScopeVar" value="%{'OK'}" scope="session"/>

<s:set name="applicationScopeVar" value="%{'OK'}" scope="application"/>

 

//AQUI PINTO DE TODAS LAS MANERAS POSSIBLES, VER RESULTADO ...

 

//hago include com parameters, los parameters se pasan teoricamente en otro
"scope" llamado param (realmente no es un scope .), los inicialmente en page
no se transmiten !

<s:set name="paramPageAttrParent" scope="page">OK</s:set>

<s:set name="paramActionAttrParent" scope="action">OK</s:set>

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

       <s:param name="paramPageAttr" value="paramPageAttrParent"/>

       <s:param name="paramActionAttr" value="paramActionAttrParent"/>

</s:include>

 

 

 

RESULTS=====================================================================
============================

 

------------------------------------------------------------------------

<property value="name">
action atr OK 
page 
action OK 
request 
session 
application 

<property value="#name" >
action atr 
page 
action OK 
request 
session 
application 

<property value="%{#name}" >
action atr 
page 
action OK 
request 
session 
application 

<property value="scope.name" >
action atr 
page 
action 
request 
session 
application 

<property value="#scope.name" >
action atr OK 
page 
action 
request OK 
session OK 
application OK 

<property value="%{#scope.name}" >
action atr OK 
page 
action 
request OK 
session OK 
application OK 

$name 
action atr OK
page OK 
action OK 
request OK 
session OK 
application OK 

$scope.name 
action atr OK
page 
action 
request OK 
session OK 
application OK