You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Cureau <cm...@gmail.com> on 2012/09/06 17:14:34 UTC

hide primary key on call to edit form

Hi there!

I'm attempting to integrate a JavaScript component into my code and came
across an interesting tidbit...

On a specific click event, the JavaScript calls the function clickEvent.
This event calls the handler on the server using a GET, which defines a new
EditEvent page, passes the key into the page, and then returns the
redirectURL to the javascript.  This all works as it should.  What I don't
like, however, is that the primary key is passed along in the URL.  I don't
need it there, since the key is annotated with @Persist in the page class.

Is there a way to stop this behavior?  Should I be doing something
differently?

My code:

---
FullCalendar.js (excerpt)
---

eventClick: function(calEvent, jsEvent, view) {
    $.ajax({
        url: specs.eventclickurl,
        data: calEvent,
        dataType: "json",
        success: function(data) {
            $(window.location).attr("href", data.redirectURL);
        }
    });
}

---
Calendar.java (excerpt)
---

@InjectPage
private EditEvent editEvent;

public Object onEventClick() {
    editEvent.setEventId(request.getParameter("id");
    return editEvent;
}

---
EditEvent.java (excerpt)
---

@Inject
private EventDAO eventDAO;

@Property
private Event event;

@Persist
private String eventId;

void setEventId(String eventId) {
    this.eventId = eventId;
}

void onActivate() {
    event = eventDAO.getEventById(eventId);
}

Re: hide primary key on call to edit form

Posted by Chris Cureau <cm...@gmail.com>.
You guessed right...I removed the onPassivate() method and all is well.
Thanks!

On Thu, Sep 6, 2012 at 10:36 AM, Lance Java <la...@googlemail.com>wrote:

> Firstly, I would avoid session usage unless it is definitely required.
> Passing the primary key in the URL is a good way of avoiding session usage.
>
> Secondly, tapestry is most likely adding the primary key to the URL
> because:
> a) The EditEvent page has an onPassivate() method.
> b) The EditEvent page has a property with a @PageActivationContext
> annotation
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/hide-primary-key-on-call-to-edit-form-tp5716100p5716101.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: hide primary key on call to edit form

Posted by Lance Java <la...@googlemail.com>.
Firstly, I would avoid session usage unless it is definitely required.
Passing the primary key in the URL is a good way of avoiding session usage.

Secondly, tapestry is most likely adding the primary key to the URL because:
a) The EditEvent page has an onPassivate() method. 
b) The EditEvent page has a property with a @PageActivationContext
annotation



--
View this message in context: http://tapestry.1045711.n5.nabble.com/hide-primary-key-on-call-to-edit-form-tp5716100p5716101.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