Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on a simple tag support and c:set tag

 
Charmy Madhvani
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • 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
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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 Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • 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]
 
sudhakar karnati
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic