When's best to use which?
Cheers
-
Custom Tag or Javabean? (3 messages)
- Posted by: Nick Stephens
- Posted on: July 30 2001 02:58 EDT
Threaded Messages (3)
- Custom Tag or Javabean? by Ryan Breidenbach on July 30 2001 09:23 EDT
- Custom Tag or Javabean? by Nick Stephens on July 30 2001 10:25 EDT
- Custom Tag or Javabean? by rich client on August 01 2001 09:22 EDT
- Custom Tag or Javabean? by Nick Stephens on July 30 2001 10:25 EDT
-
Custom Tag or Javabean?[ Go to top ]
- Posted by: Ryan Breidenbach
- Posted on: July 30 2001 09:23 EDT
- in response to Nick Stephens
As a general rule, I would divide JSP Tag libraries and JavaBeans as so:
<ul>
<li>JavaBeans are used to encapsulate the "model" of you application. They contain the data and business logic. From a Model 2 perspective - this is what the servlet is placing in the request/session for the JSP to display. The JavaBeans themselves should have no "knowledge" they are being used in a JSP. In fact, the mechanism in how they are displayed should be comletely transparent to the JavaBean class.</li>
<li>Tag libraries are used to remove Java code from the JSP. Some very common uses of them are to perform boolean and null tests and iterations. In fact, if you have Tag libraries that perform these functions, you can probably remove 80% of the scriplet code from our JSPs! However, it is better if the JSP Tags do not contain any display logic, only logic that help the JSP display the corrent information. Basically - they support the JSP to keep them as "clean" as possible</li> -
Custom Tag or Javabean?[ Go to top ]
- Posted by: Nick Stephens
- Posted on: July 30 2001 10:25 EDT
- in response to Ryan Breidenbach
Cheers -
Custom Tag or Javabean?[ Go to top ]
- Posted by: rich client
- Posted on: August 01 2001 09:22 EDT
- in response to Nick Stephens
more advice: resist the urge to put display logic into the taglib. display logic meaning HTML text. HTML is much better off in its own file .. so you can use WYSIWYG editors like dreamweaver. but this is usually difficult to do and is the first thing to be abandoned when the schedule gets tight.