• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

useBean question

 
Harshana Dias
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,



we are passing mystring=hhhh as reqest url parameter


<%=mystring%>// what is the output

out put print nothing..i understand that because we didnt add gettors and settors for String class. and this mystring is refer to bean class and url parameter mystring is not related. it only give to make confuse. but why it didnt print the hashcode value of String object( through toString)?

Thank You
 
Ryan Beckett
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wish I could help more as I really don't feeling developing sever side scripts at the moment. I don't think your using the language correctly. Typically, the useBean directive is used when parsing URL parameters directly to some class, maybe like a Customer in a forum or shopping cart. If you simply want to display the URL parameter just use scriptlets.





 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Use of scriptlets should be avoided . this can be replaced by EL

we are passing mystring=hhhh as reqest url parameter
<%=mystring%>// what is the output



 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A new String is intantiated, isn't it ? What does java.lang.String#toString() return ? Is it really the hashCode ? Check the API once more.
 
Harshana Dias
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe Verré wrote:A new String is intantiated, isn't it ? What does java.lang.String#toString() return ? Is it really the hashCode ? Check the API once more.


it cant be initiate a String right? because we didnt have a setMystring(String s) in String class to accept the url provided parameters?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic