Ok, I solved the initial problem.  I didn't specify a container for the
fragment, I missed that in the examples.  I changes my template to contain
this extra div.


<div wicket:id="session"></div>

Then I specify my panels with

if(session.isSignedIn()){
add(new LogoutFragment("session", "logout", this));
}else{
add(new LoginFragment("session", "login", this));
}

Everything is rendering, but if I try to submit my form, I receive this
error

WicketMessage: Method onFormSubmitted of interface
org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component
[MarkupContainer [Component id = loginForm]] threw an exception

Root cause:

java.lang.IllegalStateException: Attempt to set model object on null model
of component: headerPanel:session:session:loginForm:email
     at
org.apache.wicket.Component.setDefaultModelObject(Component.java:3033)
     at
org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)
     at
org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component(Form.java:227)
     at
org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:514)
     at
org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:493)
     at
org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrder(FormComponent.java:465)
     at
org.apache.wicket.markup.html.form.Form.internalUpdateFormComponentModels(Form.java:2081)
     at
org.apache.wicket.markup.html.form.Form.updateFormComponentModels(Form.java:2049)
     at org.apache.wicket.markup.html.form.Form.process(Form.java:1004)
     at org.apache.wicket.markup.html.form.Form.process(Form.java:931)
     at
org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:896)

If I have my form in it's own panel it seems to work.  I've changed it's
paret class to to be the following

public class LoginForm extends Form<LoginForm>

Any ideas?

Thanks,
Todd



On 2 June 2010 05:15, Todd Nine <[email protected]> wrote:

> Sorry, forgot that. 1.4.9
>
>
> On 2 June 2010 03:03, Jeremy Thomerson <[email protected]> wrote:
>
>> what version of wicket?
>>
>> On Tue, Jun 1, 2010 at 3:37 AM, Todd Nine <[email protected]>
>> wrote:
>>
>> > Hi all,
>> >  I'm new to Wicket, so if I've done something obviously wrong, please
>> point
>> > it out.  I have 2 ways the user could log in to our site.  One if via
>> the
>> > full page login form, the other is via  quick login in the header.
>>  Since
>> > I'll need to gather the same form data in multiple places, I've created
>> a
>> > reusable form object below.
>> >
>> > http://pastie.org/private/7v1vnmyb4kefamu8q1tnfw
>> >
>> > Now, I'm working on my "SessionPanel".  This is the panel at the top
>> right
>> > of my header.  If the user is logged in, it shows a logout link.  If
>> > they're
>> > an anonymous user, it shows the login form.  I have this for my panel
>> code.
>> >
>> > http://www.pastie.org/private/bw5vvzddtrcruemnobjg
>> >
>> > And here is my html
>> >
>> > http://www.pastie.org/private/o9gzhxeqfcbu8vpohr1uvw
>> >
>> > Whenever I try to render the page, I always receive this error.
>> >
>> >
>> > Root cause:
>> >
>> > org.apache.wicket.markup.MarkupException: Expected close tag for
>> > <wicket:fragment wicket:id="login">
>> > [markup =
>> >
>> >
>> file:/Users/toddnine/development/aviator-services/logbook/target/classes/com/spidertracks/aviator/logbook/panel/SessionPanel.html
>> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> >   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
>> >
>> > <html xmlns="http://www.w3.org/1999/xhtml";
>> > xmlns:wicket="http://wicket.sourceforge.net/"; xml:lang="en" lang="en">
>> > <body>
>> > <wicket:panel>
>> > <wicket:fragment wicket:id="login">
>> > <form wicket:id="loginForm">
>> > <p>keep me logged in:
>> > <input type="checkbox" wicket:id="rememberMe"/>
>> > </p>
>> > <p> email: <input type="text" wicket:id="email"/>
>> > password: <input type="password" wicket:id="password"/>
>> > <input type="submit" value="Login" />
>> > </p>
>> > </form>
>> > </wicket:fragment>
>> >
>> >
>> > <wicket:fragment wicket:id="logout">
>> > <p><a href="#" wicket:id="logout">logout</a></p>
>> > </wicket:fragment>
>> > </wicket:panel>
>> > </body>
>> > </html>, index = 5, current = '<form wicket:id="loginForm">' (line 9,
>> > column
>> > 3)]
>> >    at
>> >
>> >
>> org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:474)
>> >    at
>> >
>> org.apache.wicket.Component.renderClosingComponentTag(Component.java:4318)
>> >    at org.apache.wicket.Component.renderComponent(Component.java:2627)
>> >    at
>> org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1512)
>> >    at org.apache.wicket.Component.render(Component.java:2450)
>> >    at
>> > org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1414)
>> >    at
>> >
>> >
>> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1577)
>> >    at
>> >
>> >
>> org.apache.wicket.MarkupContainer.renderAssociatedMarkup(MarkupContainer.java:675)
>> >    at
>> >
>> >
>> org.apache.wicket.markup.html.panel.Panel.onComponentTagBody(Panel.java:114)
>> >    at org.apache.wicket.Component.renderComponent(Component.java:2619)
>> >
>> > My XHtml seems well formed, what am I doing wrong?
>> >
>> > Thanks,
>> > Todd
>> >
>>
>>
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>
>

Reply via email to