I would second this opinion; especially if you are working on
a large project with several HTML designers and Java developers.
Keeping the HTML (i.e., any presentation information) out of the
the Java code (the Bean, a Servlet, etc.) is the best way of
going--at least that's been my experience.
c-ya,
Steve M.
> -----Original Message-----
> From: Abraham Kang [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 24, 1999 8:03 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Output from Bean to JSP file
>
>
> Hi Brenda,
>
> IMHO, 2 Should be better because it is more maintainable.
> Even though there is Java Code with HTML the JSP tags are
> ignored by JSP aware browsers. I think Homesite is the only
> one currently that won't jack your JSP code.
>
> Because all of the HTML is there the HTML jockeys can make
> modifications to the look and feel of the site with little
> problems. Using method 1 will require HTML designers to
> learn Java and make modifications to JavaBeans. This also
> makes it harder to reuse the JavaBeans in different apps.
>
> Abraham
>
> -----Original Message-----
> From: Burns, Brendan [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, September 24, 1999 6:56 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Output from Bean to JSP file
>
> Sure,
> all you have to do is write a method on the bean like
>
> public String getHTML() {
> return ("<b>Hello World</b>");
> }
>
> and then put the tags
>
> <jsp:useBean id="myBean" class="myBean" scope="page" />
> <jsp:getProperty name="myBean" property="HTML"/>
>
> in the JSP. But this brings up a question I have been
> struggling with:
> What is the better way of generating html, having the bean do
> it through a
> method or including it in the JSP. I know that it is the
> intention of the
> JSP designers to seperate HTML from Java code and vis-versa
> but for example
> you have a bean which represents multiple choices that a user
> has made. do
> you:
>
> 1) have a single method on the bean that returns the
> "<select>...</select>
>
> or
>
> 2) put in the jsp
> <select name=<jsp:expr>mySelectBean.getName()</jsp:expr>>
> <% for(int i=0;i<mySelectBean.getNumberOfItems();i++) { %>
>
> <option><jsp:expr>mySelectBean.getName()</jsp:expr></option>
> ....
> </select>
>
> now 1) seems to obfuscate some code from the HTML
> designer, but two
> seems pretty much like Java code in the JSP which is better?
> opinions?
>
> Brendan
>
> ==============================================================
> =============
> 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
>
===========================================================================
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