Jon Thomas wrote:
>
> Thank you all.
> I put declarations above the conditional and it worked like a charm.  It
> seems so simple now.
> A question though.
> Am I silly that I don't like using the "JSP specific tags" like <usebean>?
> I prefer to instantiate my objects and call on their interfaces right from
> inside the page because it seems to...
> A> not limit me to those methods and properties supported by a specific tag.
> B> better separate my logic (beans and servlets) from my presentation (jsp).
> Sincerely, does anyone else feel this way?  I mean if I have the entire java
> language at my fingertips between <%%> tags and I can call on properties
> within html using expression <%=myProp%> tags, then what do I gain by using
> JSP specific tags?

In general, I recommend keeping the JSP pages as code free as possible,
and using beans with the standard JSP actions goes a long way towards
this goal. Adding custom actions to the mix can take you all the way.

There are a number of reasons for this, for instance:
* Even if you know both Java and HTML, the person(s) that take over
  the application you develop may not have both these skills. By keeping
  JSP pages code free and all code in pure Java components (such as servlets,
  beans and custom actions), it's much easier to let people with different
  skill sets work with the development and maintenance.
* Debugging JSP pages with code, or even locating simple syntax errors, is
  far more complicated than debugging stand-alone Java components. If
  only use action elements in your JSP pages, the number of tricky
  syntax and logic errors are reduced significantly.

Having "the entire java language at my fingertips" in a JSP page is a mixed
blessing. It's so easy to let the code take over, and you end up with the
reverse maintenance problem to embedding HTML in servlets. If you use
servlets for request processing, and beans for business logic (which you
seem to do according to "B" above), the JSP pages only have to render the
bean values. That's what <jsp:useBean> and <jsp:getProperty> is good at.
You may still need small amounts of code to handle indexed properties and
conditional output, but an alternative is to develop (or use off-the-shelf)
custom actions instead.

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to