aspose file tools*
The moose likes Servlets and the fly likes How to parse values from beans?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to parse values from beans??" Watch "How to parse values from beans??" New topic
Author

How to parse values from beans??

Tom Barns
Ranch Hand

Joined: Oct 27, 2000
Posts: 138
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.


Thanks for your help.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
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?


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Tom Barns
Ranch Hand

Joined: Oct 27, 2000
Posts: 138
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.
Ashwin Desai
Ranch Hand

Joined: Jul 17, 2000
Posts: 124
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

Joined: Oct 27, 2000
Posts: 138
Thanks,i do think so.
Anil Vupputuri
Ranch Hand

Joined: Oct 31, 2000
Posts: 527
We can not use nested Jsp tags as it leads to compilation error.


SCJP 1.5, SCEA, ICED (287,484,486)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to parse values from beans??