You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk> on 2007/12/14 10:22:48 UTC

{wicket 1.3 rc1}testing ajaxbutton...

Hi

How do I test the ajaxbutton?

If I try to execute the event I just get an null pointer exeception like 
this:
         wicketTester.executeAjaxEvent("form:ajaxButton", "onclick");

Should I just check if theres ajax present? And the process the form 
using the formtester?

-- 
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: {wicket 1.3 rc1}testing ajaxbutton...

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Hi Timo

It was a bug in rc 1 I think, was fixed rc2 as I remember.

Timo Rantalaiho wrote:
> On Fri, 14 Dec 2007, Nino Saturnino Martinez Vazquez Wael wrote:
>   
>> If I try to execute the event I just get an null pointer exeception like 
>> this:
>>         wicketTester.executeAjaxEvent("form:ajaxButton", "onclick");
>>
>> Should I just check if theres ajax present? And the process the form 
>> using the formtester?
>>     
>
> Hi, are you sure that the path "form:ajaxButton" is correct?
> So if you do
>
>    AjaxButton button = (AjaxButton)
>        wicketTester.getComponentFromLastRenederedPage("form:ajaxButton");
>    Assert.notNull(button);
>
> does it pass?
>
> What is the stack trace? Is request cycle initialized?
> Are you sure that "onclick" is the correct event?
>
> Best wishes,
> Timo
>
>   

-- 
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: {wicket 1.3 rc1}testing ajaxbutton...

Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Fri, 14 Dec 2007, Nino Saturnino Martinez Vazquez Wael wrote:
> If I try to execute the event I just get an null pointer exeception like 
> this:
>         wicketTester.executeAjaxEvent("form:ajaxButton", "onclick");
> 
> Should I just check if theres ajax present? And the process the form 
> using the formtester?

Hi, are you sure that the path "form:ajaxButton" is correct?
So if you do

   AjaxButton button = (AjaxButton)
       wicketTester.getComponentFromLastRenederedPage("form:ajaxButton");
   Assert.notNull(button);

does it pass?

What is the stack trace? Is request cycle initialized?
Are you sure that "onclick" is the correct event?

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to dynamic load a HTML file

Posted by wicket user <di...@googlemail.com>.
You don't have to worry about the path.

You should name your file like YourWebPage_variation.html and place the file
where you would place it in normal case.

For example If the variants of the page are

YourWebPage_1.html, YourWebPage_2.html, YourWebPage_n.html
,.....,YourWebPage_n.html

 String getVariation()
 {
    // add the logic as it fits your need, hope you get the idea
     if(conditon1)
              return "1";
     else if(conditon2)
              return "2";
     else if(conditon3)
              return "3";
      .................
      ................
      else
              return "";
}

regards
dipu



For example, if you have a Page called YourWebPage, and if you want to have
man
On Dec 14, 2007 10:22 AM, qinyi lai <la...@msn.com> wrote:

> Thanks, I will try it!
> But any example for this!
>
> I find in the wicket.Component.java
>
> public String getVariation() {
>
>    return null;//how to override it, return the HTML file path+filename?
>
> }
>
>
> and any one have wicket offline API, documents!
>
>
>
>
>
> > From: dipu.wkt@googlemail.com
> > To: users@wicket.apache.org
> > Subject: Re: How to dynamic load a HTML file
> >
> > override getVariation() in your page to get the appropriate html/markup
> > picked.
> >
> > regards
> > -dipu
> >
> >
> > On Dec 14, 2007 9:43 AM, qinyi lai <la...@msn.com> wrote:
> >
> > > Hi
> > >   I wanne to dynamic load a HTML file to mapping a JAVA class page!
> > > a JAVA class file will have many HTML files(1:n mapping), and in the
> > > running time,
> > > the JAVA class file will select a  HTML file to display a different
> Page
> > > layout to User!
> > > How to carry it out?
> > >
> > > I found a article about this,
> > >
> > >
> http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html
> > > but it just define the new IResourceStreamLocator class:
> > > Than, override Application.init() method to add the new
> > > IResourceStreamLocator
> > > It only load the file int init of Application! and It 1:1 (java
> class:html
> > > file) mapping in the program!
> > >
> > > Thanks for U suggestion!
> > > Best Regards,
> > > Mead
> > > laiqinyi@msn.com
> > > laiqinyi@gmail.com
> > >
> > > _________________________________________________________________
> > > Express yourself instantly with MSN Messenger! Download today it's
> FREE!
> > > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>

RE: How to dynamic load a HTML file

Posted by qinyi lai <la...@msn.com>.
Thanks, I will try it!
But any example for this!

I find in the wicket.Component.java

public String getVariation() {

    return null;//how to override it, return the HTML file path+filename?

}


and any one have wicket offline API, documents!





