Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pass collection object from tag class to jsp

 
vivek dhiman
Ranch Hand
Posts: 153
Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am not able to get the arraylist object on jsp. Below is my code.


JSP File


Nothing gets print on jsp

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64970
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At what point do you create articleList as a scoped variable? I assume the tag is called before the JSP fragment you posted? (This is the sort of thing you should mention in the post.)

The page can't magically see into your tag to local variables.
 
vivek dhiman
Ranch Hand
Posts: 153
Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Below is my JSP code that i am using now. Please make me right where i am wrong.

 
Paul Clapham
Sheriff
Posts: 21133
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I'm a bit confused by this. To me it says "Declare a request-scoped variable named articleList, and give it the value which comes from the scoped variable named articleList". What did you intend this code to do?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64970
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly, your added JSP code does nothing.

Where in the tag do you create the scoped variable?
 
vivek dhiman
Ranch Hand
Posts: 153
Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So shall i need to place inside<m:DisplayArticle>tag like:

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64970
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to do it from the Java code. How else is anything else to access the local variable?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic