I can see where you are coming from. I would also like to be able to call custom 
methods on objects rather than just those that have getXXX. 

I suppose this is all to do with JSTL adhering to strict bean specification with 
everything acquired by get methods matching class members.

you would need a method called getTEST to be able to access using JSTL because doing 
MyClass.TEST with JSTL violates the bean spec.

> -----Original Message-----
> From: andy wix [mailto:[EMAIL PROTECTED]
> Sent: 22 September 2004 10:42
> To: [EMAIL PROTECTED]
> Subject: JSTL and scope
> 
> 
> Hi,
> 
> I am a little surprised that having a class variable imported 
> into a page 
> isn't seen by JSTL contructs.
> For example if i have a class that defines:
> 
> package com.company.test
> public final class MyClass
> {
>    public static final String TEST =  "test";
> }
> 
> and my JSP page has:
> 
> <[EMAIL PROTECTED] import="com.company.test.MyClass"%>
> <c:out value="${MyClass.TEST}"/>
> 
> you don't get any output.
> 
> If you add:
> <%
> pageContext.setAttribute("test", MyClass.TEST);
> %>
> 
> and change the JSTL to:
> <c:out value="${test}"/>
> 
> then it works.
> 
> But surely the MyClass.TEST already had page scope otherwise the 
> setAttribute wouldn't have seen it?
> 
> The upshot of all this is that I am iterating through a map 
> that can have 
> any one of about 30 keys.
> Do I really have to put all these keys into the session or 
> some other scope 
> every time I load the page?
> 
> Thanks,
> Andy
> 
> _________________________________________________________________
> Stay in touch with absent friends - get MSN Messenger 
> http://www.msn.co.uk/messenger
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


<FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
-------------------------------------------------------
QAS Ltd.
Developers of QuickAddress Software
<a href="http://www.qas.com";>www.qas.com</a>
Registered in England: No 2582055
Registered in Australia: No 082 851 474
-------------------------------------------------------
</FONT>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to