I think it's easier to understand if you look at how it is translated to a
servlet.

If your HTML has a line such as:

<H1>The value is <%= somecode %>.</H1>

This gets translated in the servlet as a print statement.

print("<H1>The value is " + somecode + ".</H1>");

You can clearly see that you don't need (shouldn't have) a semicolon.


-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Varadharajan.K.V,AMB
Chennai
Sent: Thursday, August 10, 2000 11:54 PM
To: [EMAIL PROTECTED]
Subject: Re: Ending line of code with ;


hi Aaron,
This is the explanation from a JSP book.

"This is because Java's semicolon is a state-ment
delimiter. A semicolon has the effect of transforming a Java language
expres-sion
into a program statement. In Java, statements are evaluated purely for their
side effects; they do not return values. Thus, leaving out the semicolon in
JSP
expressions is the right thing to do, because the JSP container is
interested in the
value of the enclosed code, not its side effects."

Hope it clears your doubt.

Varad


-----Original Message-----
From: Aaron Prohaska [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 11, 2000 1:08 AM
To: [EMAIL PROTECTED]
Subject: Ending line of code with ;


Does anyone know why the ; is not needed when using <%= somecode %>? I would
expect that this line should be <%= somecode; %> but it works fine without
the ; to finish it.

Aaron

                <<:::..:::...::: Aaron Prohaska :::..:::...:::>>
VerdeSoft Internet Services
mailto:[EMAIL PROTECTED]          http://www.verdesoft.net/

===========================================================================
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

===========================================================================
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

===========================================================================
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