Also, it is possible for the JSP compiler to do some additional optimization
of the string-handling if you use the expression tag instead of the scriplet
tag.  I have no idea if any compilers currently do this (GnuJSP doesn't
appear to, but that's the only one I've used).

Personally, I switched to JSP largely to get away from constantly typing
"out.println" all over the place (separating code and content can be done a
dozen other ways without JSP, so that wasn't compelling for me).  But, if
you like the first better, go for it.

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of David Wall
Sent: Sunday, July 04, 1999 2:52 PM
To: [EMAIL PROTECTED]
Subject: Re: Newbie: Diff between <% and <%=


> <% out.println(dt.getHours()  + ":" + dt.getMinutes() + ":" +
> dt.getSeconds()); %>
>
> than
>
> <%=dt.getHours()%>:<%=dt.getMinutes()%>:<%=dt.getSeconds()%>
>
> (if nothing else it's faster to spot errors in the first for me, cause
> I've got The Eye) so I'd like to maybe just stick to <% if I can.
>
> So I guess my question is - is <%= truly just  a shortcutty kind of
> thing? Or is there more to it than that - do I actually need it
> sometimes.

It's pretty much just a convenience for non-Java programmers, which most
page designers are. You are more the exception than the rule if you know a
lot of Java syntax and do the web pages too.  One benefit is that the <%=%>
syntax will do simple toString() conversions for you, so stuff like <%=i%>
for an int index can be used, and it's even more compact than
<%out.println(""+i)%>  (or out.println(Integer.toString(i)). I believe the
move is away from Java code in the pages themselves, and the JSP spec is
moving towards taglets and such to do the work, again mostly because the
typical web page designer is not a Java programmer.

David

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to