• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Take value to a variable using structs tags

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to pass values to javascripts scripts , am trying as below,

<logic:iterate name="testBean" property="cardList" id="d">
<bean:write name ="d" property="cardAccountNumber" />,
<%String str=//get the above value%>
<script>
globalvar=<%=str%>
</script>
</logic:iterate>

Here my cardList is a list of card objects.But How to i get the values to variable string str.Please help.

I was able to achieve below code where list contains only string variable,


<logic:iterate name="testBean" property="listMyString" id="s" >
<%out.println("test============="+s.toString());%>
</logic:iterate>

Please help on this ...
 
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Deepa,

I think you need to replace

with


if the variable str contains "ABC" then your statement is evaluated to:
globalvar=ABC instead of globalvar="ABC" which is what you want.

Hope this helps...
Aloha,
Doug

-- Nothing is impossible if I'mPossible
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Deepa,
We have a forum just for Struts. I'll move this for you.
 
Jeanne Boyarsky
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Deepa,
Why do you need a scriptlet? You could just use bean:write directly?

 
Are you okay? You look a little big. Maybe this tiny ad will help:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic