I don't have the credentials to offer an opinion on how Stripes should
handle this, but if I were faced with this problem:

1) I've got a handy EL function called "constants" that, given a Class
or a class name, returns a Map<String, Object> of the public static
final fields of the class.

2) Using that, I'd just write a JSTL loop to spit out the options,
something like this

  <c:set var='GPA' value='${t:constants("foo.bar.GPA")}'/>
  <c:forEach var='grade' items='${t:entries(GPA)}'>
    <option value='${grade.key}'>${grade.value.gpa}</option>
  </c:forEach>


That said, my personal feeling is that the "gpa" strings would be
better off in a message catalog anyway.

> > -----Original Message-----
> > From: Stone, Timothy [mailto:[email protected]] 
> > Sent: Wednesday, May 20, 2009 3:58 PM
> > To: Stripes Users List
> > Subject: [Stripes-users] Filtering output from options-enumeration
> > 
> > I need to get the output of an options-enumeration "un-encoded".
> > 
> > Consider the following:
> > 
> > public enum GPA {
> >     F       ("1", "&lt;2.00"),
> >     D       ("2", "2.00&#8211;2.49"),
> >       C       ("3", "2.50&#8211;2.99"),
> >     B       ("4", "3.00&#8211;3.49"),
> >     A       ("5", "3.50&#8211;3.99"),
> >     A_PLUS  ("6", "4.00"),
> >     OTHER   ("0", "Other");
> > 
> > ...
> > 
> > public String getGpa() { return this.gpa; }
> > 
> > ...
> > 
> > 
> > The output from the options-enumeration results in:
> > 
> > <option value="F">&amp;lt;2.00</option>
> > <option value="D">2.00&amp;#8211;2.49</option>
> > ...
> > ...
> > 
> > This might be good for most users, but bad for me/us, as we are
> > using entity notations like the endash to express ranges, e.g., 
> > "&#8211;" (the
> > correct use of endashes*). 
> > 
> > Any ideas for a workaround? I'm considering something in the return
> > method, but I think something is happening in the tag itself 
> > that would
> > defeat me.
> > 
> > Thanks,
> > Tim
> > 
> > PS. "&#8211;" is an endash. It is specifically used to indicate
> > ranges (http://www.alistapart.com/articles/emen/)
> > 
> > --
> > 
> > Timothy Stone  |  Application Developer Technical Lead
> > Strategic Development, Business Technology Group  |  Barclaycard US
> > direct 302.255.8044  |  cell 410.441.9450
> > 
> > COMPANY CONFIDENTIAL
> > 
> > 
> > 
> > Barclays             www.barclaycardus.com
> > 
> > This e-mail and any files transmitted with it may contain 
> > confidential and/or proprietary information. It is intended 
> > solely for the use of the individual or entity who is the 
> > intended recipient. Unauthorized use of this information is 
> > prohibited. If you have received this in error, please 
> > contact the sender by replying to this message and delete 
> > this material from any system it may be on.
> > 
> > 
> > 
> > --------------------------------------------------------------
> > ----------------
> > Crystal Reports - New Free Runtime and 30 Day Trial
> > Check out the new simplified licensing option that enables 
> > unlimited royalty-free distribution of the report engine 
> > for externally facing server and web deployment. 
> > http://p.sf.net/sfu/businessobjects
> > _______________________________________________
> > Stripes-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/stripes-users
> > 
> > --------------------------------------------------------------
> > ----------------
> > Crystal Reports - New Free Runtime and 30 Day Trial
> > Check out the new simplified licensing option that enables 
> > unlimited royalty-free distribution of the report engine 
> > for externally facing server and web deployment. 
> > http://p.sf.net/sfu/businessobjects
> > _______________________________________________
> > Stripes-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/stripes-users
> > 
> > 
> 
> 
> Barclays             www.barclaycardus.com
> 
> This e-mail and any files transmitted with it may contain
> confidential and/or proprietary information. It is intended solely
> for the use of the individual or entity who is the intended
> recipient. Unauthorized use of this information is prohibited. If you
> have received this in error, please contact the sender by replying to
> this message and delete this material from any system it may be on.
> 
> 
> 
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables 
> unlimited royalty-free distribution of the report engine 
> for externally facing server and web deployment. 
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users


-- 
--
Mike McNally <[email protected]>

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to