• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:text question

 
Kevin Yun
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is an example from jsp syntax:
<hello><jsp:scriptlet>i=3;</jsp:scriptlet>
<hi>
<jsp:text> hi you all
</jsp:text><jsp:expression>i</jsp:expression>
</hi>
</hello>
The output is:
<hello> <hi> hi you all
</hi></hello>
Ques:
Why the value of i is not in the output?
Thanks!
KY
 
Mark Howard
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kevin
I don't see the definition for variable 'i' anywhere. You would probably see the value of i if it were defined as <jsp:scriptlet> int i=3;</jsp:scriptlet>
Mark.
 
Ke Liu
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can alter
<jsp:scriptlet>i=3;</jsp:scriptlet> to
<jsp eclaration>int i=3;</jsp eclaration> .
Try it out.
 
Kevin Yun
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Much appreciation to both of you. I tested the code within a JSP page. After the declartion of i, the output is : "hello you all 3". It is different with the example.
KY
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic