Meaningless Drivel is fun!*
The moose likes JSP and the fly likes How to convert the for Loop to the equalent JSTL code in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to convert the for Loop to the equalent JSTL code in JSP" Watch "How to convert the for Loop to the equalent JSTL code in JSP" New topic
Author

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

santosh mgs
Greenhorn

Joined: Aug 03, 2010
Posts: 7
How to convert the for Loop to the equalent JSTL code in JSP

Please Help me its urgent. Thanks
Michael Houlo
Ranch Hand

Joined: Jun 07, 2010
Posts: 58
Hi there

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

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.


[My Blog]
All roads lead to JavaRanch
santosh mgs
Greenhorn

Joined: Aug 03, 2010
Posts: 7
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

Joined: Aug 03, 2010
Posts: 7
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

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

Joined: Aug 03, 2010
Posts: 7
No i am not getting the value
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Aug 03, 2010
Posts: 7
Hi here is my updated code,i made changes but it is not working.



Thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Aug 03, 2010
Posts: 7
I have changed the code, But it is not working
Michael Houlo
Ranch Hand

Joined: Jun 07, 2010
Posts: 58
santosh mgs wrote:I have changed the code, But it is not working


why don't you post your new code?
santosh mgs
Greenhorn

Joined: Aug 03, 2010
Posts: 7
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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.
 
 
subject: How to convert the for Loop to the equalent JSTL code in JSP