You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by simon <si...@redbend.com> on 2011/01/06 10:34:06 UTC

How to render only part of a Page (and return only that part)

Hi,
I’m trying to render only part of my Page and only that part should return
to the client (the browser). 
Currently, my page consists of logo bar, menu bar, bread crumbs bar and some
div that contains the actual page content, say within <div
wicket:id=”content”>.  (Actually I’m using the an “inheritance” model: a
base page for all pages and each page implements its <wicket:child /> code) 
What I’m trying to do is to return to the browser only the content within
the <wicket:child /> without the logo or menu bar. 
I was struggling with a solution (although I’m not a newbie with Wicket),
Maybe I have to do something with RequestCycle/ Response? 
(BTW: this behavior is desirable not all the time, only in the case that the
request consists some parameter that I should decide) 
Any idea? reference? 
Thanks a lot for any input. 


-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-render-only-part-of-a-Page-and-return-only-that-part-tp3177106p3177106.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: How to render only part of a Page (and return only that part)

Posted by simon <si...@redbend.com>.
Thanks a lot. I will try this (along with 'Martin Grigorov-4' suggestion)

Thank you.
Simon
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-render-only-part-of-a-Page-and-return-only-that-part-tp3177106p3177345.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: How to render only part of a Page (and return only that part)

Posted by Pedro Santos <pe...@gmail.com>.
Also your page can override the onBeforeRender, test the request for some
special parameter, iterate over all components testing they for any
visibility rule, and set visibility to false when this test fails.
Intercept the generated HTML to do that is not an light solution. I don't
think also that use authorization interfaces implies in to annotate all your
components, only those that may be not visible due some authorization
restriction (or yours as suggested).

On Thu, Jan 6, 2011 at 10:20 AM, simon <si...@redbend.com> wrote:

>
> Thanks, it's an idea...
> BUT I would rather prefer to think on a more "light" solution, i.e. Instead
> causing all components (except the frame/div I'd to render) invisible (via
> Action.RENDER mechanism), I think on something like:
> 1. Get the markup (the result html of the response) of the component I
> would
> like to return to the client.
> 2. Ingest (clear content before) that content into the response.
> This way I eliminating all components and leaving only my component to be
> rendered.
> In your solution I have to put the anniotation/tag on ALL the components.
> one by one by one...
> In the example of wicket-examples, they were using ti disable/hide only one
> component..
>
> Thanks :)
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-render-only-part-of-a-Page-and-return-only-that-part-tp3177106p3177319.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Pedro Henrique Oliveira dos Santos

Re: How to render only part of a Page (and return only that part)

Posted by simon <si...@redbend.com>.
mmm.. THANKS!!
That lokks somehow promising... - I will try this and Pedro Santos
suggestion.

10X!
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-render-only-part-of-a-Page-and-return-only-that-part-tp3177106p3177343.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: How to render only part of a Page (and return only that part)

Posted by Martin Grigorov <mg...@apache.org>.
See IResponseFilter
With this you can modify the final .html response for the page. Release you
regex skills and do whatever you need :-)

On Thu, Jan 6, 2011 at 1:20 PM, simon <si...@redbend.com> wrote:

>
> Thanks, it's an idea...
> BUT I would rather prefer to think on a more "light" solution, i.e. Instead
> causing all components (except the frame/div I'd to render) invisible (via
> Action.RENDER mechanism), I think on something like:
> 1. Get the markup (the result html of the response) of the component I
> would
> like to return to the client.
> 2. Ingest (clear content before) that content into the response.
> This way I eliminating all components and leaving only my component to be
> rendered.
> In your solution I have to put the anniotation/tag on ALL the components.
> one by one by one...
> In the example of wicket-examples, they were using ti disable/hide only one
> component..
>
> Thanks :)
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-render-only-part-of-a-Page-and-return-only-that-part-tp3177106p3177319.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: How to render only part of a Page (and return only that part)

Posted by simon <si...@redbend.com>.
Thanks, it's an idea...
BUT I would rather prefer to think on a more "light" solution, i.e. Instead
causing all components (except the frame/div I'd to render) invisible (via
Action.RENDER mechanism), I think on something like:
1. Get the markup (the result html of the response) of the component I would
like to return to the client.
2. Ingest (clear content before) that content into the response.
This way I eliminating all components and leaving only my component to be
rendered.
In your solution I have to put the anniotation/tag on ALL the components.
one by one by one...
In the example of wicket-examples, they were using ti disable/hide only one
component..

Thanks :)
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-render-only-part-of-a-Page-and-return-only-that-part-tp3177106p3177319.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: How to render only part of a Page (and return only that part)

Posted by Martin Grigorov <mg...@apache.org>.
See authorization interfaces.
You can disable rendering of a component (see Component Action.RENDER).
Most of the examples out there (e.g. wicket-examples) show a given component
when the user has Admin role and hide it for other roles. You should just
change the check with your logic.
And you have to annotate/tag somehow the components which you want to
manage.

On Thu, Jan 6, 2011 at 12:03 PM, simon <si...@redbend.com> wrote:

>
> 10x for your quick response..
> I'm not sure that your solution is applicable for me.
> First, I'm not using panels - so replace() cannot be implemented.
> Second, I do not have an Ajax "access point". there is no "onClick()" or
> something similar.
> The criteria on which I decide to render all the page or just a part of it
> is determined within the parameters passed to the page (from the client) in
> page c'tor.
>
> Any other ideas? :) Thanks,
> Simon
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-render-only-part-of-a-Page-and-return-only-that-part-tp3177106p3177219.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: How to render only part of a Page (and return only that part)

Posted by simon <si...@redbend.com>.
10x for your quick response..
I'm not sure that your solution is applicable for me.
First, I'm not using panels - so replace() cannot be implemented.
Second, I do not have an Ajax "access point". there is no "onClick()" or
something similar.
The criteria on which I decide to render all the page or just a part of it
is determined within the parameters passed to the page (from the client) in
page c'tor.

Any other ideas? :) Thanks,
Simon

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-render-only-part-of-a-Page-and-return-only-that-part-tp3177106p3177219.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: How to render only part of a Page (and return only that part)

Posted by Pedro Santos <pe...@gmail.com>.
What about when responding you client just replace the content an return it
in AJAX, I think it would implie in you create panels for you contents and
not extended pages.
Example of an click to a new content:
onClick(target){
   page.get("content").replace(new Content("content"));
   target.addComponent(page.get("content"));
}

On Thu, Jan 6, 2011 at 7:34 AM, simon <si...@redbend.com> wrote:

>
> Hi,
> I’m trying to render only part of my Page and only that part should return
> to the client (the browser).
> Currently, my page consists of logo bar, menu bar, bread crumbs bar and
> some
> div that contains the actual page content, say within <div
> wicket:id=”content”>.  (Actually I’m using the an “inheritance” model: a
> base page for all pages and each page implements its <wicket:child /> code)
> What I’m trying to do is to return to the browser only the content within
> the <wicket:child /> without the logo or menu bar.
> I was struggling with a solution (although I’m not a newbie with Wicket),
> Maybe I have to do something with RequestCycle/ Response?
> (BTW: this behavior is desirable not all the time, only in the case that
> the
> request consists some parameter that I should decide)
> Any idea? reference?
> Thanks a lot for any input.
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-render-only-part-of-a-Page-and-return-only-that-part-tp3177106p3177106.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Pedro Henrique Oliveira dos Santos