You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by JOSE L MARTINEZ-AVIAL <jl...@gmail.com> on 2012/07/07 18:34:59 UTC

Reference to static field as parameter value in Struts2

Hi,
 Is it possible to have a result as follows:

            <result name="defaultLocaleLoginScreen" type="httpheader">
                <param name="status">301</param>
                <param name="headers.Location">${@
zzz.yyy.xxx.MyClass@MyValue}</param>
        </result>

Where MyValue is a static field of the class MyClass? I haven't been able
to get it to work. Any ideas?

Re: Reference to static field as parameter value in Struts2

Posted by jl...@gmail.com.
What would be the average way? In this case there is no action to read(well, there is, but it could be any action), since this result is only called from an interceptor.
Sent via BlackBerry from T-Mobile

-----Original Message-----
From: John Keats <ke...@gmail.com>
Date: Tue, 10 Jul 2012 15:55:46 
To: Struts Users Mailing List<us...@struts.apache.org>
Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
Subject: Re: Reference to static field as parameter value in Struts2

I am surprised this worked for you. But can't the average way execute a
static method?

On Sun, Jul 8, 2012 at 3:07 AM, JOSE L MARTINEZ-AVIAL <jl...@gmail.com>wrote:

> Well, after all it works just fine, I don't know what I was doing wrong. I
> needed something more complicate than just a static field, I needed to
> execute a static method, and then a getter from the returned object. The
> final solution was:
>
> <param name="headers.Location">${@zzz.yyy.xxx.Myclass@getInstance
> ().getValue()}</param>
>
>
> 2012/7/7 JOSE L MARTINEZ-AVIAL <jl...@gmail.com>
>
> Hi,
> >  Is it possible to have a result as follows:
> >
> >             <result name="defaultLocaleLoginScreen" type="httpheader">
> >                 <param name="status">301</param>
> >                 <param name="headers.Location">${@
> > zzz.yyy.xxx.MyClass@MyValue}</param>
> >         </result>
> >
> > Where MyValue is a static field of the class MyClass? I haven't been able
> > to get it to work. Any ideas?
>


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

Re: Reference to static field as parameter value in Struts2

Posted by John Keats <ke...@gmail.com>.
I am surprised this worked for you. But can't the average way execute a
static method?

On Sun, Jul 8, 2012 at 3:07 AM, JOSE L MARTINEZ-AVIAL <jl...@gmail.com>wrote:

> Well, after all it works just fine, I don't know what I was doing wrong. I
> needed something more complicate than just a static field, I needed to
> execute a static method, and then a getter from the returned object. The
> final solution was:
>
> <param name="headers.Location">${@zzz.yyy.xxx.Myclass@getInstance
> ().getValue()}</param>
>
>
> 2012/7/7 JOSE L MARTINEZ-AVIAL <jl...@gmail.com>
>
> Hi,
> >  Is it possible to have a result as follows:
> >
> >             <result name="defaultLocaleLoginScreen" type="httpheader">
> >                 <param name="status">301</param>
> >                 <param name="headers.Location">${@
> > zzz.yyy.xxx.MyClass@MyValue}</param>
> >         </result>
> >
> > Where MyValue is a static field of the class MyClass? I haven't been able
> > to get it to work. Any ideas?
>

Re: Reference to static field as parameter value in Struts2

Posted by JOSE L MARTINEZ-AVIAL <jl...@gmail.com>.
Well, after all it works just fine, I don't know what I was doing wrong. I
needed something more complicate than just a static field, I needed to
execute a static method, and then a getter from the returned object. The
final solution was:

<param name="headers.Location">${@zzz.yyy.xxx.Myclass@getInstance
().getValue()}</param>


2012/7/7 JOSE L MARTINEZ-AVIAL <jl...@gmail.com>

Hi,
>  Is it possible to have a result as follows:
>
>             <result name="defaultLocaleLoginScreen" type="httpheader">
>                 <param name="status">301</param>
>                 <param name="headers.Location">${@
> zzz.yyy.xxx.MyClass@MyValue}</param>
>         </result>
>
> Where MyValue is a static field of the class MyClass? I haven't been able
> to get it to work. Any ideas?