One approach you might consider is something like:

DynaBean bean = ...;
Map beanMap = PropertyUtils.describe(bean);
request.setAttribut("beanMap", beanMap);

And then JSTL can just deal with the map. Another approach, at least for the
database piece, is to use JSTL's Result and ResultSupport:

import javax.servlet.jsp.jstl.sql.Result;
import javax.servlet.jsp.jstl.sql.ResultSupport;

ResultSet rs = ...;
Result result = ResultSupport.toResult(rs);
request.setAttribute("result", result);

Check the JSTL spec (chapter 10) for more info.

Quoting Pedro Salgado <[EMAIL PROTECTED]>:

> 
> I think that it only works for maps...
> 
> I can use DynaActionForms and use ${formbean.map["key"]}, but I am using
> BasicDynaBeans for the views.
> 
> 
> Pedro Salgado
> 
> On 25/11/2003 15:34, "Grassi Fabio" <[EMAIL PROTECTED]> wrote:
> 
> > Would the alternative syntax ${bean["propertyA"]} work better?
> > 
> > Regards, Fabio.
> > 
> > 
> >> -----Messaggio originale-----
> >> Da: Pedro Salgado [mailto:[EMAIL PROTECTED]
> >> Inviato: marted́ 25 novembre 2003 16:05
> >> A: Struts Users Mailing List
> >> Oggetto: JSTL and DynaBeans
> >> 
> >> 
> >> 
> >>   I have been using the struts taglibs and have been trying
> >> to use only
> >> JSTL.
> >>   When using DynaBeans the JSTL doesn't work
> >> (${bean.propertyA} doesn't
> >> print anything)
> >> 
> >>   I solved the problem of accessing DynaBeans extending the
> >> BasicDynaBean
> >> and implementing the Map interface but I am also using RowSetDynaClass
> >> (which builds a collection of DynaBeans from a ResultSet).
> >>   I have been trying to find a solution and came to this approach:
> >> 
> >>    - implement a CustomizedRowSet that is a copy of
> >> RowSetDynaClass with a
> >> setDynaBeanClass(Class clazz). On the copy(...) method, use a
> >> Class.forName(this.dynaBeanClass).newInstance();
> >> 
> >>   Question:
> >>     - Does anyone have figured out another solution (one that
> >> is simpler and
> >> able to reuse the methods that the RowSetDynaClass uses
> >> without copy/paste?)
> >> ?
> >> 
> >> Thank you,
> >> 
> >> Pedro Salgado 
> >> 
> >> 
> >> 
> > Ai sensi della Legge 675/96, si precisa che le informazioni contenute in
> > questo messaggio sono riservate ed a uso esclusivo del destinatario.
> Qualora
> > il messaggio in parola Le fosse pervenuto per errore, la preghiamo di
> > eliminarlo senza copiarlo e di non inoltrarlo a terzi, dandocene
> gentilmente
> > comunicazione. Grazie.<BR><BR>This message, for the law 675/96 may
> contain
> > confidential and/or privileged information. If you are not the addressee
> or
> > authorized to receive this for the addressee, you must not use, copy,
> disclose
> > or take any action based on this message or any information herein. If
> you
> > have received this message in error, please advise the sender immediately
> by
> > reply e-mail and delete this message. Thank you for your cooperation.

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

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

Reply via email to