On 21-12-2010 at 12:32, Ross Sargant wrote: > I think I'm running in to problems because instances of annotations are not > actually java beans. > As an example if the annotation is defined as > * > @Retention(RetentionPolicy.RUNTIME) > @Target(ElementType.FIELD) > public @interface SearchText{ > String name(); > String description(); > }* > > I can't access the "name" value from EL using "${<annot instance>.name}". > > Any suggestions for work arounds? Is it really necessary to write bean > style wrapper classes just to get this to work? I had a thought of dumping > out all the annotation data into a <Sting,Object> map so I could at least > get to it from EL however that requires reflecting on the annotation class > itself to get the map keys and just seems to crazy.
While it's not needed to write a wrapper class, you do need a java snippet. Something along the lines of this: <% Object object = pageContext.findAttribute("annot instance name"); SearchText searchText = object.getClass().getAnnotation(SearchText.class); String name = searchText == null ? null : searchText.name(); %> Oscar -- ,-_ Oscar Westra van Holthe - Kind http://www.xs4all.nl/~kindop/ /() ) (__ ( Simplicity is prerequisite for reliability. =/ () -- Edsger Dijkstra, EWD498 ------------------------------------------------------------------------------ Forrester recently released a report on the Return on Investment (ROI) of Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even within 7 months. Over 3 million businesses have gone Google with Google Apps: an online email calendar, and document program that's accessible from your browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew _______________________________________________ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users