my dog learned polymorphism
The moose likes JSP and the fly likes Property 'someproperty' not found on type java.lang.String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Property Watch "Property New topic

Property 'someproperty' not found on type java.lang.String

baxhuli pema

Joined: Nov 09, 2012
Posts: 11
Please if anyone can help me with this error because it is frustrating me.

This is the error that I am getting when the JSP containing this form is called. the "userid" column is in the database and also in the user bean.
Thank you.
Matthew Brown

Joined: Apr 06, 2010
Posts: 4543

Well, based on that error message it looks like user is not in fact a User object, but is actually a String. Then it tries to access the userid property of the String, which obviously doesn't exist. So I'd suggest looking first at where you declare your user bean.
baxhuli pema

Joined: Nov 09, 2012
Posts: 11
Thank you for your reply. I thought it too actually but I am not getting any idea because the user bean is accessed by other jsp. I am getting this error only in this case.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Nevertheless it's pretty clear from the error message that what Matthew Brown said was completely correct. So now you need to find out why. Looking for reasons why your code is in fact correct or reasons why Matthew was in fact incorrect is not a good strategy at this point.

As for finding out why: something which ran before that code created a "user" property which is a String. Remember that there are several places where the JSP compiler looks for that property (e.g. session scope, request scope, and so on), and you may be assuming that it's in one of those places whereas it's really in another place with higher priority.
I agree. Here's the link:
subject: Property 'someproperty' not found on type java.lang.String
It's not a secret anymore!