This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes El property not found problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "El property not found problem" Watch "El property not found problem" New topic
Author

El property not found problem

Bobby Sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 574
    
    1

I took this example from HFSJ ,as usual LOL but I got problem again.

//Person.java


------------------
//Toy.java


----------------
//Dog.java


-----------
//ToyServlet.java

----------------
toys.jsp



-----------
no problem in web.xml (I can bet )
----------------------

The problem is : javax.el.PropertyNotFoundException: Property 'name' not found on type java.lang.String

----------------------------
Solve it ;)

best regards,
omi
[ March 20, 2008: Message edited by: omi sharma ]

Back to Java , again.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

omi sharma,

Javaranch tip:
A lot of people (myself included) won't bother sifting through more than 3 or 4 lines of unformatted code. You took the time to add UBB code tags, which is great but it looks like you also removed all the indenting. Preserving the indenting is main reason for using UBB code tags in the first place.

You can always fix the text in your first post by clicking on the .


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The message is telling you that the object represented by the scoped variable "person" is actually a String object, not a Person object. If you'll look closely at ToyServlet, you will see that you actually did place a String in the request scoped variable "person", that string being "p". I suspect what you meant to do was use the Person object represented by the variable p instead.

Hopefully now you know how to fix it.


Merrill
Consultant, Sima Solutions
Bobby Sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 574
    
    1

I am afraid the problem is not what you told me brother.
you need to look closer the problem because I took the problem from hfsj book
(chapter 8,page 374).It's exactly the same as in the book.
p is object which I created on ToyServlet ,Person is actually string.
so please solve this ASAP.This EL has bugged me up.

by the way don't you think it could be scope problem.I did not set the scope
yet.Because as far as I know default is page ,should I need request scope. :p

please verify that too.

best regards,
omi
[ March 20, 2008: Message edited by: omi sharma ]
Hongli Li
Ranch Hand

Joined: Oct 29, 2006
Posts: 124
as Merrill suggested,
you should use
instead of


Do you know why this cup is useful? Because it is empty.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I can assure you that java.lang.String does not have a name property.
Look more closely at your book.
If, indeed, it is setting a string literal as the attribute, then you should also check that book's errata site to see if it was a misprint.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by omi sharma:
you need to look closer the problem...so please solve this ASAP

Actually, I don't need to do anything, as I'm just here in the forum to help with questions and for my own fun and enjoyment. Isn't this fun?
[ March 20, 2008: Message edited by: Merrill Higginson ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

Demanding that other people solve your problems for you is hardly the most effective strategy for obtaining help. I strongly suggest that you rethink your approach.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bobby Sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 574
    
    1

I am sorry friends,I had no intention to hurt your feelings.
you are absolutely right,you need not do anything for me.
I should have said,'I beg you to solve my problem.'
Sorry for my air of manager. LOL

Actually at that time ,I was not in the situation to think as I am taking
too much tension these days.

'you need to ' is dangerous while you are asking for help.
This is the second time when someone hit me for using that word. LOL

And as to the problem ,you are absolutely right.I did not notice correctly.

'you need to' is quite demanding isn't it.? :p

sorry once again.

best regards,
omi
 
 
subject: El property not found problem
 
Similar Threads
EL - [ ] and .
EL s not running
Using pageContext in EL
Getting java.lang.StackOverflowError - HFSJ pg 379
Not working with 1.5