• Post Reply Bookmark Topic Watch Topic
  • New Topic

tag question

 
Timber Lee
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A bean present in the page and identified as 'mybean' has a property named 'name'.
is the following way to print correct?
<%out.println(mybean.getName())%>
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No - the scriptlet is missing the ";".
Should be:
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course, alternatively you can use this to achieve the same result.

Simon
 
Vinay Salehithal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how about <jsp:getProperty name="mybean" property="Name" /> ?
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep, that will work too provided that the bean is in the request/page/session/application somewhere.
Simon
p.s. can you please change you name to meet the JavaRanch naming standards - thanks!
 
Bill Wang
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by javacool:
how about <jsp:getProperty name="mybean" property="Name" /> ?

Actually, the property should be "name" instead because it should follow Java bean naming convention
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!