I might be a bit late, but I built a few components using your code and I have to say it works pretty good! The only problems I encountered during testing were indeed with Panels. Not only with rerendering Panels, but also with rerendering components within Panels. When our demo app is done we will share this and hopefully we can show a nice Wicket demo using (alpha) partial page rendering.

Marco & Ruud

Juergen Donnerstag wrote:

I tried to find a quick fix already, but I didn't succeed. I haven't
found the right approach yet.

Juergen

On 12/20/05, Ari Suutari <[EMAIL PROTECTED]> wrote:
Hi,

I extended the junit with such a case. And yes, it fails as well.
  If you can find time to look at this before 1.2 it would be great.
  If could try to help too, but so far it looks like I'll have to learn
  more about wicket internals before.


      Ari S.

On 12/19/05, Ari Suutari <[EMAIL PROTECTED]> wrote:
Hi again,

SimplePageTest
contains a test to rerender the Panel, but not a component inside a
Panel, correct? Is that the test you added?
  Sorry, I missed this, but yes, this is specifically the case that seems to 
fail.
  My code is not a junit test case, it is more like a very much trimmed down
  version of the actual application..


      Ari S.

Juergen

On 12/19/05, Ari Suutari <[EMAIL PROTECTED]> wrote:
Ok,

I have now reproduced the problem with simple page. If I have a page, which has 
a panel (with
it's own html template) which contains some tags it is not possible to render 
those panel's tags
via ajax handler from phonebook example.

The difference with full page render and partial render with ajax seems to be 
that
Panel's onRender calls renderAssociatedMarkup, which sets the markupStream for
panel, then renders it's components and sets it back to original stream (which 
is page's stream).

When trying the same via ajax, this is not happening, since the Panel is not 
asked to render, only
one component inside it. Somehow partial rendering code should do the same 
magic as panel
does during it's rendering (ie. the stuff in renderAssociatedMarkup).

  Ari S.


----- Original Message -----
From: "Ari Suutari" <[EMAIL PROTECTED]>
To: <wicket-user@lists.sourceforge.net>
Sent: Monday, December 19, 2005 1:25 PM
Subject: Re: [Wicket-user] How to render part of page (with ajax maybe)


Hi,

I can now report that things mostly work. But there are still some
cases where the page renders ok, but some components don't when
trying to render just a component. My application is already rather complex
(I'm still digging deeper in this), but it looks like that there are cases
where system tries to use invalid markup to render component, which
results in exception or wrong output. I have verified this by debugging to
Component.onRender ->...... -> MarkupStream.setCurrentIndex, after which
stream is at bad position. Good thing is that behaviour is consistent, ie. it is
always the same component/components that don't render themself correctly via 
ajax.

I'm trying to build a simpler test case, if possible.

  Ari S.

----- Original Message -----
From: "Juergen Donnerstag" <[EMAIL PROTECTED]>
To: <wicket-user@lists.sourceforge.net>
Sent: Friday, December 16, 2005 3:44 PM
Subject: Re: [Wicket-user] How to render part of page (with ajax maybe)


That that is true as well. You can not render a component inside a
view, because these component by default get removed onEndRequest for
optimization reason. I think you can avoid it by calling
listView.setOptimizedxxxx()

Juergen

On 12/16/05, Ari Suutari <[EMAIL PROTECTED]> wrote:
Hi,

I did some more testing. Instead of my original case, I tried to render a 
component
hiearchy which is at upper level in my application and it works !

Could the problem in my original case be that the component I'm trying
to render is inside pageable listview ?

  Ari S.

----- Original Message -----
From: "Ari Suutari" <[EMAIL PROTECTED]>
To: <wicket-user@lists.sourceforge.net>
Sent: Friday, December 16, 2005 2:29 PM
Subject: Re: [Wicket-user] How to render part of page (with ajax maybe)


Ok,

(Sorry for horrible formatting of this e-mail)

I took code from AjaxHandler.java to my TestAjaxHandler, so it looks
like this:

import wicket.*;
import wicket.protocol.http.*;
import wicket.protocol.http.servlet.ServletWebRequest;
import wicket.response.StringResponse;
import wicket.util.resource.*;

public class TestAjaxHandler extends AjaxHandler
{
protected String getImplementationId()
{
return "test";
}


protected IResourceStream getResponse()
{
Component[] components = new Component[1];
components[0] = getComponent();

return render(components);
}

public IResourceStream render(final Component[] components)
{

StringBufferResourceStream response = new 
StringBufferResourceStream("text/xml");
response.append("<?xml version='1.0' encoding='utf-8'?>");
response.append("<components>");
if (components != null)
{
 Response resp = new StringResponse();
 RequestCycle requestCycle = RequestCycle.get();
 Response origResponse = requestCycle.getResponse();
 try
 {
  requestCycle.setResponse(resp);
  for (int i=0; i < components.length; i++)
  {
   resp.write("<component cssid=''><![CDATA[");
   Component component = components[i];
   boolean renderBodyOnly = component.getRenderBodyOnly();
   try
   {
    component.setRenderBodyOnly(true);
    component.render();
   }
   catch (Exception ex)
   {
    resp.write(ex.toString());
   }
   finally
   {
    component.setRenderBodyOnly(renderBodyOnly);
   }
   resp.write("]]<component>");
  }
 }
 finally
 {
  requestCycle.setResponse(origResponse);
 }
 response.append(resp.toString());
}
response.append("</components>");

return response;
}
}
-------------------------------

On my panel, I have a Label, like this:

Label l = new Label("ajaxTest");
l.add(new TestAjaxHandler());
add(l);

When I invoke the ajax handler, the xml I got back is:

<?xml version='1.0' encoding='utf-8'?><components><component 
cssid=''><![CDATA[java.lang.IndexOutOfBoundsException:
Index:
28,
Size: 17]]<component></components>

The exception occurs somewhere where markup stream is initialized (I can try to 
debug there is is helpful).
Wicket is compiled from cvs as of today about 14:00 EET.

  Ari S.




----- Original Message -----
From: "Ari Suutari" <[EMAIL PROTECTED]>
To: <wicket-user@lists.sourceforge.net>
Sent: Friday, December 16, 2005 1:38 PM
Subject: Re: [Wicket-user] How to render part of page (with ajax maybe)


Got it.

  Ari S.

----- Original Message -----
From: "Juergen Donnerstag" <[EMAIL PROTECTED]>
To: <wicket-user@lists.sourceforge.net>
Sent: Friday, December 16, 2005 1:35 PM
Subject: Re: [Wicket-user] How to render part of page (with ajax maybe)


Try http://www.wicket-library.com/wicket-phonebook.zip to download it.

Juergen

On 12/16/05, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:
sourceforge is currently blocking all mails with .zip attachments.
I'll make it available for download tonight.

Juergen

On 12/16/05, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:
Please find attached a extended version of the phonebook example which
uses an AjaxHandler to handle the CheckBox and the Counter. Note: this
example is only working with a very recent version of wicket CVS HEAD.
And please note this is a starting point only (which is why it is not
in cvs). It is not a sophisticated solution.

I guess you found the dojo and scriptacoulous examples in wicket-stuff already?

Juergen

On 12/16/05, Ari Suutari <[EMAIL PROTECTED]> wrote:
Hi,

okay I'm kinda lost and I think i'm either doing somehting fundamentally wrong 
or missing something really
stupid......
  Me too. I tried to study the junit test that (re)renders a component, but
  cannot get it working with browser. What I tried was to create AjaxHandler to
  component and attempt to render that component in ajax handler's respond 
method:

protected void respond()
{
RequestCycle cycle = RequestCycle.get();
cycle.setRequestTarget(new ComponentRequestTarget(c));
}

     It spits out following exception:

[http-80-Processor24] ERROR Index: 30, Size: 17
java.lang.IndexOutOfBoundsException: Index: 30, Size: 17
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at java.util.Collections$UnmodifiableList.get(Collections.java:1155)
at wicket.markup.Markup.get(Markup.java:143)
at wicket.markup.MarkupStream.get(MarkupStream.java:324)
at wicket.markup.MarkupStream.setCurrentIndex(MarkupStream.java:202)
at wicket.Component.validateMarkupStream(Component.java:1442)
at wicket.markup.html.panel.Panel.onRender(Panel.java:79)

  When I look at markupStream members in debugger, the don't look like markup 
of my panel.
  I would really appreciate a list of steps required to get a component 
rendered so that
  result goes back to browser. I don't need a complete implementation as I can 
use cvs version
  of wicket and fill in missing parts myself (if they are not of huge) but 
currently I must admit that I don't
  know where to start from.

      Ari S.


this is the error I get when i call someRequestCycle.request(myLabel) .... I 
studied the simplepageTest
rerender
calls, I
created
a ComponentRequestTarget, set the target, and tried a lot of other things...... 
i keep getting the session
error.

10:52:51.477 WARN!! Exception for /dojo/app?path=2:link1&interface=ILinkListener
java.lang.IllegalStateException: Internal Error: Page not attached to session.

the generated page is

<span wicket:id="wid">replaced</span><html>
<head>
<title>Error 500 Internal+Error%3A+Page+not+attached+to+session</title>
</head>
<body>
<h2>HTTP ERROR: 500 Internal+Error%3A+Page+not+attached+to+session</h2>
<p>RequestURI=/dojo/app</p>
<p><i><small><a href="http://jetty.mortbay.org";>Powered by 
Jetty://</a></small></i></p>
                                                                               
</body>
</html>



Eelco Hillenius wrote:

Yeah. I'm just saying that you /should/ work with request targets
instead of trying to render the component directly.

Eelco

On 12/2/05, Johan Compagner <[EMAIL PROTECTED]> wrote:

that is what RequestCycle.request(component) does (and how the
SimplePageTest works)


On 12/2/05, Eelco Hillenius < [EMAIL PROTECTED]> wrote:

you should use requestcycle.setResponseTarget with ComponentRequestTarget

Eelco

On 12/2/05, Marco van de Haar <[EMAIL PROTECTED]> wrote:

Is there any concrete (simple) code example for rerendering a part of a
page? I tried myRequestCycle.request(myComponent), but all I got were
huge errors in my console.


Ari Suutari wrote:


Hi,


Project wicket-stuff contains already some AJAX components
(scriptaculous and dojo based ones). Wicket core contain a

AjaxHandler

and we provide a yet experimental component level re-render
(requestcycle.render(component). Though the latter one is no yet
accessible through a URL (that piece of code is missing; we've only
tested it with junit tests). So, yes some parts have been done, it is
not ready yet, but I think we are on a good way and some features can
be used already. Because it is in an dev stage, feedback is very much
welcome.

 So, If I create my own component (that I'm going to re-render
 with ajax) and add an interface based on IRequestListener I
 could build an URL that calls my component via that interface
 and returns re-rendering of component using
requestcycle.render(this) ?

 Or is there a better way ? I took a look how IOnChangeListener is
 implemented on DropDownChoice and it looks rather simple to
 implement such a thing (although DropDownChoice uses it
 for different purposes)

     Ari S.


Juergen

On 11/25/05, Ari Suutari < [EMAIL PROTECTED]> wrote:


Hi,

We are developing applications, which have kind of a content 'push'
system,
ie. data arrives from factory automation and we visualize it

on-line.

Our traditional approach to this has been to send the data to

browser

(via applet and additional tcp socket) and use javascript to render

it.

However, I'm a little bit tempted to adjust our architecture so that
we would only push a notification of change and then use ajax
to re-render part of page.

Would it be possible with wicket ? Typically, the part that
would be re-rendered with ajax is just a text field or a table
(rendering whole page is too slow, since the data rate
can be quite fast; also flashes too much for slower cases).

There was some discussion on mailing list that something like
this would be in 1.2 ?

 Ari S.







-------------------------------------------------------

This SF.net email is sponsored by: Splunk Inc. Do you grep through
log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD

SPLUNK!

http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click

_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net


https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------

This SF.net email is sponsored by: Splunk Inc. Do you grep through
log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD

SPLUNK!

http://ads.osdn.com/?ad_idv37&alloc_id865&op�k
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net


https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------

This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD

SPLUNK!

http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net


https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log

files

for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net


https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log

files

for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op�k
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op�k
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op�k
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

ӆ+޵隊X'uJnB'sʋm.hz讚nWã [EMAIL PROTECTED], 
a{34#Pivr~jYhsrGf)+-Z'$z+-(~{޶mXy+zlX)ߣ"rG



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&opk
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

ӆ+޵隊X'uJnB'sʋm.hz讚nWã [EMAIL PROTECTED], 
a{34#Pivr~jYhsrGf)+-Z'$z+-(~{޶mXy+zlX)ߣ"rG



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

ӆ+޵隊X'uJnB'sʋm.hz讚nWã [EMAIL PROTECTED], 
a{34#Pivr~jYhsrGf)+-Z'$z+-(~{޶mXy+zlX)ߣ"rG



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

N�HY޵隊X���'���u���[�������
ަ�k��!���W�~�鮆�zk��C� [EMAIL PROTECTED],���a{�
�,�H��4�m���i�(��ܢo�v'��jYhr'ׯ:�rX��h���n���j)b�    
b�բrG��ǫ�+-��.�ǟ����a��l��b��,���y�+��޷�b��?�+-�w�����nser=




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to