• 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

Doubt on a simple tag support and c:set tag

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
I a getting error when I run following code







It is getting null pointer exception..I dont understand why.
ALso when I avoid scripting to use


I am getting the error that it cannot convert String to List.
In jsp itself I can use this variable as List. But why cant it be passed as a List in the TagHandler. Please help me
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Two questions:
1. Where does mlist come from ?
2. Where is clist living ? Is it in any scope visible from EL ?
 
Charmy Madhvani
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mList was my mistake.
and c list is declared within that jsp page only. So I assume it is of page scope
 
Charmy Madhvani
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it started working now, for 2 reasons:
1. I added <type>java.util.List</type> for <attribute> element in tld for clist.
2. I added clist in session and passed it to the tag from sessionScope.

But my question remains that if i declare that list in scripting why should'nt it take from page scope. I explicitly have to add it in any of the scope.

Also


creates a List. Then why it is giving me an error :

Attempt to convert String "Red,Blue,Indigo,Yellow,Green" to type "java.util.List", but there is no PropertyEditor for that type

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

c list is declared within that jsp page only. So I assume it is of page scope


This was a wrong assumption. Things declared in scriptlets do not live in any scope. There are just local variables in the generated servlets. You cannot access them from EL, unless you put it in a scope.

[/code]
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the Tag Handler Class


In the above doTag method where did we use c variable?

This is the tag invoking JSP



here from where color attribute is coming?

I am not questioning any body but i just want to clarify my doubts

Thanks & Regards,
Sudhakar Karnati
[ April 19, 2008: Message edited by: sudhakar karnati ]
reply
    Bookmark Topic Watch Topic
  • New Topic