Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp syntax

 
Renu Radhika
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which jsp lines are correct?

1) <%! String myString=�Hello� %>
2) <% String myString=request.getServerName() %>
3) <%= out.print(�Hello�) %>
4) <%= �Hello� %>

Answer is

4) <%= �Hello� %>


But I feel 3 is also correct in the converted servlet it will appear like this

out.print("out.print(�Hello�)");

and hence it will print

out.print("Hello")

Please share your thoughts on this.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But I feel 3 is also correct in the converted servlet it will appear like this out.print("out.print(�Hello�)");


No. But the following would print it :


And remember that print methods' return type is void.
[ July 05, 2007: Message edited by: Satou kurinosuke ]
 
Renu Radhika
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Santou.I got it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic