You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Mike Mander <wi...@gmx.de> on 2011/07/12 14:14:51 UTC
Why is stateless from making my page stateful?
Hi,
i use a page with a border. I add a panel with a stateless form to the
border and the page gets stateful. Why?
The symtoms are - NotSerializableExceptions and RuntimeException if i
click the submit.
Form action:
../../../../Overview.html/gdw_exact/Party/of/47/wicket:interface/:0:ambiance:search:searchSlot::IFormSubmitListener::
I'm definitly doing something stupid, but i can't see what. Maybe
someone can point me to a doc or something.
Thanks
Mike
ShopBorder.java
<code>
public class ShopBorder extends Border {
public ShopBorder(String id) {
super(id);
add(searchSlot());
}
private Component searchSlot() {
return new SearchSlot("search") {
@Override
protected void setSearchterm(String searchterm) {
getPage().getPageParameters().put("sTerm", searchterm);
setResponsePage(getPage().getClass(),
getPage().getPageParameters());
};
};
}
}
</code>
SearchSlot.java
<code>
public abstract class SearchSlot extends Panel {
public SearchSlot(String id) {
super(id);
IModel<String> term = new Model<String>();
StatelessForm<String> form = new
StatelessForm<String>("searchSlot", term) {
@Override
protected void onSubmit() {
setSearchterm(getModelObject());
super.onSubmit();
}
};
form.add(new TextField<String>("searchTerm", term));
form.add(new ImageButton("doSearch", new
CompressedResourceReference(WicketApplication.class, "res/img/go.png")));
add(form);
}
protected abstract void setSearchterm(String searchterm);
}
</code>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Why is stateless from making my page stateful?
Posted by Martin Grigorov <mg...@apache.org>.
It should be the same. Just some minor naming changes.
On Thu, Jul 14, 2011 at 3:06 PM, Mike Mander <wi...@gmx.de> wrote:
> Thanks Martin,
>
> SharedResourceReference and your solution seems to be 1.5. I'm using 1.4.17.
> Is there something for 1.4.x?
>
> Mike
>
>
>> That's why we have examples :
>>
>> http://www.wicket-library.com/wicket-examples/images/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage?SourcesPage_class=org.apache.wicket.examples.images.Home&source=ImagesApplication.java
>>
>> If this doesn't help then do something like:
>>
>> WebComponent img = new WebComponent("img");
>> CharSequence url = urlFor(new PackageResourceReference(Some.class,
>> "some.png"));
>> img.add(AttributeModifier.append("src", url));
>>
>>
>> On Thu, Jul 14, 2011 at 2:44 PM, Mike Mander<wi...@gmx.de> wrote:
>>>
>>> Hello again,
>>>
>>> call me stupid, but i don't get it (ImageButton loading shared image
>>> resource). What i did so far is:
>>> Application.init()
>>> <code>
>>> String key = new CompressedResourceReference(WicketApplication.class,
>>> "res/img/search_go.png").getSharedResourceKey();
>>> mountSharedResource("img/search_go.png", key);
>>> </code>
>>>
>>> MyComponent.<init>
>>> form.add(new ImageButton("doSearch", new
>>> ResourceReference("img/search_go.png")));
>>>
>>> MyComponent.html
>>> <input wicket:id="doSearch" type="image" name="submit" class="submit" />
>>>
>>> But the statelessChecker still complains on my ImageButton:
>>>
>>> Root cause:
>>>
>>> java.lang.IllegalArgumentException: '[Page class = HomePage, id = 0,
>>> version
>>> = 0]' claims to be stateless but isn't. Offending component:
>>> [MarkupContainer [Component id = doSearch, page = HomePage, path =
>>> 0:ambiance:search:searchSlot:doSearch.ImageButton, isVisible = true,
>>> isVersioned = true]]
>>> at
>>>
>>> org.apache.wicket.devutils.stateless.StatelessChecker.onBeforeRender(StatelessChecker.java:98)
>>> at
>>>
>>> org.apache.wicket.Application.notifyPostComponentOnBeforeRenderListeners(Application.java:1202)
>>> at org.apache.wicket.Component.internalBeforeRender(Component.java:1067)
>>>
>>> I couldn't find any doc for adding an image to shared resources and use
>>> it
>>> by component.
>>>
>>> Can someone please help me out here?
>>> Thanks
>>> Mike
>>>
>>>> by making them shared ?!
>>>>
>>>> On Tue, Jul 12, 2011 at 3:55 PM, Mike Mander<wi...@gmx.de>
>>>> wrote:
>>>>>
>>>>> Thanks Martin for the dev-utils hint. You're right for my problem.
>>>>> It seems that all my images have the statelessHint = false.
>>>>>
>>>>> But: How can i make my image resource references stateless?
>>>>>
>>>>> Thanks
>>>>> Mike
>>>>>
>>>>>> I think ImageButton is the component that makes it stateful.
>>>>>>
>>>>>> To be sure use wicket-devutils, annotate the page with
>>>>>> @StatelessComponent and add StatelessChecker as
>>>>>> IComponentOnBeforeRenderListener in your application.
>>>>>>
>>>>>> On Tue, Jul 12, 2011 at 2:14 PM, Mike Mander<wi...@gmx.de>
>>>>>> wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> i use a page with a border. I add a panel with a stateless form to
>>>>>>> the
>>>>>>> border and the page gets stateful. Why?
>>>>>>> The symtoms are - NotSerializableExceptions and RuntimeException if i
>>>>>>> click
>>>>>>> the submit.
>>>>>>> Form action:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ../../../../Overview.html/gdw_exact/Party/of/47/wicket:interface/:0:ambiance:search:searchSlot::IFormSubmitListener::
>>>>>>>
>>>>>>> I'm definitly doing something stupid, but i can't see what. Maybe
>>>>>>> someone
>>>>>>> can point me to a doc or something.
>>>>>>>
>>>>>>> Thanks
>>>>>>> Mike
>>>>>>>
>>>>>>> ShopBorder.java
>>>>>>> <code>
>>>>>>> public class ShopBorder extends Border {
>>>>>>>
>>>>>>> public ShopBorder(String id) {
>>>>>>> super(id);
>>>>>>> add(searchSlot());
>>>>>>> }
>>>>>>>
>>>>>>> private Component searchSlot() {
>>>>>>> return new SearchSlot("search") {
>>>>>>> @Override
>>>>>>> protected void setSearchterm(String searchterm) {
>>>>>>> getPage().getPageParameters().put("sTerm",
>>>>>>> searchterm);
>>>>>>> setResponsePage(getPage().getClass(),
>>>>>>> getPage().getPageParameters());
>>>>>>> };
>>>>>>> };
>>>>>>> }
>>>>>>> }
>>>>>>> </code>
>>>>>>>
>>>>>>> SearchSlot.java
>>>>>>> <code>
>>>>>>> public abstract class SearchSlot extends Panel {
>>>>>>>
>>>>>>> public SearchSlot(String id) {
>>>>>>> super(id);
>>>>>>> IModel<String> term = new Model<String>();
>>>>>>> StatelessForm<String> form = new
>>>>>>> StatelessForm<String>("searchSlot",
>>>>>>> term) {
>>>>>>> @Override
>>>>>>> protected void onSubmit() {
>>>>>>> setSearchterm(getModelObject());
>>>>>>> super.onSubmit();
>>>>>>> }
>>>>>>> };
>>>>>>> form.add(new TextField<String>("searchTerm", term));
>>>>>>> form.add(new ImageButton("doSearch", new
>>>>>>> CompressedResourceReference(WicketApplication.class,
>>>>>>> "res/img/go.png")));
>>>>>>> add(form);
>>>>>>> }
>>>>>>>
>>>>>>> protected abstract void setSearchterm(String searchterm);
>>>>>>> }
>>>>>>> </code>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Why is stateless from making my page stateful?
Posted by Mike Mander <wi...@gmx.de>.
Thanks Martin,
SharedResourceReference and your solution seems to be 1.5. I'm using
1.4.17. Is there something for 1.4.x?
Mike
> That's why we have examples :
> http://www.wicket-library.com/wicket-examples/images/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage?SourcesPage_class=org.apache.wicket.examples.images.Home&source=ImagesApplication.java
>
> If this doesn't help then do something like:
>
> WebComponent img = new WebComponent("img");
> CharSequence url = urlFor(new PackageResourceReference(Some.class, "some.png"));
> img.add(AttributeModifier.append("src", url));
>
>
> On Thu, Jul 14, 2011 at 2:44 PM, Mike Mander<wi...@gmx.de> wrote:
>> Hello again,
>>
>> call me stupid, but i don't get it (ImageButton loading shared image
>> resource). What i did so far is:
>> Application.init()
>> <code>
>> String key = new CompressedResourceReference(WicketApplication.class,
>> "res/img/search_go.png").getSharedResourceKey();
>> mountSharedResource("img/search_go.png", key);
>> </code>
>>
>> MyComponent.<init>
>> form.add(new ImageButton("doSearch", new
>> ResourceReference("img/search_go.png")));
>>
>> MyComponent.html
>> <input wicket:id="doSearch" type="image" name="submit" class="submit" />
>>
>> But the statelessChecker still complains on my ImageButton:
>>
>> Root cause:
>>
>> java.lang.IllegalArgumentException: '[Page class = HomePage, id = 0, version
>> = 0]' claims to be stateless but isn't. Offending component:
>> [MarkupContainer [Component id = doSearch, page = HomePage, path =
>> 0:ambiance:search:searchSlot:doSearch.ImageButton, isVisible = true,
>> isVersioned = true]]
>> at
>> org.apache.wicket.devutils.stateless.StatelessChecker.onBeforeRender(StatelessChecker.java:98)
>> at
>> org.apache.wicket.Application.notifyPostComponentOnBeforeRenderListeners(Application.java:1202)
>> at org.apache.wicket.Component.internalBeforeRender(Component.java:1067)
>>
>> I couldn't find any doc for adding an image to shared resources and use it
>> by component.
>>
>> Can someone please help me out here?
>> Thanks
>> Mike
>>
>>> by making them shared ?!
>>>
>>> On Tue, Jul 12, 2011 at 3:55 PM, Mike Mander<wi...@gmx.de> wrote:
>>>> Thanks Martin for the dev-utils hint. You're right for my problem.
>>>> It seems that all my images have the statelessHint = false.
>>>>
>>>> But: How can i make my image resource references stateless?
>>>>
>>>> Thanks
>>>> Mike
>>>>
>>>>> I think ImageButton is the component that makes it stateful.
>>>>>
>>>>> To be sure use wicket-devutils, annotate the page with
>>>>> @StatelessComponent and add StatelessChecker as
>>>>> IComponentOnBeforeRenderListener in your application.
>>>>>
>>>>> On Tue, Jul 12, 2011 at 2:14 PM, Mike Mander<wi...@gmx.de>
>>>>> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> i use a page with a border. I add a panel with a stateless form to the
>>>>>> border and the page gets stateful. Why?
>>>>>> The symtoms are - NotSerializableExceptions and RuntimeException if i
>>>>>> click
>>>>>> the submit.
>>>>>> Form action:
>>>>>>
>>>>>>
>>>>>> ../../../../Overview.html/gdw_exact/Party/of/47/wicket:interface/:0:ambiance:search:searchSlot::IFormSubmitListener::
>>>>>>
>>>>>> I'm definitly doing something stupid, but i can't see what. Maybe
>>>>>> someone
>>>>>> can point me to a doc or something.
>>>>>>
>>>>>> Thanks
>>>>>> Mike
>>>>>>
>>>>>> ShopBorder.java
>>>>>> <code>
>>>>>> public class ShopBorder extends Border {
>>>>>>
>>>>>> public ShopBorder(String id) {
>>>>>> super(id);
>>>>>> add(searchSlot());
>>>>>> }
>>>>>>
>>>>>> private Component searchSlot() {
>>>>>> return new SearchSlot("search") {
>>>>>> @Override
>>>>>> protected void setSearchterm(String searchterm) {
>>>>>> getPage().getPageParameters().put("sTerm", searchterm);
>>>>>> setResponsePage(getPage().getClass(),
>>>>>> getPage().getPageParameters());
>>>>>> };
>>>>>> };
>>>>>> }
>>>>>> }
>>>>>> </code>
>>>>>>
>>>>>> SearchSlot.java
>>>>>> <code>
>>>>>> public abstract class SearchSlot extends Panel {
>>>>>>
>>>>>> public SearchSlot(String id) {
>>>>>> super(id);
>>>>>> IModel<String> term = new Model<String>();
>>>>>> StatelessForm<String> form = new
>>>>>> StatelessForm<String>("searchSlot",
>>>>>> term) {
>>>>>> @Override
>>>>>> protected void onSubmit() {
>>>>>> setSearchterm(getModelObject());
>>>>>> super.onSubmit();
>>>>>> }
>>>>>> };
>>>>>> form.add(new TextField<String>("searchTerm", term));
>>>>>> form.add(new ImageButton("doSearch", new
>>>>>> CompressedResourceReference(WicketApplication.class,
>>>>>> "res/img/go.png")));
>>>>>> add(form);
>>>>>> }
>>>>>>
>>>>>> protected abstract void setSearchterm(String searchterm);
>>>>>> }
>>>>>> </code>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Why is stateless from making my page stateful?
Posted by Martin Grigorov <mg...@apache.org>.
That's why we have examples :
http://www.wicket-library.com/wicket-examples/images/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage?SourcesPage_class=org.apache.wicket.examples.images.Home&source=ImagesApplication.java
If this doesn't help then do something like:
WebComponent img = new WebComponent("img");
CharSequence url = urlFor(new PackageResourceReference(Some.class, "some.png"));
img.add(AttributeModifier.append("src", url));
On Thu, Jul 14, 2011 at 2:44 PM, Mike Mander <wi...@gmx.de> wrote:
> Hello again,
>
> call me stupid, but i don't get it (ImageButton loading shared image
> resource). What i did so far is:
> Application.init()
> <code>
> String key = new CompressedResourceReference(WicketApplication.class,
> "res/img/search_go.png").getSharedResourceKey();
> mountSharedResource("img/search_go.png", key);
> </code>
>
> MyComponent.<init>
> form.add(new ImageButton("doSearch", new
> ResourceReference("img/search_go.png")));
>
> MyComponent.html
> <input wicket:id="doSearch" type="image" name="submit" class="submit" />
>
> But the statelessChecker still complains on my ImageButton:
>
> Root cause:
>
> java.lang.IllegalArgumentException: '[Page class = HomePage, id = 0, version
> = 0]' claims to be stateless but isn't. Offending component:
> [MarkupContainer [Component id = doSearch, page = HomePage, path =
> 0:ambiance:search:searchSlot:doSearch.ImageButton, isVisible = true,
> isVersioned = true]]
> at
> org.apache.wicket.devutils.stateless.StatelessChecker.onBeforeRender(StatelessChecker.java:98)
> at
> org.apache.wicket.Application.notifyPostComponentOnBeforeRenderListeners(Application.java:1202)
> at org.apache.wicket.Component.internalBeforeRender(Component.java:1067)
>
> I couldn't find any doc for adding an image to shared resources and use it
> by component.
>
> Can someone please help me out here?
> Thanks
> Mike
>
>> by making them shared ?!
>>
>> On Tue, Jul 12, 2011 at 3:55 PM, Mike Mander<wi...@gmx.de> wrote:
>>>
>>> Thanks Martin for the dev-utils hint. You're right for my problem.
>>> It seems that all my images have the statelessHint = false.
>>>
>>> But: How can i make my image resource references stateless?
>>>
>>> Thanks
>>> Mike
>>>
>>>> I think ImageButton is the component that makes it stateful.
>>>>
>>>> To be sure use wicket-devutils, annotate the page with
>>>> @StatelessComponent and add StatelessChecker as
>>>> IComponentOnBeforeRenderListener in your application.
>>>>
>>>> On Tue, Jul 12, 2011 at 2:14 PM, Mike Mander<wi...@gmx.de>
>>>> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> i use a page with a border. I add a panel with a stateless form to the
>>>>> border and the page gets stateful. Why?
>>>>> The symtoms are - NotSerializableExceptions and RuntimeException if i
>>>>> click
>>>>> the submit.
>>>>> Form action:
>>>>>
>>>>>
>>>>> ../../../../Overview.html/gdw_exact/Party/of/47/wicket:interface/:0:ambiance:search:searchSlot::IFormSubmitListener::
>>>>>
>>>>> I'm definitly doing something stupid, but i can't see what. Maybe
>>>>> someone
>>>>> can point me to a doc or something.
>>>>>
>>>>> Thanks
>>>>> Mike
>>>>>
>>>>> ShopBorder.java
>>>>> <code>
>>>>> public class ShopBorder extends Border {
>>>>>
>>>>> public ShopBorder(String id) {
>>>>> super(id);
>>>>> add(searchSlot());
>>>>> }
>>>>>
>>>>> private Component searchSlot() {
>>>>> return new SearchSlot("search") {
>>>>> @Override
>>>>> protected void setSearchterm(String searchterm) {
>>>>> getPage().getPageParameters().put("sTerm", searchterm);
>>>>> setResponsePage(getPage().getClass(),
>>>>> getPage().getPageParameters());
>>>>> };
>>>>> };
>>>>> }
>>>>> }
>>>>> </code>
>>>>>
>>>>> SearchSlot.java
>>>>> <code>
>>>>> public abstract class SearchSlot extends Panel {
>>>>>
>>>>> public SearchSlot(String id) {
>>>>> super(id);
>>>>> IModel<String> term = new Model<String>();
>>>>> StatelessForm<String> form = new
>>>>> StatelessForm<String>("searchSlot",
>>>>> term) {
>>>>> @Override
>>>>> protected void onSubmit() {
>>>>> setSearchterm(getModelObject());
>>>>> super.onSubmit();
>>>>> }
>>>>> };
>>>>> form.add(new TextField<String>("searchTerm", term));
>>>>> form.add(new ImageButton("doSearch", new
>>>>> CompressedResourceReference(WicketApplication.class,
>>>>> "res/img/go.png")));
>>>>> add(form);
>>>>> }
>>>>>
>>>>> protected abstract void setSearchterm(String searchterm);
>>>>> }
>>>>> </code>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Why is stateless from making my page stateful?
Posted by Mike Mander <wi...@gmx.de>.
Hello again,
call me stupid, but i don't get it (ImageButton loading shared image
resource). What i did so far is:
Application.init()
<code>
String key = new CompressedResourceReference(WicketApplication.class,
"res/img/search_go.png").getSharedResourceKey();
mountSharedResource("img/search_go.png", key);
</code>
MyComponent.<init>
form.add(new ImageButton("doSearch", new
ResourceReference("img/search_go.png")));
MyComponent.html
<input wicket:id="doSearch" type="image" name="submit" class="submit" />
But the statelessChecker still complains on my ImageButton:
Root cause:
java.lang.IllegalArgumentException: '[Page class = HomePage, id = 0,
version = 0]' claims to be stateless but isn't. Offending component:
[MarkupContainer [Component id = doSearch, page = HomePage, path =
0:ambiance:search:searchSlot:doSearch.ImageButton, isVisible = true,
isVersioned = true]]
at
org.apache.wicket.devutils.stateless.StatelessChecker.onBeforeRender(StatelessChecker.java:98)
at
org.apache.wicket.Application.notifyPostComponentOnBeforeRenderListeners(Application.java:1202)
at org.apache.wicket.Component.internalBeforeRender(Component.java:1067)
I couldn't find any doc for adding an image to shared resources and use
it by component.
Can someone please help me out here?
Thanks
Mike
> by making them shared ?!
>
> On Tue, Jul 12, 2011 at 3:55 PM, Mike Mander<wi...@gmx.de> wrote:
>> Thanks Martin for the dev-utils hint. You're right for my problem.
>> It seems that all my images have the statelessHint = false.
>>
>> But: How can i make my image resource references stateless?
>>
>> Thanks
>> Mike
>>
>>> I think ImageButton is the component that makes it stateful.
>>>
>>> To be sure use wicket-devutils, annotate the page with
>>> @StatelessComponent and add StatelessChecker as
>>> IComponentOnBeforeRenderListener in your application.
>>>
>>> On Tue, Jul 12, 2011 at 2:14 PM, Mike Mander<wi...@gmx.de> wrote:
>>>> Hi,
>>>>
>>>> i use a page with a border. I add a panel with a stateless form to the
>>>> border and the page gets stateful. Why?
>>>> The symtoms are - NotSerializableExceptions and RuntimeException if i
>>>> click
>>>> the submit.
>>>> Form action:
>>>>
>>>> ../../../../Overview.html/gdw_exact/Party/of/47/wicket:interface/:0:ambiance:search:searchSlot::IFormSubmitListener::
>>>>
>>>> I'm definitly doing something stupid, but i can't see what. Maybe someone
>>>> can point me to a doc or something.
>>>>
>>>> Thanks
>>>> Mike
>>>>
>>>> ShopBorder.java
>>>> <code>
>>>> public class ShopBorder extends Border {
>>>>
>>>> public ShopBorder(String id) {
>>>> super(id);
>>>> add(searchSlot());
>>>> }
>>>>
>>>> private Component searchSlot() {
>>>> return new SearchSlot("search") {
>>>> @Override
>>>> protected void setSearchterm(String searchterm) {
>>>> getPage().getPageParameters().put("sTerm", searchterm);
>>>> setResponsePage(getPage().getClass(),
>>>> getPage().getPageParameters());
>>>> };
>>>> };
>>>> }
>>>> }
>>>> </code>
>>>>
>>>> SearchSlot.java
>>>> <code>
>>>> public abstract class SearchSlot extends Panel {
>>>>
>>>> public SearchSlot(String id) {
>>>> super(id);
>>>> IModel<String> term = new Model<String>();
>>>> StatelessForm<String> form = new
>>>> StatelessForm<String>("searchSlot",
>>>> term) {
>>>> @Override
>>>> protected void onSubmit() {
>>>> setSearchterm(getModelObject());
>>>> super.onSubmit();
>>>> }
>>>> };
>>>> form.add(new TextField<String>("searchTerm", term));
>>>> form.add(new ImageButton("doSearch", new
>>>> CompressedResourceReference(WicketApplication.class, "res/img/go.png")));
>>>> add(form);
>>>> }
>>>>
>>>> protected abstract void setSearchterm(String searchterm);
>>>> }
>>>> </code>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Why is stateless from making my page stateful?
Posted by Martin Grigorov <mg...@apache.org>.
by making them shared ?!
On Tue, Jul 12, 2011 at 3:55 PM, Mike Mander <wi...@gmx.de> wrote:
> Thanks Martin for the dev-utils hint. You're right for my problem.
> It seems that all my images have the statelessHint = false.
>
> But: How can i make my image resource references stateless?
>
> Thanks
> Mike
>
>> I think ImageButton is the component that makes it stateful.
>>
>> To be sure use wicket-devutils, annotate the page with
>> @StatelessComponent and add StatelessChecker as
>> IComponentOnBeforeRenderListener in your application.
>>
>> On Tue, Jul 12, 2011 at 2:14 PM, Mike Mander<wi...@gmx.de> wrote:
>>>
>>> Hi,
>>>
>>> i use a page with a border. I add a panel with a stateless form to the
>>> border and the page gets stateful. Why?
>>> The symtoms are - NotSerializableExceptions and RuntimeException if i
>>> click
>>> the submit.
>>> Form action:
>>>
>>> ../../../../Overview.html/gdw_exact/Party/of/47/wicket:interface/:0:ambiance:search:searchSlot::IFormSubmitListener::
>>>
>>> I'm definitly doing something stupid, but i can't see what. Maybe someone
>>> can point me to a doc or something.
>>>
>>> Thanks
>>> Mike
>>>
>>> ShopBorder.java
>>> <code>
>>> public class ShopBorder extends Border {
>>>
>>> public ShopBorder(String id) {
>>> super(id);
>>> add(searchSlot());
>>> }
>>>
>>> private Component searchSlot() {
>>> return new SearchSlot("search") {
>>> @Override
>>> protected void setSearchterm(String searchterm) {
>>> getPage().getPageParameters().put("sTerm", searchterm);
>>> setResponsePage(getPage().getClass(),
>>> getPage().getPageParameters());
>>> };
>>> };
>>> }
>>> }
>>> </code>
>>>
>>> SearchSlot.java
>>> <code>
>>> public abstract class SearchSlot extends Panel {
>>>
>>> public SearchSlot(String id) {
>>> super(id);
>>> IModel<String> term = new Model<String>();
>>> StatelessForm<String> form = new
>>> StatelessForm<String>("searchSlot",
>>> term) {
>>> @Override
>>> protected void onSubmit() {
>>> setSearchterm(getModelObject());
>>> super.onSubmit();
>>> }
>>> };
>>> form.add(new TextField<String>("searchTerm", term));
>>> form.add(new ImageButton("doSearch", new
>>> CompressedResourceReference(WicketApplication.class, "res/img/go.png")));
>>> add(form);
>>> }
>>>
>>> protected abstract void setSearchterm(String searchterm);
>>> }
>>> </code>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Why is stateless from making my page stateful?
Posted by Mike Mander <wi...@gmx.de>.
Thanks Martin for the dev-utils hint. You're right for my problem.
It seems that all my images have the statelessHint = false.
But: How can i make my image resource references stateless?
Thanks
Mike
> I think ImageButton is the component that makes it stateful.
>
> To be sure use wicket-devutils, annotate the page with
> @StatelessComponent and add StatelessChecker as
> IComponentOnBeforeRenderListener in your application.
>
> On Tue, Jul 12, 2011 at 2:14 PM, Mike Mander<wi...@gmx.de> wrote:
>> Hi,
>>
>> i use a page with a border. I add a panel with a stateless form to the
>> border and the page gets stateful. Why?
>> The symtoms are - NotSerializableExceptions and RuntimeException if i click
>> the submit.
>> Form action:
>> ../../../../Overview.html/gdw_exact/Party/of/47/wicket:interface/:0:ambiance:search:searchSlot::IFormSubmitListener::
>>
>> I'm definitly doing something stupid, but i can't see what. Maybe someone
>> can point me to a doc or something.
>>
>> Thanks
>> Mike
>>
>> ShopBorder.java
>> <code>
>> public class ShopBorder extends Border {
>>
>> public ShopBorder(String id) {
>> super(id);
>> add(searchSlot());
>> }
>>
>> private Component searchSlot() {
>> return new SearchSlot("search") {
>> @Override
>> protected void setSearchterm(String searchterm) {
>> getPage().getPageParameters().put("sTerm", searchterm);
>> setResponsePage(getPage().getClass(),
>> getPage().getPageParameters());
>> };
>> };
>> }
>> }
>> </code>
>>
>> SearchSlot.java
>> <code>
>> public abstract class SearchSlot extends Panel {
>>
>> public SearchSlot(String id) {
>> super(id);
>> IModel<String> term = new Model<String>();
>> StatelessForm<String> form = new StatelessForm<String>("searchSlot",
>> term) {
>> @Override
>> protected void onSubmit() {
>> setSearchterm(getModelObject());
>> super.onSubmit();
>> }
>> };
>> form.add(new TextField<String>("searchTerm", term));
>> form.add(new ImageButton("doSearch", new
>> CompressedResourceReference(WicketApplication.class, "res/img/go.png")));
>> add(form);
>> }
>>
>> protected abstract void setSearchterm(String searchterm);
>> }
>> </code>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Why is stateless from making my page stateful?
Posted by Martin Grigorov <mg...@apache.org>.
I think ImageButton is the component that makes it stateful.
To be sure use wicket-devutils, annotate the page with
@StatelessComponent and add StatelessChecker as
IComponentOnBeforeRenderListener in your application.
On Tue, Jul 12, 2011 at 2:14 PM, Mike Mander <wi...@gmx.de> wrote:
> Hi,
>
> i use a page with a border. I add a panel with a stateless form to the
> border and the page gets stateful. Why?
> The symtoms are - NotSerializableExceptions and RuntimeException if i click
> the submit.
> Form action:
> ../../../../Overview.html/gdw_exact/Party/of/47/wicket:interface/:0:ambiance:search:searchSlot::IFormSubmitListener::
>
> I'm definitly doing something stupid, but i can't see what. Maybe someone
> can point me to a doc or something.
>
> Thanks
> Mike
>
> ShopBorder.java
> <code>
> public class ShopBorder extends Border {
>
> public ShopBorder(String id) {
> super(id);
> add(searchSlot());
> }
>
> private Component searchSlot() {
> return new SearchSlot("search") {
> @Override
> protected void setSearchterm(String searchterm) {
> getPage().getPageParameters().put("sTerm", searchterm);
> setResponsePage(getPage().getClass(),
> getPage().getPageParameters());
> };
> };
> }
> }
> </code>
>
> SearchSlot.java
> <code>
> public abstract class SearchSlot extends Panel {
>
> public SearchSlot(String id) {
> super(id);
> IModel<String> term = new Model<String>();
> StatelessForm<String> form = new StatelessForm<String>("searchSlot",
> term) {
> @Override
> protected void onSubmit() {
> setSearchterm(getModelObject());
> super.onSubmit();
> }
> };
> form.add(new TextField<String>("searchTerm", term));
> form.add(new ImageButton("doSearch", new
> CompressedResourceReference(WicketApplication.class, "res/img/go.png")));
> add(form);
> }
>
> protected abstract void setSearchterm(String searchterm);
> }
> </code>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org