Re: c:forEach items=${%=CONSTANT.MY_C%}...

2003-07-26 Thread Eric W Hauser
If you want to use constant fields, check out the archives for this
list...There have been some good posts in the last couple of weeks on how
to accomplish this...JSTL does not provide a mechanism for retrieving
constant values from classes...Of course, there is a tag for it in the
unstandard library...But something about an unstandard library as part of
a standard library just gives me a headache...So, I would stay away from
that and use solutions based on the J2EE spec...

Since you're using Struts, the application resources file is a good place
to stick constant values as well...

On Sat, 26 Jul 2003, Vincent Peytavin wrote:

 
 - Original Message -
 From: David M. Karr [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, July 26, 2003 8:10 AM
 Subject: Re: c:forEach items=${%=CONSTANT.MY_C%}...
 
 
   Vincent == Vincent Peytavin [EMAIL PROTECTED]
 writes:
  If you need to reference constant values, you can have
  your Action or Servlet code put your constants into a bean in some scope.
 This
  particular issue has been discussed numerous times on this list.
 
 Well, I change my question to this one :
 when you have stg like that c:forEach var=my_device
 items=${devices_list}
 
 varStatus=index_device
 it means that in your Action (suppose you use struts) you do a
 session.setAttribute(devices_list, listDevices).
 
 But I'd like to do the same thing by placing the listDevices bean under a
 key specified by
 Constants.DEVICES_LIST_KEY.
 (in Constants class : public static final String DEVICES_LIST_KEY =
 devices_list; )
 session.setAttribute(Constants.DEVICES_LIST_KEY, listDevices)
 How to use this session bean with c:forEach ?
 
 Isn't it a good way to do this kind of thing? I'm newbie with struts/Tag
 Libraries and so, i'm waiting for you advice and website documentation.
 
 Thanks for your help!
 
 --
 Vincent
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

---
Eric Hauser
[EMAIL PROTECTED]
(317) 679-4766


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



Re: c:forEach items=${%=CONSTANT.MY_C%}...

2003-07-26 Thread Henri Yandell


On Sat, 26 Jul 2003, Eric W Hauser wrote:

 If you want to use constant fields, check out the archives for this
 list...There have been some good posts in the last couple of weeks on how
 to accomplish this...JSTL does not provide a mechanism for retrieving
 constant values from classes...Of course, there is a tag for it in the
 unstandard library...But something about an unstandard library as part of
 a standard library just gives me a headache...So, I would stay away from
 that and use solutions based on the J2EE spec...

The reason why I make sure people are aware of the unstandard-library
approach is that they may not have Actions or Servlets. The Java community
has a very bad habit of assuming that every situation requires Java
coding. This is pretty bad for a web-designer who doesn't understand Java
but is quite happy with tags.

Unstandard taglib exists primarily for people who do not have a Servlet or
use one of the Model-2 MVC setups. Something I do plan to add is a more
powerful un:bindAll tag which will bind all constants in a class/interface
into the session.

I seem to recall that Java web containers also have the ability to run a
class on startup (?) so another approach might be to have something nice
tucked in there.

Hen



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



Re: c:forEach items=${%=CONSTANT.MY_C%}...

2003-07-26 Thread Eric W Hauser
On Sat, 26 Jul 2003, Henri Yandell wrote:

 
 
 On Sat, 26 Jul 2003, Eric W Hauser wrote:
 
  If you want to use constant fields, check out the archives for this
  list...There have been some good posts in the last couple of weeks on how
  to accomplish this...JSTL does not provide a mechanism for retrieving
  constant values from classes...Of course, there is a tag for it in the
  unstandard library...But something about an unstandard library as part of
  a standard library just gives me a headache...So, I would stay away from
  that and use solutions based on the J2EE spec...
 
 The reason why I make sure people are aware of the unstandard-library
 approach is that they may not have Actions or Servlets. The Java community
 has a very bad habit of assuming that every situation requires Java
 coding. This is pretty bad for a web-designer who doesn't understand Java
 but is quite happy with tags.
 
 Unstandard taglib exists primarily for people who do not have a Servlet or
 use one of the Model-2 MVC setups. Something I do plan to add is a more
 powerful un:bindAll tag which will bind all constants in a class/interface
 into the session.
 
 I seem to recall that Java web containers also have the ability to run a
 class on startup (?) so another approach might be to have something nice
 tucked in there.
 
 Hen
 

That approach requires using the interface ServletContextListener and
setting that up in your web.xml...That is my prefered way of achieving
those results...

---
Eric Hauser
[EMAIL PROTECTED]
(317) 679-4766


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