Ok.  When you give the edit page an article, You're doing it basically
so you can pre-load the article title and content on the edit page,
right?  That works, but when you submit it, what you're actually
trying to set are the values of EditPage.article.title, etc.  The
problem is that the article only exists during the render phase, but
not during postback.

I think you would be better off to take the Article object in the
EditPage and (in the setArticle method) set 3 fields, the article ID,
title and content.  All of these would be tapestry managed properties.
 Then the ognl expressions are reduced to ognl:title and ognl:content
-- plus one hidden field for the id (ognl:id).

In your submit method, get the article object by id, set the title and
content and move on.

Try that, it should work for you.

-Mike

On 3/29/06, GbT <[EMAIL PROTECTED]> wrote:
> Hmmm it isn't working ... I inject the ArticleList page and tried
> with your suggestion but the error is still here:
>
> Unable to update OGNL expression '<parsed OGNL expression>' of
> [EMAIL PROTECTED] to aaaaaaa: target is null for
> setProperty(null, "body", aaaaaaa)
>
> It's very strange because my article is set before entering the
> articleedit page and his fields are display correctly in the edit
> page, then I submit the form:
> <form jwcid="@Form" success="listener:doSubmit">
>        <table>
>                <tr>
>                        <th>Body</th>
>                        <td>
>                                <textarea jwcid="@TextArea" 
> value="ognl:article.body" rows="10"
> cols="40"/>
>                        </td>
>                </tr>
>        </table>
>        <input type="submit" value="Confirm"/>
> </form>
>
> In the java page I have this method:
>
> public IPage doSubmit() {
>        System.out.println("...doSubmit()...");
>        try {
>                getSession().getDataContext().commitChanges();
>                System.out.println("Article saved!");
>        } catch (Exception e) {
>                System.out.println(e);
>                return this;
>        }
>        return getArticleListPage();
> }
>
> I tried also putting some debug text in the doSubmit method but
> nothing is displayed... so I assume the method gets never called!
> Obviously I'm injecting the session state and the ArticleListPage...
> it seems a simple page...
>
> Thanks again
>
>
> Il giorno 28/mar/06, alle ore 18:27, Mike Snare ha scritto:
>
> > Assuming that you are injecting the ArticleEditPage, try:
> >
> > ArticleEdit ap = getArticleEditPage();
> > ap.setArticle(a);
> > return ap;
> >
> > I don't think the call to getArticleEditPage() is guaranteed to return
> > the same instance every time if it's injected.  Thus your 2 calls to
> > it return 2 different objects.
> >
> > If you're not injecting the page but are instead creating it in the
> > method (and caching for later calls) then I'm not sure what the issue
> > could be.
> >
> > -Mike
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to