This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JSP and the fly likes pass bean property values to javascript function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "pass bean property values to javascript function" Watch "pass bean property values to javascript function" New topic
Author

pass bean property values to javascript function

Chetan Ram
Greenhorn

Joined: Mar 10, 2011
Posts: 20
Hi,

I have a bean class Person which has properties like name, age




I want to pass bean property values to javascript function for further use.

I can use struts <logic:iterate> or <c:foreach> to iterate over the bean properties.

Thanks for any help.

Chinnu
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

I Assume that you do iteration then display/non-display the value into a td(table). then just get the text/string value in javascript!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61450
    
  67

Niether of the Struts proprietary tag or <c:forEach> will "iterate" over properties. They are intended to iterate over collections.

What is it you are really trying to accomplish so we can guide you to the more appropriate methods?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Chetan Ram
Greenhorn

Joined: Mar 10, 2011
Posts: 20
Thanks for the reply.

we store bean objects in an arraylist. So in JSP, we get arraylist which contains beans.
I want to pass bean properties values to javascript.

Expected : I want to pass bean properties values to datagrid to display it in UI.

What I understand is that data needs to be passed to form the datagrid content to display.
I am trying to use dojo datagrid.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: pass bean property values to javascript function