• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to use c:out tag outside forEach in this case?  RSS feed

 
ronney singh
Ranch Hand
Posts: 40
IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone
What I am trying to do is I am sending an ArrayList to jsp page containing object of AdminLoginBean and want to display the int variable of AdminLoginBean at jsp.

This code is part of servlet from where I am Forwarding to jsp page-


And this is the jsp


The code inside c:forEach is working properly.
Please tell me the syntax to display chid of AdminLoginBean in c:out which is outside c:forEach
 
Rob Spoor
Sheriff
Posts: 20903
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Outside the forEach loop there is no AdminLoginBean instance. So of which AdminLoginBean instance would you try to get the chid property?
 
ronney singh
Ranch Hand
Posts: 40
IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to make that instance and is there any way that we write some code in c:out and get the value of chid.
 
Rob Spoor
Sheriff
Posts: 20903
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please answer this question: what chid value do you want to print outside the loop? Of the first AdminLoginBean instance? The last one? The 3rd?
 
ronney singh
Ranch Hand
Posts: 40
IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
chid value of first AdminLoginBean instance
 
Rob Spoor
Sheriff
Posts: 20903
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So just get that from the List itself:
 
ronney singh
Ranch Hand
Posts: 40
IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob Spoor for all your replies.
 
Rob Spoor
Sheriff
Posts: 20903
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!