• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Two questions on " JSP SYNTAX 1.2 " issued by SUN

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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); %>
......
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 %>
 
Ranch Hand
Posts: 1011
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not valid to mix standard syntax and XML syntax in the same source file.
So any a) is correct.
 
Tong Chen
Ranch Hand
Posts: 1011
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the first question:
<%=expression> is absolutely right.
But how about:
<%= expression>
 
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
You are HERE! The other map is obviously wrong. Better confirm with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!