You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Axel Gross <ka...@iaeste.at> on 2004/10/11 16:28:43 UTC

Re: Clean way to obtain a property's value...

some ideas
- get a singleton instance of GargantusLists and call it 'ns' (for
namespace) then you just have to use
ns.ESURVEY_RESULT_DISPLAY_TYPE_LIST
- make a stupid tld in which you define those constants
- use jakarta jexl or another expression language which allows more than jsp2.0 EL

hth,
axel

On 2004-09-27 at 21:50:26 +0100, Adam Hardy wrote:
> Just before this thread dies, on a closely related note, does anybody 
> have a nice way to get the value of a constant from a static on a class? 
> This is what I don't like:
> 
> <html:select property="resultDisplayTypeId" >
>  <html:options 
> collection="<%=org.gargantus.GargantusLists.ESURVEY_RESULT_DISPLAY_TYPE_LIST 
> %>"
>    property="resultDisplayTypeId"
>    labelProperty="typeName" />
> </html:select>
> 
> I thought of JSTL variables, like:
> <c:set var="resultDisplayTypeListKey">
>   <%=org.gargantus.GargantusLists.ESURVEY_RESULT_DISPLAY_TYPE_LIST %>
> </c:set>
> 
> except somehow avoiding the <% %> tags?
> 
> I thought of instantiating the class and putting in the Application 
> scope and trying to access it like this:
> 
> ${applicationScope.get['myConstantsBean'].resultDisplayTypeId}
> 
> but it's still messy. Does anybody have any better ideas?
> 
> Thanks!
> 
> 
> On 09/27/2004 04:53 PM Paul McCulloch wrote:
> >I think you can achieve what yopu want. For example:
> >
> ><bean:define id="somevar"><bean:write property="whatever"/></bean:define>
> >
> ><logic:equal name="somevar" value="one">
> >	I'm some conditional html
> ></logic:equal>
> >
> >Paul
> >
> >
> >>-----Original Message-----
> >>From: Freddy Villalba A. [mailto:fvillalba@pericless.com]
> >>Sent: Monday, September 27, 2004 3:56 PM
> >>To: 'Struts Users Mailing List'
> >>Subject: RE: Clean way to obtain a property's value...
> >>
> >>
> >>Not sure, Paul... as I understand, <bean:write> directly 
> >>outputs the value.
> >>Therefore, I believe it would work if I wanted to use the value for
> >>conditional (client-side) code (for instance, Javascript), but not for
> >>storing the value in a server-side variable and using it to 
> >>(conditionally)
> >>generate some HTML or other...
> >>
> >>Correct me if I'm wrong, please...
> >>
> >>Regards,
> >>Freddy.
> >>
> >>-----Mensaje original-----
> >>De: Paul McCulloch [mailto:paul.mcculloch@axiossystems.com]
> >>Enviado el: lunes, 27 de septiembre de 2004 15:56
> >>Para: 'Struts Users Mailing List'
> >>Asunto: RE: Clean way to obtain a property's value...
> >>
> >>
> >>Doesn't <bean:write> meet your needs?
> >>
> >>As an aside, What is your objection to JSTL?
> >>
> >>Paul.
> 
> -- 
> struts 1.2 + tomcat 5.0.19 + java 1.4.2
> Linux 2.4.20 Debian
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

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


Re: AspectJ question

Posted by Bill Siggelkow <bi...@bellsouth.net>.
Duuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuude,

Like, man ... no question is stupid ... some of them just aren't very 
gnarly ... for sure, dude, this is like asking "Bro, does Struts work 
well with XML?"

For sure, Aspects rock like Nirvana (Cobain lives, dude!) ... google 
"AspectJ Struts" and you're bound to find some heinous hits!

Word!

struts Dude wrote:
> Hi
> 
> Does Struts work well with AspectJ?
> 
> Sorry if this is a stupid question.
> 
> Thanks
> 
> Duuuuuuude


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


AspectJ question

Posted by struts Dude <sc...@slingshot.co.nz>.
Hi

Does Struts work well with AspectJ?

Sorry if this is a stupid question.

Thanks

Duuuuuuude

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


Re: Clean way to obtain a property's value...

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Axel,
thanks for resurrecting the thread with your suggestions.

On the first suggestion, how do you propose making the singleton 
available in the page context, to allow that call?

On the second one, how can a tld be used to define constants?

Obviously I'm missing something.

thanks
Adam

ps the unstandard tag library looks great but I don't think I'll be able 
to get it accepted into the project at this point.

