Hi,
thanks for all the replies to my original posting, I see a little bit
clearer now. So, beans are just a means to more distinctly separate java
code from code on the JSP page. But I think this only makes real sense
if it is carried out to the full extent, i.e. if custom tag libs are
used to banish java code from the page, otherwise it's a half hearted
approach.
Heiko
>
> Hi,
>
> I'm wondering what's the use of beans with JSP. In my (humble) opinion,
> beans are useless... everything I can do with beans can be done with
> "normal" java objects as well.
>
> For example,
>
> <jsp:useBean id="myBean" class="MyBean" scope="session">
>
> can easily be replaced by
>
> <% MyBean myBean = new MyBean();
> session.put("myBean", myBean); %>
>
> Moreover, beans obviously have some disadvantages:
>
> - the syntax is very awkward. Instead of writing <jsp:setProperty
> name="myBean" property="prop" value="val"> I can write
> myBean.setProp("val"), which seems much smoother
> - Construction of beans seems to be limitied to using the
> (argument-less) standard constructor. Constructors with arguments are
> not supported.
> - Using <jsp:setProperty>, only String properties can be set. If I want
> to set any other properties, I have to access the bean directly anyway.
>
> So, I'd really like to know what's the big deal about beans? I would
> rather write my JSP pages without using beans, but I'm wondering if I'm
> missing something? What's the reason that beans were introduced to JSP
> in the first place? Are there any situations in which the use of beans
> provides a real advantage over the "traditional" approach?
>
> thx
> Heiko
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html