• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

useBean question

 
Ranch Hand
Posts: 352
  • 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
 
Ranch Hand
Posts: 194
  • 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.





 
Ranch Hand
Posts: 874
Android VI Editor Java
  • 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




 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • 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: 352
  • 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?
 
Arthur, where are your pants? Check under this tiny ad.
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic