如何保护jsp页面免于开源 [英] how to protect jsp pages from being open source

查看:103
本文介绍了如何保护jsp页面免于开源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发一个商业Web应用程序项目.是否可以防止用户下载jsp页面?像ASP页面的DLL文件一样?

I want to develop a commercial web application project. Is it possible to prevent users from downloading the jsp pages? Something like DLL files of ASP pages?

推荐答案

好的.只需获取已编译的jsp .class文件,然后通过复制jsp class程序包(org)的顶层,将其置于WEB-INF/classs下.由于它们是servlet,因此您可以在web.xml中声明它们,并将它们映射到通常可以找到它们的url模式.

Sure. Just take the compiled jsp .class files and put them under WEB-INF/classes by copying the top level of the jsp class' package (org). Since they're servlets, you can declare them in your web.xml and map them to the url pattern where they would normally be found.

<servlet> 
    <servlet-name>index_jsp</servlet-name> 
    <servlet-class>org.apache.jsp.dirname.index_jsp</servlet-class> 
</servlet> 

<servlet-mapping> 
    <servlet-name>index_jsp</servlet-name> 
    <url-pattern>/dirname/index.jsp</url-pattern> 
</servlet-mapping> 

如果要执行此操作,则需要在构建过程中对其进行翻译和编译.如果您使用的是ant,请检查 jasper 任务.

If you're going to do this, you'll want to translate and compile them as part of your build. If you're using ant, check out the jasper task.

这篇关于如何保护jsp页面免于开源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