Forums Register Login

Two questions on " JSP SYNTAX 1.2 " issued by SUN

+Pie Number of slices to send: Send
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); %>
......
+Pie Number of slices to send: Send
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 %>
+Pie Number of slices to send: Send
It is not valid to mix standard syntax and XML syntax in the same source file.
So any a) is correct.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
For the first question:
<%=expression> is absolutely right.
But how about:
<%= expression>
+Pie Number of slices to send: Send
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!
No prison can hold Chairface Chippendale. And on a totally different topic ... my stuff:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 720 times.
Similar Threads
jsp:text question
what does xmlns mean
Xml equivalents
confusion in declaration
q on JSP std actions
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:01:33.