• 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

c:set problem

 
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having a bean:


Servlet:
=========


JSP:
----
<c:set target="${dogAttr}" property="dogName" value="Jimmy"/>
Dog Name :: <jsp:getProperty name="dogAttr" property="dogName"/><br>

Output:
========
Dog Name :: Jimmy

Whether I have used the target is correct..? It should be the attribute name or actual object.. com.example.model.Dog

The below one is not executing and giving error:

<c:set target="${com.example.model.Dog}" property="dogName" value="Jimmy"/>
Dog Name :: <jsp:getProperty name="dogAttr" property="dogName"/><br>
 
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you please post the stack trace ???
 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And also what my doubt is whether for target only object should use or attribute name also can use, it it maps to an object.
Example:
Dog d = new Dog();
request.setAttribute("dogAttr",d);

<c:set target="${d}" ...

or

<c:set target="${dogAttr}" ...

Which one to use? If we can use both the option, I am getting the error for the first option..and the stackTrace given below..




[ January 21, 2007: Message edited by: Micheal John ]
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
as per my knowledge,
${dogAttr} should work very well..
from the stack trace..i advice you to do this

goto

tomcat_dir/work/Catalina/localhost/your_web_dir/org/apache/jsp
and delete the .java and .class files there
restart the server..and run your application again..

hth
let me know the progress !
 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Example:
Dog d = new Dog();
request.setAttribute("dogAttr",d);

<c:set target="${d}" ...

or

<c:set target="${dogAttr}" ...

Which one to use? If we can use both the option, I am getting the error for the first option..and the stackTrace given below..




To Niranjan Deshpande:

I am afarid that you didn't understand my question properly..
${dogAttr} works fine me also...
I have mentiond ${d} is not working properly...
for target we have to mention only the attribute name, which *SHOULD* resolve to an object..? This is correct or not..or someother thing also we can use it in the target? This my qustion..
[ January 21, 2007: Message edited by: Micheal John ]
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have mentiond ${d} is not working properly...

this doesnt work, because, though its a real thing,i mean a Dog object,
its no where in any of the four scopes, so it doesnt work...! the "d" is known as a "dogAttr" in your request scope..! so ${dogAttr} should be used and not ${d} , it doesnt work, even if its a REAL DOG.

got it ??
if you get that kinda stack trace some time in your j2ee life,
be sure to do what i told above..
i am telling you from my on job experience !

thanks
hopw i solved your query
[ January 21, 2007: Message edited by: Niranjan Deshpande ]
 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your help!!
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
did i solve your query ???
 
Then YOU must do the pig's work! Read this tiny ad. READ IT!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic