Have u thought of using XML for passing generic data around. A Tag using
XPath can be used to access the data from this generic XML document.
--- Iraklis Kourtidis <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> I was wondering what your views on the following are:
> 
> JavaBeans seem to only allow fixed properties (say "foo" and "bar), and
> the
> tags that operate on them (e.g. <bean:write>) essentially call getters
> "getFoo()" and "getBar()". However, this means that any time we're in
> the
> action class and we want to package some information to send to the JSP,
> we
> need to write a Java class with the appropriate properties and getters.
> This
> quickly becomes tiresome and causes code bloating; if I want to avoid
> scriptlets in my JSP, I have to use Javabeans, so for pretty much every
> Action class I need to add such a new Java class.
> 
> A better way would be for Javabeans to be (essentially) some sort of
> subclass of java.util.Map, so that I can add properties at runtime.
> Here's
> some sample code:
> 
> GenericJavabean jb = new GenericJavabean();
> jb.addProperty("foo", "value of foo");
> jb.addProperty("bar", "value of bar");
> 
> Then, there could be some other tag, say <bean:write2> whose "property"
> attribute will not correspond to a getter function, but will instead
> call
> (internally) bean.getProperty("foo").
> 
> In short, Javabeans, the current mechanism of passing information to the
> JSP
> for display purposes, are limiting because they have to be defined at
> *compile* time. It is not practical (in terms of efficiency and
> complexity)
> to add getter functions to a class at runtime (we've considered that),
> so we
> need to essentially create new Javabean classes.
> 
> Am I the only one who gets bothered by this? I was wondering what the
> rest
> of you do. Do you just resign to creating new Java classes every time
> you
> want to put something on the request and send it to the JSP?
> 
> thanks for your input,
> Iraklis
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Reply via email to