• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to convert the for Loop to the equalent JSTL code in JSP

 
santosh mgs
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to convert the for Loop to the equalent JSTL code in JSP

Please Help me its urgent. Thanks
 
Michael Houlo
Ranch Hand
Posts: 58
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the ranch ! Please UseCodeTags the next time you post some code. Also, EaseUp. Saying that your request is 'urgent' is not going to help you here.

As for your problem, use the c:forEach tag.

 
santosh mgs
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thanks for the reply, but i am getting the object value as shown below,i need the values present inside the object.

Help me Thanks again
 
santosh mgs
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe Verré wrote:Welcome to the ranch ! Please UseCodeTags the next time you post some code. Also, EaseUp. Saying that your request is 'urgent' is not going to help you here.

As for your problem, use the c:forEach tag.



Thanks for your suggestions,I am new ito the forum.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No need to use quotes for your own messages I have removed them.

I am new ito the forum.

You'll quickly get used to it
 
santosh mgs
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No i am not getting the value
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post your current code (in a new message). If you use the "var" attribute (set it to something like "details", not "myList", which implies each object is a list) and output myList.firstName it should work. Chances are you're either not retrieving the attribute you think you are, or you're not using the var attribute correctly.
 
santosh mgs
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi here is my updated code,i made changes but it is not working.



Thanks
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read. You can edit your post by using the button. The link I provide explains how to use them.

Like I said: you're trying to access the list itself, not each item in the list:See how you're using the word "list" there? The list is the list. Each *item* in the list is "details", because that's what you defined it to be in the c:forEach tag.
 
santosh mgs
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have changed the code, But it is not working
 
Michael Houlo
Ranch Hand
Posts: 58
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
santosh mgs wrote:I have changed the code, But it is not working


why don't you post your new code?
 
santosh mgs
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Please post your current code (in a new message). If you use the "var" attribute (set it to something like "details", not "myList", which implies each object is a list) and output myList.firstName it should work. Chances are you're either not retrieving the attribute you think you are, or you're not using the var attribute correctly.

See the difference? It's property access, not calling a method. (Update the variable names to whatever you're using now.)

Really, the code tags are easy; "[code]". Just like that. Except for the end tag, which has a slash.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic