我正在寻找如何将 wicket 6.10 与 jsp 结合的示例 我们有很多用 jsp 编写的代码,这是一个很好的代码,我们希望它出现在我们的 wicket 1. 包含这些 jsp 文件的应用程序中,我们如何集成它? 2.把jsp文件放在检票口面板里面?
3.那些jsp文件应该在哪里?
我所做的是在网络标记内:
@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");
}
}
html 是由 myjsp html 启动的......然后我想要的是我想要的所有检票口,我已经模拟了我的组件内部我怎样才能实现它?