• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

trying to get an object from a map in struts2

 
Billy Vandory
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • 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[]



 
Ankit Garg
Sheriff
Posts: 9519
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • 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>
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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
  • 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!


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic