zk 隐藏网页文件后缀

前台(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);
    }
}

效果:

技术分享

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。