which version of wicket are you testing ? (line numbers don't match with my code)

Because what is exactly null in youre place?
setResponsePage() is not doing much...
getRequestCycle().setResponsePage(page);

so somehow getRequestCycle() returns null ... But i don't know how this is possible.


Dzenan Ridjanovic wrote:
Hi,

The new member registration works now in Spiral 12 (urls12). The update is on the Web:

Spiral 12 introduction::
http://drdb.fsa.ulaval.ca/urls/web/spirals/spiral12/index.html

Spiral 12 in action:
http://drdb.fsa.ulaval.ca/urls12/app

Spiral 12 zip file:
http://drdb.fsa.ulaval.ca/urls/web/zip/urls12.zip


I have redesigned the NewMemberClass by not reusing MemberAddForm (private class NewMemberForm extends MemberForm) and by dropping Observer/Observable (the next page is now in the onSubmit method of NewMemberForm).

I still do not get why the first does not work, while the second does:

1. setResponsePage(new CategoriesPage()); // NullPointerException in edit
    2. Page categoriesPage = new CategoriesPage();
   categoriesPage.onRedirect();

If there was a null pointer exception in the default constructor of CategoriesPage, it would be caught in 2. too.

I have complete listings of setResponsePage errors in the doc directory of urls12/doc (in .txt files).

A part of the error listing for Category edit:


wicket.WicketRuntimeException: Method public abstract void wicket.markup.html.form.IFormSubmitListener.onFormSubmitted() of interface java.lang.reflect.Method threw an exception at wicket.protocol.http.WebRequestCycle.invokeInterface(WebRequestCycle.java:506)

 Caused by: java.lang.NullPointerException
   at wicket.Component.setResponsePage(Component.java:1214)
at org.wicket.urls.app.view.category.CategoriesPage.update(CategoriesPage.java:153)
   at java.util.Observable.notifyObservers(Observable.java:142)
   at org.dzenanr.model.Entities.notifyObservers(Entities.java:795)
   at org.dzenanr.model.Entities.update(Entities.java:526)
at org.wicket.urls.app.view.category.CategoryEditForm.onSubmit(CategoryEditForm.java:50)
   at wicket.markup.html.form.Form.delegateSubmit(Form.java:428)
   at wicket.markup.html.form.Form.process(Form.java:380)
   at wicket.markup.html.form.Form.onFormSubmitted(Form.java:212)


My avoidance of the error::
// setResponsePage(new CategoriesPage()); // NullPointerException in edit
     Page categoriesPage = new CategoriesPage();
     categoriesPage.onRedirect();

It seems to me that the cause of errors might be my use of Observer/Observable for handling the next page. In the onSubmit method of a form I update the model that is observed by web pages. In a web page, in the update method I save the model changes to a file and then use setResponsePage (that is now in some pages replaced by onRedirect; in other pages I have not hit the problem yet). To restrain Observer/Observable, in the update method the first thing I do is delete an observer. An example of the update method in MembersPage:

public void update(Observable o, Object arg) {
if (o instanceof Members) { members.deleteObserver(this);
                 UrlsApp app = (UrlsApp) getApplication();
         Members entryMembers = app.getUrlsDb().getMembers();
         entryMembers.save();
//setResponsePage(new MembersPage()); // NullPointerException ?! Page membersPage = new MembersPage();
         membersPage.onRedirect();
     }
}

Dzenan


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to