On Fri, 28 Jan 2011 13:57:16 -0200, Jessica Sobieski <jessica.sobie...@gmail.com> wrote:

Hello boys!

Hi!

1) I don't control how buttons are generated, therefore they must call
register(studentId) javascript. No way around it.

Which buttons? I'm not following you.


    public String getStudent() {
        return student.getName();
    }
}

Here is my question:

2) I must somehow call Tapestry from register(studentId) method. I am both, clueless and frustrated as to how to do it.

Just ask us. :)

Define an event name for it. My example will use "register". Use the JavaScript code in http://tinybits.blogspot.com/2010/03/new-and-better-zoneupdater.html to correctly handle zone updates. Use a query parameter to pass information. Your code will look like this (not tested):

public class StudentCourse {

    @Inject @Id("confirmation") private Block confirmationBlock;

    @Inject private StudentDao studentDao;

    private Student student;

    @OnEvent("register") // without this annotation,
    Object registerStudent(@RequestParameter("id") Integer studentId) {
        student = studentDao.register(studentId);
        return confirmationBlock;
    }

    public String getStudent() {
        return student.getName();
    }
}

This is probably a not complete solution, but at least I gave you some hints. :) I hope it helps.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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

Reply via email to