• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to parse values from beans??

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All
if you we use <jsp:getProperty >action we will get a string represent that data,if i want to convert or cast that string to double or integer or something else,how do we do that.
i know there is a way to access the bean property using scriplets and do all the conversion that i need,but how do we parse or cast or convert that string which we get using that action to primitives data type or other objects if i need it.
or at least how to assign that output from that action to a variable.
thanks for your help.
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Surely if you want to assign the value from a bean to a variable, you must be doing that in a scriptlet anyway. HTML has ho concept of "variable".
If your bean has methods which return appropriate types, you can just call them:
<% int x = myBean.getCount(); %>
Am I missing something?
 
Tom Barns
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply.
i do undersdtand what you said,but can we do something like this:
<%String s=<jsp:getProperty name="name" property="count" /> %>
i know that doesn't compile,but is there anyway to assign the output of that action to a variable?
thanks again.
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
No, I do not think that you could assign the value by using the <jsp:> tag. The best way is to init it as Frank has suggested.
Ashwin.
 
Tom Barns
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks,i do think so.
 
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We can not use nested Jsp tags as it leads to compilation error.
 
reply
    Bookmark Topic Watch Topic
  • New Topic