aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Two questions on  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Two questions on  " JSP SYNTAX 1.2 " issued by SUN" Watch "Two questions on  " JSP SYNTAX 1.2 " issued by SUN" New topic
Author

Two questions on " JSP SYNTAX 1.2 " issued by SUN

Peter Wei Cai
Greenhorn

Joined: May 09, 2002
Posts: 10
1, "Spaces are not allowed between an equals sign and an attribute value".
I do not understand its meaning. Can anybody show me an example?

2, "JSP and XMl syntax can not be mixed within a page".
below are some JSp code. which are right?
I choose a, c; How about your idea?

a>
..................
<%! int i=0; %>
<%! int j=0; %>
<% out.println(i); %>
<% out.println(j); %>
......
b>
..................
<jsp eclaration> int i=0; </jsp eclaration>
<%! int j=0; %>
<% out.println(i); %>
<% out.println(j); %>
......

c>
..................
<jsp eclaration> int i=0; </jsp eclaration>
<jsp eclaration> int j=0; </jsp eclaration>

<% out.println(i); %>
<% out.println(j); %>
......
d>
..................
<jsp eclaration> int i=0; </jsp eclaration>
<%! int j=0; %>
<jsp:scriplet> out.println(i); </jsp:scriplet>
<% out.println(j); %>
......


Sun Certified Java Programmer<br />Sun Certified Web Component Developer
Charles Scherer
Greenhorn

Joined: May 22, 2002
Posts: 1
For your first question about spaces in an expression, the following is incorrect:
<% = expression %>
to correct it, remove spaces before and after the equals:
<%=expression %>
Tong Chen
Ranch Hand

Joined: Apr 26, 2002
Posts: 1011
It is not valid to mix standard syntax and XML syntax in the same source file.
So any a) is correct.


Tong Chen (Seattle USA)<br />SCJP,SCWCD,SCDJWS,IBM XML,MCP.NET,MCAD.NET,MCSD.NET
Tong Chen
Ranch Hand

Joined: Apr 26, 2002
Posts: 1011
Sorry for the typo...
It is not valid to mix standard syntax and XML syntax in the same source file.
So only a) is correct.
Peter Wei Cai
Greenhorn

Joined: May 09, 2002
Posts: 10
For the first question:
<%=expression> is absolutely right.
But how about:
<%= expression>
Brian Glodde
Ranch Hand

Joined: Jun 27, 2001
Posts: 171
Peter, You should download a copy of Tomcat and try out these types of questions. IMO, the hands on experience will help you understand these little rules far more clearly. Just a suggestion!
 
 
subject: Two questions on " JSP SYNTAX 1.2 " issued by SUN