• 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
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!