> I have a pile of simple JavaBeans that I use for many 
> everyday task. Most of the methods have arguments and return 
> strings or booleans and rowsets. Is there any way I can use 
> these with JSTL? As an example I have a method that sends 
> mail with JavaMail and a typical use of a method would be:

I'm not sure I would quite characterize the classes you describe as beans.
The pattern that beans adhere to is pretty specific and precludes the kinds
of methods you describe.  When used with JSTL, beans are primarily used as
value objects, so the only methods you typically have access to are those
that represent discrete properties of the bean, not those that model some
behavior of the bean as applied to its instance values.

> myBean.sendMail( myaddress, myAttachment, myMessageBody, mysubject);
> 
> So having imported the bean use the JSP useBean tag would 
> that allow me more access to the JSTL taglibs?

Not to the sendMail method, no.  To simple get/set methods and slightly more
complex get/set for indexed properties, yes.  For arbitrary methods with
arbitrary arguments, no.

> I am thinking of say using JSTL param to insert the value 
> into the method:
> 
> myBean.sendMail( ${param.myaddress}, etc...);

With the current spec and implementations available, I would suggest trying
to find a custom tag that meets your needs or considering rolling your own.
As I understand it, tags are the piece of the JSP puzzle best suited for
adding behavioral aspects (in a purely JSP application, anyway--a better
argument is that such behaviors belong in the Controller aspect of a full
MVC architecture, like Struts).

In the JSP 2.0 spec, there is a notion of functions, which has been
described repeatedly on this list.  If you aren't familiar with authoring
tag handlers, JSP functions might be a better fit, though any JSP
implementation that supports them is going to be somewhere in the alpha or
very early beta stage, as the 2.0 spec hasn't been finalized, yet.

Thomas Gideon
Sr. Software Developer
B2eMarkets

301.230.2236  Tel.
301.230.2248  Fax.
[EMAIL PROTECTED]
www.B2eMarkets.com


--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@;jakarta.apache.org>

Reply via email to