You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kgignatyev <kg...@gmail.com> on 2008/08/12 18:21:10 UTC

embedding Wicket into JSP

Hi,

I have problem embedding Wicket pages (1.3.4) into JSP application.
index.jsp

<jsp:include page="/wic/ flush="true"/>

and the cause is that inside WicketFilter 
public String getRelativePath(HttpServletRequest request) returns empty
string because the request returns path for the index.jsp and not the /wic/
so the doGet method tries to do redirect which does not succeed.

So the question: is it possible at all to embed Wicket into JSP pages? 
-- 
View this message in context: http://www.nabble.com/embedding-Wicket-into-JSP-tp18947738p18947738.html
Sent from the Wicket - User 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


Antwort: Re: embedding Wicket into JSP

Posted by Ja...@tk-online.de.
Hi,

If you want _one_ Wicket Application appear within a JSP based page just
override getRelativePath() in WicketFilter to get the include-uri instead 
of the request-uri:
                String requestURI = (String) request.getAttribute(
"javax.servlet.include.request_uri");
                if (requestURI == null) {
                        requestURI = request.getRequestURI();
                }
                String path = Strings.stripJSessionId(requestURI);
                ...

You'll maybe need you own RequestEncodingStrategy to combine you JSP base 
URL and the wicket part, depending on your URL scheme.

If you want to embed different Wicket pages of one application on 
_multiple_ locations of one JSP base page, you'll have to do more work: 
You need to track the state of every wicket page to remember it when the 
JSP page is rendered again. Here's how we've done this:
1. In the JSP create an id for the wicket application you want to render 
at this location. We used the id of the CMS object (CoreMedia) for this.
2. Do the jsp:include
3. Override onAfterRender in your base page to track the rendered wicket 
page at this location (getNumericId + getCurrentVersionNumber) for the id 
generated in the including JSP
4. When the JSP is rendered again, the including JSP passes the last 
tracked state to the Wicket pages. If a Wicket component was clicked, you 
pass the actual request parameters to the Wicket application that rendered 
that page (you've tracked this in step 3).

For bookmarkable pages some more effort is needed, but the post is already 
long enough.

     Jan

kgignatyev <kg...@gmail.com> schrieb am 13.08.2008 17:44:48:

> 
> I have read that many times. That describes the opposite to the thing I 
need.
> 
> And it seems that W 1.3.4 code just plain make it impossible to embed W 
in
> JSP. Am I reading W code wrong?
> 
> 
> martin-g wrote:
> > 
> > On Tue, 2008-08-12 at 09:21 -0700, kgignatyev wrote:
> >> Hi,
> >> 
> >> I have problem embedding Wicket pages (1.3.4) into JSP application.
> >> index.jsp
> >> 
> >> <jsp:include page="/wic/ flush="true"/>
> >> 
> >> and the cause is that inside WicketFilter 
> >> public String getRelativePath(HttpServletRequest request) returns 
empty
> >> string because the request returns path for the index.jsp and not the
> >> /wic/
> >> so the doGet method tries to do redirect which does not succeed.
> >> 
> >> So the question: is it possible at all to embed Wicket into JSP 
pages? 
> > 
> > Check if this helps you:
> > http://herebebeasties.com/2007-03-01/jsp-and-wicket-sitting-in-a-tree/
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/embedding-
> Wicket-into-JSP-tp18947738p18965795.html
> Sent from the Wicket - User 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: embedding Wicket into JSP

Posted by kgignatyev <kg...@gmail.com>.
I have read that many times. That describes the opposite to the thing I need.

And it seems that W 1.3.4 code just plain make it impossible to embed W in
JSP. Am I reading W code wrong?


martin-g wrote:
> 
> On Tue, 2008-08-12 at 09:21 -0700, kgignatyev wrote:
>> Hi,
>> 
>> I have problem embedding Wicket pages (1.3.4) into JSP application.
>> index.jsp
>> 
>> <jsp:include page="/wic/ flush="true"/>
>> 
>> and the cause is that inside WicketFilter 
>> public String getRelativePath(HttpServletRequest request) returns empty
>> string because the request returns path for the index.jsp and not the
>> /wic/
>> so the doGet method tries to do redirect which does not succeed.
>> 
>> So the question: is it possible at all to embed Wicket into JSP pages? 
> 
> Check if this helps you:
> http://herebebeasties.com/2007-03-01/jsp-and-wicket-sitting-in-a-tree/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/embedding-Wicket-into-JSP-tp18947738p18965795.html
Sent from the Wicket - User 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: embedding Wicket into JSP

Posted by Martin Grigorov <mc...@e-card.bg>.
On Tue, 2008-08-12 at 09:21 -0700, kgignatyev wrote:
> Hi,
> 
> I have problem embedding Wicket pages (1.3.4) into JSP application.
> index.jsp
> 
> <jsp:include page="/wic/ flush="true"/>
> 
> and the cause is that inside WicketFilter 
> public String getRelativePath(HttpServletRequest request) returns empty
> string because the request returns path for the index.jsp and not the /wic/
> so the doGet method tries to do redirect which does not succeed.
> 
> So the question: is it possible at all to embed Wicket into JSP pages? 

Check if this helps you:
http://herebebeasties.com/2007-03-01/jsp-and-wicket-sitting-in-a-tree/


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