前台(test.zul):
<a label="隐藏地址" href="/Bandbox/test.html"/>
web.xml添加
<servlet> <servlet-name>testUrl</servlet-name> <servlet-class>test.testUrl</servlet-class> </servlet> <servlet-mapping> <servlet-name>testUrl</servlet-name> <url-pattern>/Bandbox/test.html</url-pattern> </servlet-mapping>
testUrl.java:
public class testUrl extends HttpServlet{
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
request.getRequestDispatcher("../Bandbox.zul").forward(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
效果: