aspose file tools*
The moose likes Struts and the fly likes Take value to a variable using structs tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Take value to a variable using structs tags" Watch "Take value to a variable using structs tags" New topic
Author

Take value to a variable using structs tags

Deepa Pillai
Greenhorn

Joined: Mar 27, 2008
Posts: 5
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 ...
Doug Slattery
Ranch Hand

Joined: Sep 15, 2007
Posts: 294
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
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

Deepa,
We have a forum just for Struts. I'll move this for you.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

Deepa,
Why do you need a scriptlet? You could just use bean:write directly?

 
 
subject: Take value to a variable using structs tags