Forums Register Login

Getting Reference to Session Attribute

+Pie Number of slices to send: Send
I have a Servlet setting the following attribute:



Now in another Servlet I want to get this attribute but I can not find the correct syntax. The follow is incorrect.

+Pie Number of slices to send: Send
If you say so.
+Pie Number of slices to send: Send
 

Bear Bibeault wrote:If you say so.



It gives me the message

Cannot convert from Object to boolean
+Pie Number of slices to send: Send
As getAttribute() returns an Object, you'll need to cast it to Boolean.
+Pie Number of slices to send: Send
 

Bear Bibeault wrote:As getAttribute() returns an Object, you'll need to cast it to Boolean.



This


Gives same type of message:

Type mismatch: cannot convert from Object to Boolean

If I do


I get
The constructor Boolean(Object) is undefined

This does not cause errors but is it the correct way



+Pie Number of slices to send: Send
I said cast not construct. Basic Java:


+Pie Number of slices to send: Send
 

Bear Bibeault wrote:I said cast not construct. Basic Java:




Sorry for misunderstanding. Thanks, works great.
+Pie Number of slices to send: Send
My pleasure.
Oh sure, it's a tiny ad, but under the right circumstances, it gets bigger.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1763 times.
Similar Threads
Forwarding exception from servlet to JSP
Problem while retriving data
how to avoid show buttons
Dynamically Enable Submit Button
How to read a False Value
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 01:01:37.