I am looking for examples for how to ingrate wicket 6.10 with jsp
We have lots of code written in jsp , which is a good code and we want it to be in our wicket 1. application to contain those jsp files , how can we integrate it ?
2. put jsp files inside wicket panel ?
3. where should those jsp files be ?
What I have done was inside web mark up :
@Override
public void onComponentTagBody(MarkupStream markupStream, ComponentTag tag) {
// Set up mock response and dispatch.
ServletContext context = WebApplication.get().getServletContext();
ServletRequest request = (HttpServletRequest) RequestCycle.get().getRequest().getContainerRequest();
MockResponse mockResponse = new MockResponse((HttpServletResponse) RequestCycle.get().getResponse().getContainerResponse());
try {
context.getRequestDispatcher("/" + pageName + ".jsp").include(request, mockResponse);
} catch (ServletException | IOException e) {
e.printStackTrace();
}
try {
replaceComponentTagBody(markupStream, tag, mockResponse.getOutput());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
class MockResponse extends HttpServletResponseWrapper {
ServletOutputStream servletStream;
ByteArrayOutputStream byteStream;
public MockResponse(HttpServletResponse response) {
super(response);
byteStream = new ByteArrayOutputStream();
servletStream = new ServletOutputStream() {
@Override
public void write(int b) {
byteStream.write(b);
}
};
}
@Override
public ServletOutputStream getOutputStream() {
return servletStream;
}
public String getOutput() throws UnsupportedEncodingException {
return byteStream.toString("UTF-8");
}
}
the html is started by myjsp html ... and then thewicket psage what i want is all the wicket i have mocked to be inside my component how can i achive it ?