You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by cajmrn <ca...@gmail.com> on 2009/07/21 14:13:28 UTC

Making the outside loop value available to the inside loop?

Hi Guys, 

Me again with another question :). I have the following setup an outer loop
construct and an Inner loop. I want the outer loop to generate the table
header of the each table that is generated. This is coming from the keyset()
of a hashmap. The inner loop should contain an arraylist, coming from the
values() of the hashmap also note, Im using an OGNL binding. My current
predicament is that the key that i am generating in the outer loop needs to
be passed to the .get() function of the innerloop and it doesnt seem to be
working. How is the outerloop value made available to the inner loop? and
passed to the inner get function?

Below is the tml that ive implemented thus far.

<t:form id="IssuesGrid">
		  	<ul t:type="loop" t:source="issueKeys" t:value="issueKey">
		  		<li>
		  			<table width="75%" border="1">
		  				<th>${issueKey}</th> 
		  				<tr t:type="loop" t:source="${ognl:issuesList.get(issueKey)}"
t:value="issue">
		  					<td>${issue.id}</td>
		  					<td>${issue.assignee}</td>
		  					<td>
		  						<t:checkbox t:value="issue.state"/>	
		  					</td> 
		  				</tr>
		  			</table>	 			
 				</li>
		 	</ul>
	</t:form>

Thanks in Advance,
Carlo
-- 
View this message in context: http://www.nabble.com/Making-the-outside-loop-value-available-to-the-inside-loop--tp24586541p24586541.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Making the outside loop value available to the inside loop?

Posted by cajmrn <ca...@gmail.com>.
Hi Thiago, 

Forgive the vagueness of my questions, its a bit difficult to bring across
what im trying to do without overstating the issues plus I've probably got
too many projects running concurrently :). 

the code I had pasted does not display the issue objects in the arraylist
that is returned from the .get() function on the hashmap. From a broader
perspective id like to display a table for every entry in the hashmap. Ive
tried, key word tried, various solutions including binding to a
DataGridSource, but was unable to adequately implement that. then, I tried
getting a Set from the entrySet of the Hashmap, then, I found a thread here
about ognl bindings and it seemed like the best solution. 

I'll give prop and literal prefixes a try, I can see my information flow all
the way up arraylist but from there it just doesnt display in the web page,
just the issueKeys are displayed "the table headers" but the <tr> elements
are not filled.

Thanks for your time and patience.
Carlo





Thiago H. de Paula Figueiredo wrote:
> 
> Em Tue, 21 Jul 2009 10:24:42 -0300, cajmrn <ca...@gmail.com> escreveu:
> 
>> Thanks for your response Thiago.
> 
> You're welcome!
> 
> Two issues:
> What exactly is not working? Your description is quite vague.
> Instead of using OGNL, use Tapestry's prop binding. It will be much easier  
> to debug than when you put logic in your template.
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Making-the-outside-loop-value-available-to-the-inside-loop--tp24586541p24591387.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Making the outside loop value available to the inside loop?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 21 Jul 2009 10:24:42 -0300, cajmrn <ca...@gmail.com> escreveu:

> Thanks for your response Thiago.

You're welcome!

Two issues:
What exactly is not working? Your description is quite vague.
Instead of using OGNL, use Tapestry's prop binding. It will be much easier  
to debug than when you put logic in your template.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Making the outside loop value available to the inside loop?

Posted by cajmrn <ca...@gmail.com>.
Thanks for your response Thiago.

This is my java code for that page.


public class Contact
{
	@SessionState
	private jiraDataSource jDO;
	
	private HashMap <String, ArrayList<Issue>> issuesList;
	
	private Collection<ArrayList<Issue>> issuesSet;
	
	private Collection<String> issueKeys;
	
	private ArrayList<Issue> issues;
	
	private String issueKey;
	
	private Issue issue;
	
	void onActivate()
	{
		issuesList =jDO.getAllIssuesLists(); 
	}
	
	public void setIssuesList(HashMap <String, ArrayList<Issue>> issuesList)
	{
		this.issuesList = issuesList;
	}
	
	public HashMap <String, ArrayList<Issue>> getIssuesList()
	{
		return issuesList;
	}
	
	public Collection <String> getIssueKeys()
	{
		issueKeys = issuesList.keySet();
		return issueKeys;
	}
	
	public Collection<ArrayList<Issue>> getIssuesSet()
	{
		issuesSet = issuesList.values();
		return issuesSet;
	}
	
	public void setIssues(ArrayList<Issue> cI)
	{
		this.issues = cI;
	}
	
	public ArrayList<Issue>getIssues()
	{	
		return issues;
	}
	
	public void setIssueKey(String iK)
	{
		this.issueKey = iK;
	}
	
	public String getIssueKey()
	{
		return issueKey;
	}
	
	public Issue getIssue()
	{
		return issue;
	}
	
	public void setIssue(Issue i)
	{
		this.issue = i;
	}
}

So just to explain what I think the logic to what I have coded is, (this may
be the issue :)) when i say ognl:issuelist.get(issueKey) it passes the value
from setIssueKey() and it should be returning an arraylist and because my
arraylist has issue objects, the setIssue() function should get called,
correct?

Carlo




Thiago H. de Paula Figueiredo wrote:
> 
> Em Tue, 21 Jul 2009 09:13:28 -0300, cajmrn <ca...@gmail.com> escreveu:
> 
>> How is the outerloop value made available to the inner loop? and
>> passed to the inner get function?
> 
> Your template looks like it should work as is. You don't need to pass  
> values from one component to the other. Just make sure the outer loop sets  
> some page property that is read by the inner loop. Posting your page code  
> here would help.
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Making-the-outside-loop-value-available-to-the-inside-loop--tp24586541p24587593.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Making the outside loop value available to the inside loop?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 21 Jul 2009 09:13:28 -0300, cajmrn <ca...@gmail.com> escreveu:

> How is the outerloop value made available to the inner loop? and
> passed to the inner get function?

Your template looks like it should work as is. You don't need to pass  
values from one component to the other. Just make sure the outer loop sets  
some page property that is read by the inner loop. Posting your page code  
here would help.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org