奇怪,怎么csdn上没有高手吗?

解决方案 »

  1.   

    我不是高手~~~~~所以我没有听过jsp可以编译成class文件~~~~~~我只知道jsp可以通过jsp容器运行~~~~~~~~~~~
      

  2.   

    我也是第一次听说,但是确有此事,我现在在一家外资企业工作,国外他们在进行产品发布的时候,就是把*.jsp文件编译成*.class文件,以防源码外泻。有兴趣和有条件的朋友,可以看一下你们的tomcat或者是jrun的bin目录下面的一个文件jspc命令,欢迎大家讨论。哎,由此可见中国的软件和国外的差距在那里。
      

  3.   

    jsp程序最终肯定要编译成servlet类才能运行的。
    不过就不知道怎么编译的啦!
      

  4.   

    因为在发布程序的时候,你不可能把源码发布给用户,对吗?
    所以我们要做的就是把最终的jsp文件一次性的编译成class文件,然后打包发布?我以前做的几个公司,都没有做到这一点,我认为比较欠缺。那么,现在就是,如何使用jspc的问题了.希望大家与我一块儿探索,一块儿成长!谢谢支持!
      

  5.   

    研究过jrun的admin端的兄弟肯定知道jrun的admin就是用jsp写的,之所以看不到是因为他们把jsp编译后的文件打成包放到lib下了,如果用反编译照样看到源代码,除非有加密才能防止源代码外泄。我敢肯定的是你研究如何用jspc意义不大。
    因为jsp容器是按照jsp的规范来解释源代码的,你可以研究jsp规范。如果你的目的是要得到jsp编译后的文件,在你的web application下肯定是有的,除非这个jsp一次都没执行。
      

  6.   

    把你那个jspc打开看看不就知道了
    tomcat底下是jspc.bat的文件
    jspc -uriroot . index.jsp 
      

  7.   

    java [-classpath classpath]
      JSPC 
      -j jrun_root_dir
      -s server
      -a web_application_name
      [-webroot path_to_web_root]   [-vghn]
      [-d output_directory] 
      [-compiler "compiler_spec"] 
      JSP_pathclasspath - (Optional) Specifies the classpath to the java command. You can specify it either on the command line or by using the CLASSPATH environment variable. The following paths must be specified in the classpath:All JAR files in the JRun_rootdir/lib directory 
    All JAR files in the directory JRun_rootdir/lib/ext directory 
    Depending on your compiler, you may have to specify additional files shipped with your JDK 
    Additional parameters are as follows:j - Specifies the JRun root directory.s - Specifies the server name.a - Specifies the Web application name.webroot - (Optional) Specifies the full path to the Web application’s root directory. This argument is required for Web applications for which the use-webserver-root property is set to true. You can optionally abbreviate this to -w.
    v - (Optional) Specifies to display the name of each JSP file as the JSPC compiles it.g - (Optional) Specifies to display debug messages.h - (Optional) Specifies to display the JSPC compiler help message.n - (Optional) Specifies to compile only JSPs that are newer than the corresponding .class file.d - (Optional) Specifies where you want the JSPC compiler to write the output .class and .java files. By default, this directory is set to the current working directory. Typically, you specify the WEB-INF\jsp directory under the directory structure of a Web application. compiler - (Optional) Specifies a quoted string containing the compiler and compiler settings to use for the compile. If you omit this parameter, JRun compiles JSPs in-process using the Sun javac compiler. For example:java JSPC -compiler "javac -nowarn -classpath %c -d %d %f" ...
      or
    java JSPC -compiler "jvc /cp:c %c /dest: %d %f" ...JSP_path - Specifies the physical path of the JSP on your file system relative to the Web application by the -a parameter. You can specify multiple files, separated by spaces. You can use wildcard symbols to specify multiple files. The directory specified by -a and the JSP_path are combined to specify the JSP compiled. For example, if -a is a Web application located in c:\myapps\store and the JSP that you want to compile is named is c:\myapps\store\my.jsp, the JSP_path for the page is my.jsp. You can include wildcard symbols in the JSP_path if you are compiling multiple JSPs. 
      

  8.   

    http://sdc.shockwave.com/support/jrun/releasenotes/3/releasenotes_3_1.htm#jspcupdates