aspose file tools*
The moose likes Struts and the fly likes pass results of a struts logic tag to a java method? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "pass results of a struts logic tag to a java method?" Watch "pass results of a struts logic tag to a java method?" New topic
Author

pass results of a struts logic tag to a java method?

Brett Han
Greenhorn

Joined: May 17, 2005
Posts: 10
Is it possible to pass the results of a struts logic tag to a java method?

For example, say I have the following static method in class Test:


and the following struts tag, refering to a Map called "someMap" in the "SomeForm" class:



This works fine, of course, but what I want is to pass what <bean:write name="_bean" property="value"> evalutes to to my method above. Something like:



Is there any way to do this? I've tried a bunch of possibilities but can't get the jsp to compile.

Thanks.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You can put scriptlets inside attributes of struts tags, but you can't use struts tags inside scriptlets. However, you can use the beans exposed by the struts logic tag in a scriptlet. In your example, the iterate tag exposes a bean with variable name _bean of type Map.Entry with a getValue() and a getKey() method. So, you could write the following:
<%= Test.foo(_bean.getValue()) %>

For more on this see the following link:

http://struts.apache.org/userGuide/struts-logic.html#iterate


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: pass results of a struts logic tag to a java method?
 
Similar Threads
problem in logic:iterate
logic:iterate tag displaying same results??
How to iterate over one List and get a nested property defined in a different List
How to make dynamic radio button checked
logic:match , logic:notEqual not working