You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by abangkis <ab...@sadikungroup.com> on 2004/10/25 22:58:40 UTC
second value is null
Hello...
i have a page that show images using foreach component.
each image have a link that show the detail of that image,
i'm using direct link, with the image id as it parameter.
until this point i'm doing fine, and sucessfull in showing the detail of
that image.
This image detail page has another link to modify the image data.
And i'm using the same method, direct link with the imageId as parameter.
The problem is when i submit the form i used to changed the data,
i got set property is null error.
here is some of the code i used
TIA - abangkis p
// picture detail class
public abstract class PictureDetail extends BasePage implements
PageRenderListener{
public void pageBeginRender(PageEvent evt){
loadPictures();
}
public void editPicture(IRequestCycle cycle){
Object [] params = cycle.getServiceParameters();
EditPictureDetail page = (EditPictureDetail)
cycle.getPage("EditPictureDetail");
page.setPictureId((String)params[0]);
cycle.activate(page);
}
public void loadPictures() {
// load the picture
}
}
// edit picture detail
public abstract class EditPictureDetail extends BasePage
implements PageRenderListener {
public void pageBeginRender(PageEvent evt){
loadPictures();
}
public void loadPictures() {
// load the picture like in the picture detail class
}
public void formSubmit(IRequestCycle cycle) {
try {
Session session = HibernateUtil.currentSession();
Pictures picture = getPicture();
if (picture != null) {
Transaction tx = session.beginTransaction();
picture.setDescr(getDescription());
session.update(picture);
tx.commit();
}
HibernateUtil.closeSession();
System.out.println("in form submit " + getPicture());
// back to the picture detail
PictureDetail page = (PictureDetail)
cycle.getPage("PictureDetail");
page.setPictureId(getPictureId());
cycle.activate(page);
} catch (HibernateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: second value is null
Posted by abangkis <ab...@sadikungroup.com>.
ups sorry forgot to tell that when i print the id in the page begin render,
i've got 2 value, the first is the correnct value, the second is null ?
is this got to do with the rewinding process ? cause i haven't grasped
this concept yet ?
TIA
abangkis wrote:
> Hello...
>
> i have a page that show images using foreach component.
> each image have a link that show the detail of that image,
> i'm using direct link, with the image id as it parameter.
>
> until this point i'm doing fine, and sucessfull in showing the detail
> of that image.
> This image detail page has another link to modify the image data.
> And i'm using the same method, direct link with the imageId as parameter.
>
> The problem is when i submit the form i used to changed the data,
> i got set property is null error.
>
> here is some of the code i used
>
> TIA - abangkis p
>
> // picture detail class
> public abstract class PictureDetail extends BasePage implements
> PageRenderListener{
>
> public void pageBeginRender(PageEvent evt){
> loadPictures();
> }
>
> public void editPicture(IRequestCycle cycle){
> Object [] params = cycle.getServiceParameters();
>
> EditPictureDetail page = (EditPictureDetail)
> cycle.getPage("EditPictureDetail");
> page.setPictureId((String)params[0]);
> cycle.activate(page);
> }
>
> public void loadPictures() {
> // load the picture
> }
> }
>
> // edit picture detail
> public abstract class EditPictureDetail extends BasePage
> implements PageRenderListener {
>
> public void pageBeginRender(PageEvent evt){
> loadPictures();
> }
> public void loadPictures() {
> // load the picture like in the picture detail class
> }
> public void formSubmit(IRequestCycle cycle) {
> try {
> Session session = HibernateUtil.currentSession();
> Pictures picture = getPicture();
> if (picture != null) {
> Transaction tx = session.beginTransaction();
> picture.setDescr(getDescription());
> session.update(picture);
> tx.commit();
> } HibernateUtil.closeSession();
> System.out.println("in form submit " + getPicture());
> // back to the picture detail
> PictureDetail page = (PictureDetail)
> cycle.getPage("PictureDetail");
> page.setPictureId(getPictureId());
> cycle.activate(page);
> } catch (HibernateException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> } }
> }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org