You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mraible <ma...@raibledesigns.com> on 2007/08/22 03:53:56 UTC

Retrieving static values in Actions

I have the following interface that I'm trying to read variables from:

public interface ServletMappingConstants
{
  String SECURE_PREFIX = "secure/";

  String STATIC = "static";
...
}

If my Action implements this interface, I can refer to these strings with
the OGNL expression "@vs@STATIC". However, I'm trying to migrate some
existing code that uses the interface as a static final:

public final static ServletMappingConstants MAPPING =
    new ServletMappingConstants() {};

If I use this, I'm unable to refer to @vs@MAPPING@STATIC. Is there some
other expression that will allow me to retrieve values from the interface
without implementing it?

Thanks,

Matt

-- 
View this message in context: http://www.nabble.com/Retrieving-static-values-in-Actions-tf4308955.html#a12266708
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Retrieving static values in Actions

Posted by mraible <ma...@raibledesigns.com>.
This works if I use the fully-qualified class name for
ServletMappingConstants. In the framework's current EL, it's possible to do
MAPPING.STATIC, so I'm trying to create a similar short syntax with Struts 2
for easier migration.

Thanks,

Matt


Musachy Barroso wrote:
> 
> try :
> 
> @ServletMappingConstants@STATIC
> 
> musachy
> 
> On 8/21/07, mraible <ma...@raibledesigns.com> wrote:
>>
>> I have the following interface that I'm trying to read variables from:
>>
>> public interface ServletMappingConstants
>> {
>>   String SECURE_PREFIX = "secure/";
>>
>>   String STATIC = "static";
>> ...
>> }
>>
>> If my Action implements this interface, I can refer to these strings with
>> the OGNL expression "@vs@STATIC". However, I'm trying to migrate some
>> existing code that uses the interface as a static final:
>>
>> public final static ServletMappingConstants MAPPING =
>>     new ServletMappingConstants() {};
>>
>> If I use this, I'm unable to refer to @vs@MAPPING@STATIC. Is there some
>> other expression that will allow me to retrieve values from the interface
>> without implementing it?
>>
>> Thanks,
>>
>> Matt
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Retrieving-static-values-in-Actions-tf4308955.html#a12266708
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Retrieving-static-values-in-Actions-tf4308955.html#a12267174
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Retrieving static values in Actions

Posted by Musachy Barroso <mu...@gmail.com>.
try :

@ServletMappingConstants@STATIC

musachy

On 8/21/07, mraible <ma...@raibledesigns.com> wrote:
>
> I have the following interface that I'm trying to read variables from:
>
> public interface ServletMappingConstants
> {
>   String SECURE_PREFIX = "secure/";
>
>   String STATIC = "static";
> ...
> }
>
> If my Action implements this interface, I can refer to these strings with
> the OGNL expression "@vs@STATIC". However, I'm trying to migrate some
> existing code that uses the interface as a static final:
>
> public final static ServletMappingConstants MAPPING =
>     new ServletMappingConstants() {};
>
> If I use this, I'm unable to refer to @vs@MAPPING@STATIC. Is there some
> other expression that will allow me to retrieve values from the interface
> without implementing it?
>
> Thanks,
>
> Matt
>
> --
> View this message in context: http://www.nabble.com/Retrieving-static-values-in-Actions-tf4308955.html#a12266708
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org