• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

trying to get an object from a map in struts2

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have the following in my tag file, and I get an exception:





If i replace myMap[${groupName}] with myMap['Jobs'] it works perfectly. From the JSP that calls the tagfile i have




I also tried:



(this was someone elses solution from another forum with the same problem) but I still get the same error.

I have made sure EL is working, etc.

Is there any way to pass a variable that contains a string into my myMap object (I assume myMap is OGNL) ?

Thanks,

Billy[]



 
Sheriff
Posts: 9691
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Instead of this
<c:set var="myValue">${groupName}</c:set>
Can you try this
<s:push value="myValue">${groupName}</s:push>
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://struts.apache.org/2.1.8/docs/why-cant-i-use-jstl-style-el-expressions-in-struts-tags.html

Or use <s:set>. Either I or someonebody else wrote a thing about accessing JSP tag attributes, but I can't find it at the moment. In this case, if it's a string, it's just as easy this way.
 
Billy Vandory
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:http://struts.apache.org/2.1.8/docs/why-cant-i-use-jstl-style-el-expressions-in-struts-tags.html

Or use <s:set>. Either I or someonebody else wrote a thing about accessing JSP tag attributes, but I can't find it at the moment. In this case, if it's a string, it's just as easy this way.



Thanks David and Ankit!


 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic