You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by JeffersON <n3...@rtrtr.com> on 2012/09/15 18:27:42 UTC

My little problem with Tap listing

OK, I have quite complicated situation here. I have made one component for
listing all my blogs, and in that component I have made one specific method
for redirecting user to a BlogFullPage

@InjectPage
private BlogFullPage fullBlogPage;

//code trimmed 

@CommitAfter
public String onActionFromBlogFullPage(Blog blog){
fullBlogPage.setBlogSpecific(blog);
return fullBlogPage;
}

Now for that page I have made the following

public class BlogFullPage {
@Property
@Persist
private Blog blog;

public Blog getBlogSpecific(){
return blog;
}

public Blog setBlogSpecific(Blog blog){
this.blog=blog;
}

Now my tml for BlogFullPage looks like this
<t:layout .....>
<div class="div1_set2">
${blog.name}....//code trimmed

and with all of that I have added one component for listing comments for the
specific blog with
<t:listComments></t:listComments>


My listComments page and tml look like this

<PostDisplay
xmlns:t="htttp://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<t:loop source="comments" value="comment">
<div class="div3_sec1">
${comment.name}
${comment.from}
</t:loop>
</PostDisplay>

and my java looks like

public class ListComments{
@Inject
private Session session;

@Persist
@Property
private Blog blog;

@Persist
@Property
private Comment comment;


public List getComments()
{
   List l;
   l =
session.createCriteria(Comment.class).add(Restrictions.eq("id",blog)).list();
   return l;
}

However, everything works fine, except it doesn't list my comments for
specific blog!? I was thinking maybe Tap doesn't know in the runtime which
id of what blog is passed to it, and therefore doesn't return anything,
however when I put only this

public List getComments()
{
   List l;
   l = session.createCriteria(Comment.class).list();
   return l;
}

it lists just fine comments, however all comments are the same for every
blog, which is not what I want. What did I do here wrong, maybe some little
help would be appreciated.

Thanks in advance.







--
View this message in context: http://tapestry.1045711.n5.nabble.com/My-little-problem-with-Tap-listing-tp5716308.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: My little problem with Tap listing

Posted by "mailinglist@j-b-s.de" <ma...@j-b-s.de>.
I gues you want to use the foreign key pointing from comment to blog, but you are using the "id" (autoinc pk of comment?) instead.

session.createCriteria(Comment.class).add(Restrictions.eq("id",blog)).list();
  return l;

Jens

Sent from my iPhone

On 18.09.2012, at 03:02, Taha Siddiqi <ta...@gmail.com> wrote:

> 
> Should Restrictions.eq("id",blog) be Restrictions.eq("blog",blog)
> 
> Also I would use blog as activation context in the second page. @Persist should be avoided if possible.
> 
> 
> On Sep 15, 2012, at 9:57 PM, JeffersON wrote:
> 
>> Restrictions.eq("id",blog)
> 

Re: My little problem with Tap listing

Posted by Taha Siddiqi <ta...@gmail.com>.
Should Restrictions.eq("id",blog) be Restrictions.eq("blog",blog)

Also I would use blog as activation context in the second page. @Persist should be avoided if possible.


On Sep 15, 2012, at 9:57 PM, JeffersON wrote:

> Restrictions.eq("id",blog)