Hi all,

I know the many posts have been written on the same problem, but I have been
looking at the answers for 5 hours without having a simple example to work
with..
I basically need to include a single component (a menu) into my jsp pages,
because we are migrating the application from struts/jsp to wicket.
I tried with the following code but it didn't work:

WICKET APPLICATION:

public class WicketApplication extends WebApplication
{    
        public WicketApplication(){}
        public Class<HomePage> getHomePage(){   return HomePage.class;}
        @Override
        protected void init(){
                getMarkupSettings().setStripWicketTags(true);
        
getRequestCycleSettings().setRenderStrategy(IRequestCycleSettings.ONE_PASS_RENDER);
        }
}


PAGE MARKUP:
<html
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd";
>
    <head>  
        <title>Wicket Quickstart Archetype Homepage</title>
    </head>
    <body>
        <strong>Wicket Quickstart Archetype Homepage</strong>
        <br/><br/>
        message will be here
    </body>
</html>

PAGE CODE:

public class HomePage extends WebPage {
    public HomePage(final PageParameters parameters) {
        add(new Label("message", "If you see this message wicket is properly
configured and running"));
    }
    @Override
    protected void onRender(final MarkupStream markupStream){
        System.out.println("RENDER OF THE PAGE!!");
    }
}

JSP PAGE:
<jsp:include page="/wic/" />

WEB.XML:

<web-app>
        <filter>
                <filter-name>wicket.embedwicket</filter-name>
                <filter-class>embedwicket.WicketMenuFilter</filter-class>
                <init-param>
                        <param-name>applicationClassName</param-name>
                        <param-value>embedwicket.WicketApplication</param-value>
                </init-param>
        </filter>

 <filter-mapping>
  <filter-name>wicket.embedwicket</filter-name>
        <url-pattern>/wic/*</url-pattern>
        <dispatcher>INCLUDE</dispatcher>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
 </filter-mapping>
</web-app>


WicketMenuFilter:
THIS IS MY CUSTOM WICKET FILTER TO MANAGE INCLUDE URI, AS IT WAS SUGGESTED
BY A GUY HERE:
http://apache-wicket.1842946.n4.nabble.com/embedding-Wicket-into-JSP-td1867715.html
http://apache-wicket.1842946.n4.nabble.com/embedding-Wicket-into-JSP-td1867715.html
 

Basically I overrided the method
public String getRelativePath(HttpServletRequest request)

buy copying it and replacing the following lines:

String path = Strings.stripJSessionId(request.getRequestURI());
String contextPath = request.getContextPath();

with:

String requestURI = (String)
request.getAttribute("javax.servlet.include.request_uri");
if (requestURI == null) {
        requestURI = request.getRequestURI();
}
String path = Strings.stripJSessionId(requestURI);


I tried to debug the code and the filter is called, but then nothing is
displayed on the browser.. just a blank page..
If I call page directly(not the jsp) , it renders correctly..



Has anyone got a simple working example of this situation?

I would really appreciate id because I am going crazy..

Thank you very much.

Riccardo




-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/including-wicket-component-into-jsp-tp2271266p2271266.html
Sent from the Wicket - User mailing list archive at Nabble.com.

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

Reply via email to