> From: dipu.wkt@googlemail.com
> To: users@wicket.apache.org
> Subject: Re: How to dynamic load a HTML file
> 
> override getVariation() in your page to get the appropriate html/markup
> picked.
> 
> regards
> -dipu
> 
> 
> On Dec 14, 2007 9:43 AM, qinyi lai <la...@msn.com> wrote:
> 
> > Hi
> >   I wanne to dynamic load a HTML file to mapping a JAVA class page!
> > a JAVA class file will have many HTML files(1:n mapping), and in the
> > running time,
> > the JAVA class file will select a  HTML file to display a different Page
> > layout to User!
> > How to carry it out?
> >
> > I found a article about this,
> >
> > http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html
> > but it just define the new IResourceStreamLocator class:
> > Than, override Application.init() method to add the new
> > IResourceStreamLocator
> > It only load the file int init of Application! and It 1:1 (java class:html
> > file) mapping in the program!
> >
> > Thanks for U suggestion!
> > Best Regards,
> > Mead
> > laiqinyi@msn.com
> > laiqinyi@gmail.com
> >
> > _________________________________________________________________
> > Express yourself instantly with MSN Messenger! Download today it's FREE!
> > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

Re: How to dynamic load a HTML file

Posted by wicket user <di...@googlemail.com>.
override getVariation() in your page to get the appropriate html/markup
picked.

regards
-dipu


On Dec 14, 2007 9:43 AM, qinyi lai <la...@msn.com> wrote:

> Hi
>   I wanne to dynamic load a HTML file to mapping a JAVA class page!
> a JAVA class file will have many HTML files(1:n mapping), and in the
> running time,
> the JAVA class file will select a  HTML file to display a different Page
> layout to User!
> How to carry it out?
>
> I found a article about this,
>
> http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html
> but it just define the new IResourceStreamLocator class:
> Than, override Application.init() method to add the new
> IResourceStreamLocator
> It only load the file int init of Application! and It 1:1 (java class:html
> file) mapping in the program!
>
> Thanks for U suggestion!
> Best Regards,
> Mead
> laiqinyi@msn.com
> laiqinyi@gmail.com
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

How to dynamic load a HTML file

Posted by qinyi lai <la...@msn.com>.
Hi
   I wanne to dynamic load a HTML file to mapping a JAVA class page!
a JAVA class file will have many HTML files(1:n mapping), and in the running time,
the JAVA class file will select a  HTML file to display a different Page layout to User!
How to carry it out?

I found a article about this,
http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html
but it just define the new IResourceStreamLocator class:
Than, override Application.init() method to add the new IResourceStreamLocator
It only load the file int init of Application! and It 1:1 (java class:html file) mapping in the program!

Thanks for U suggestion!
Best Regards,
Mead
laiqinyi@msn.com
laiqinyi@gmail.com

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

Re: {wicket 1.3 rc1}testing ajaxbutton...

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Hmm

Can any confirm that 
wicketTester.assertComponentOnAjaxResponse(component) are working 
properly. I get an error event though my component are on response. 
Seems as it are checking for <?xml in the begining of the document and 
mine comes after the html document...

regards Nino

Nino Saturnino Martinez Vazquez Wael wrote:
> Hmm didnt help me though..
>
> calling this wicketTester.submitForm("form"); just gives a NPE...
>
> Hmm using form tester and wicketTester.executeAjaxEvent works after 
> upgrading. Very nice:)
>
> Thanks :)
>
> Nino Saturnino Martinez Vazquez Wael wrote:
>> Ohh hold on for a minute.. I saw the *WICKET-1199 
>> <https://issues.apache.org/jira/browse/WICKET-1199> was fixed.. I'll 
>> try to upgrade and see if it fixes the problem...*
>>
>> Nino Saturnino Martinez Vazquez Wael wrote:
>>> Hi
>>>
>>> How do I test the ajaxbutton?
>>>
>>> If I try to execute the event I just get an null pointer exeception 
>>> like this:
>>>         wicketTester.executeAjaxEvent("form:ajaxButton", "onclick");
>>>
>>> Should I just check if theres ajax present? And the process the form 
>>> using the formtester?
>>>
>>
>

-- 
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: {wicket 1.3 rc1}testing ajaxbutton...

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Hmm didnt help me though..

calling this wicketTester.submitForm("form"); just gives a NPE...

Hmm using form tester and wicketTester.executeAjaxEvent works after 
upgrading. Very nice:)

Thanks :)

Nino Saturnino Martinez Vazquez Wael wrote:
> Ohh hold on for a minute.. I saw the *WICKET-1199 
> <https://issues.apache.org/jira/browse/WICKET-1199> was fixed.. I'll 
> try to upgrade and see if it fixes the problem...*
>
> Nino Saturnino Martinez Vazquez Wael wrote:
>> Hi
>>
>> How do I test the ajaxbutton?
>>
>> If I try to execute the event I just get an null pointer exeception 
>> like this:
>>         wicketTester.executeAjaxEvent("form:ajaxButton", "onclick");
>>
>> Should I just check if theres ajax present? And the process the form 
>> using the formtester?
>>
>

-- 
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: {wicket 1.3 rc1}testing ajaxbutton...

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Ohh hold on for a minute.. I saw the *WICKET-1199 
<https://issues.apache.org/jira/browse/WICKET-1199> was fixed.. I'll try 
to upgrade and see if it fixes the problem...*

Nino Saturnino Martinez Vazquez Wael wrote:
> Hi
>
> How do I test the ajaxbutton?
>
> If I try to execute the event I just get an null pointer exeception 
> like this:
>         wicketTester.executeAjaxEvent("form:ajaxButton", "onclick");
>
> Should I just check if theres ajax present? And the process the form 
> using the formtester?
>

-- 
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org