On 10/11/2004 03:28 PM Axel Gross wrote:
> some ideas
> - get a singleton instance of GargantusLists and call it 'ns' (for
> namespace) then you just have to use
> ns.ESURVEY_RESULT_DISPLAY_TYPE_LIST
> - make a stupid tld in which you define those constants
> - use jakarta jexl or another expression language which allows more than jsp2.0 EL
> 
> hth,
> axel
> 
> On 2004-09-27 at 21:50:26 +0100, Adam Hardy wrote:
> 
>>Just before this thread dies, on a closely related note, does anybody 
>>have a nice way to get the value of a constant from a static on a class? 
>>This is what I don't like:
>>
>><html:select property="resultDisplayTypeId" >
>> <html:options 
>>collection="<%=org.gargantus.GargantusLists.ESURVEY_RESULT_DISPLAY_TYPE_LIST 
>>%>"
>>   property="resultDisplayTypeId"
>>   labelProperty="typeName" />
>></html:select>
>>
>>I thought of JSTL variables, like:
>><c:set var="resultDisplayTypeListKey">
>>  <%=org.gargantus.GargantusLists.ESURVEY_RESULT_DISPLAY_TYPE_LIST %>
>></c:set>
>>
>>except somehow avoiding the <% %> tags?
>>
>>I thought of instantiating the class and putting in the Application 
>>scope and trying to access it like this:
>>
>>${applicationScope.get['myConstantsBean'].resultDisplayTypeId}
>>
>>but it's still messy. Does anybody have any better ideas?
>>
>>Thanks!
>>
>>
>>On 09/27/2004 04:53 PM Paul McCulloch wrote:
>>
>>>I think you can achieve what yopu want. For example:
>>>
>>><bean:define id="somevar"><bean:write property="whatever"/></bean:define>
>>>
>>><logic:equal name="somevar" value="one">
>>>	I'm some conditional html
>>></logic:equal>
>>>
>>>Paul


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


Re: Clean way to obtain a property's value...

Posted by Nicolas De Loof <ni...@capgemini.com>.

Someone posted on this list a clean way to do this using jakarta-unstandard-taglib and bind tag. Sometinhg like this
(not tested) :

<u:bind
    var="list"
    type="org.gargantus.GargantusLists"
    field="ESURVEY_RESULT_DISPLAY_TYPE_LIST"/>

<html:options collection="list"/>

Nico.

>
> On 2004-09-27 at 21:50:26 +0100, Adam Hardy wrote:
> > Just before this thread dies, on a closely related note, does anybody
> > have a nice way to get the value of a constant from a static on a class?
> > This is what I don't like:
> >
> > <html:select property="resultDisplayTypeId" >
> >  <html:options
> > collection="<%=org.gargantus.GargantusLists.ESURVEY_RESULT_DISPLAY_TYPE_LIST
> > %>"
> >    property="resultDisplayTypeId"
> >    labelProperty="typeName" />
> > </html:select>
> >
> > I thought of JSTL variables, like:
> > <c:set var="resultDisplayTypeListKey">
> >   <%=org.gargantus.GargantusLists.ESURVEY_RESULT_DISPLAY_TYPE_LIST %>
> > </c:set>
> >
> > except somehow avoiding the <% %> tags?
> >
> > I thought of instantiating the class and putting in the Application
> > scope and trying to access it like this:
> >
> > ${applicationScope.get['myConstantsBean'].resultDisplayTypeId}
> >
> > but it's still messy. Does anybody have any better ideas?
> >
> > Thanks!
> >
> >
> > On 09/27/2004 04:53 PM Paul McCulloch wrote:
> > >I think you can achieve what yopu want. For example:
> > >
> > ><bean:define id="somevar"><bean:write property="whatever"/></bean:define>
> > >
> > ><logic:equal name="somevar" value="one">
> > > I'm some conditional html
> > ></logic:equal>
> > >
> > >Paul
> > >
> > >
> > >>-----Original Message-----
> > >>From: Freddy Villalba A. [mailto:fvillalba@pericless.com]
> > >>Sent: Monday, September 27, 2004 3:56 PM
> > >>To: 'Struts Users Mailing List'
> > >>Subject: RE: Clean way to obtain a property's value...
> > >>
> > >>
> > >>Not sure, Paul... as I understand, <bean:write> directly
> > >>outputs the value.
> > >>Therefore, I believe it would work if I wanted to use the value for
> > >>conditional (client-side) code (for instance, Javascript), but not for
> > >>storing the value in a server-side variable and using it to
> > >>(conditionally)
> > >>generate some HTML or other...
> > >>
> > >>Correct me if I'm wrong, please...
> > >>
> > >>Regards,
> > >>Freddy.
> > >>
> > >>-----Mensaje original-----
> > >>De: Paul McCulloch [mailto:paul.mcculloch@axiossystems.com]
> > >>Enviado el: lunes, 27 de septiembre de 2004 15:56
> > >>Para: 'Struts Users Mailing List'
> > >>Asunto: RE: Clean way to obtain a property's value...
> > >>
> > >>
> > >>Doesn't <bean:write> meet your needs?
> > >>
> > >>As an aside, What is your objection to JSTL?
> > >>
> > >>Paul.
> >
> > -- 
> > struts 1.2 + tomcat 5.0.19 + java 1.4.2
> > Linux 2.4.20 Debian
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


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