This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Struts and the fly likes How to access a property attribute of a value outside of an iterate, but within another iterate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to access a property attribute of a value outside of an iterate, but within another iterate" Watch "How to access a property attribute of a value outside of an iterate, but within another iterate" New topic
Author

How to access a property attribute of a value outside of an iterate, but within another iterate

daniel mario munoz
Greenhorn

Joined: Apr 02, 2009
Posts: 7
Hi,

This is much easer that what it sound like... This is my code:

file1.jsp


file2.jsp




So, file1.jsp iterate over a collection of Objetivos. For each Objetivo we call file2.jsp wich iterates over Autores.... This is on a separte file, because the are actions involved with the list (delete, add Autores for each Objetivo)...

What I need to do is to add a <s:param name="codigo" value="codigo" /> to the iteration on list2.jsp, but that codigo must be from the Objetivo, not the Autor.

I know this must be like a very basic thing, however I havent found how to do it! sorry!

any help will be very much appriciated. By the way, Im using Struts 2.1.6.

daniel
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I don't see where you're including jsp2: how are you doing that?

Options include putting the value into a scope or creating an OGNL-scoped var.
daniel mario munoz
Greenhorn

Joined: Apr 02, 2009
Posts: 7
Hi David!

On line 23 of file1.jsp:



This calls an action, and displays the informacion on the div (The action points to file2.jsp).

--

I dont undestand what you mean by:

Options include putting the value into a scope or creating an OGNL-scoped var.


how do I do that?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Oh, you mean by making an Ajax request to an action. That will create a new request, hence new value stack.

You may have to pass an ID (or whatever it is) in the Ajax request and process it in the action. If I understand what you're doing.
daniel mario munoz
Greenhorn

Joined: Apr 02, 2009
Posts: 7
if I had something like this:



How do I pass the objetivos value inside the autores iterator?

Sorry if I insist alot!... thanks!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You'd have to pass it in via an <s:param> tag when you create the Ajax URL. If what you're trying to pass is an object (as opposed to an ID) then you'd need to pass the ID and look it up in the Ajax action.

Well, that's not entirely true--you could use <s:set> to put it into the session and access an actual object that way, maybe.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to access a property attribute of a value outside of an iterate, but within another iterate