呵呵,能不能告诉我怎么配置环境变量等等,最后能够在浏览器里运行servlet程序。

解决方案 »

  1.   

    运行环境的搭建不需要配置就行
    resin就是不想tomcat麻烦
      

  2.   

    我一直用resin-2.1.6,没有问题啊,你的jsp程序可以运行吗?
    还有就是环境变量设置好了吗?
      

  3.   

    resin安装了设置一个工作目录就可以了
      

  4.   

    zj2977(大地) resin 还需要设置什么环境变量?
      

  5.   

    我的resin可以运行jsp。
    怎么设置工作目录,是不是在resin.conf添加代码?怎么添加?麻烦说清楚点了,谢谢!
    我的resin是3.0.6 edition
      

  6.   

    <!--
       - Resin 3.0 configuration file.
      -->
    <resin xmlns="http://caucho.com/ns/resin">
      <!--
         - Logging configuration for the JDK logging API.
        -->
      <log name='' level='info' path='stdout:' timestamp='[%H:%M:%S.%s] '/>
      <log name='com.caucho.java' level='fine' path='stdout:'
           timestamp='[%H:%M:%S.%s] '/>
      <log name='com.caucho.loader' level='config' path='stdout:'
           timestamp='[%H:%M:%S.%s] '/>  <!--
         - For production sites, change dependency-check-interval to something
         - like 600s, so it only checks for updates every 10 minutes.
        -->
      <dependency-check-interval>10s</dependency-check-interval>  <!--
         - You can change the compiler to "javac" or jikes.
         - The default is "internal" only because it's the most
         - likely to be available.
        -->
      <javac compiler="internal" args=""/>  <!-- Security providers.
         - <security-provider>
         -    com.sun.net.ssl.internal.ssl.Provider
         - </security-provider>
        -->  <!--
         - Configures threads shared among all HTTP and SRUN ports.
        -->
      <thread-pool>
        <!-- Maximum number of threads. -->
        <thread-max>200</thread-max>    <!-- Minimum number of spare connection threads. -->
        <spare-thread-min>25</spare-thread-min>
      </thread-pool>  <server>
        <!-- adds all .jar files under the resin/lib directory -->
        <class-loader>
          <tree-loader path="$resin-home/lib"/>
        </class-loader>    <!-- The http port -->
        <http id="" host="*" port="8080"/>    <!--
           - SSL port configuration:
           -
           - <http port="8443">
           -   <openssl>
           -     <certificate-file>keys/gryffindor.crt</certificate-file>
           -     <certificate-key-file>keys/gryffindor.key</certificate-key-file>
           -     <password>test123</password>
           -   </openssl>
           - </http>
          -->    <!--
           - The local cluster, used for load balancing and distributed
           - backup.
          -->
        <cluster>
          <srun id="" host="127.0.0.1" port="6802" index="1"/>
        </cluster>    <!--
           - If starting bin/resin as root on Unix, specify the user name
           - and group name for the web server user.
           -
           - <user-name>resin</user-name>
           - <group-name>resin</group-name>
          -->    <!--
           - Enables/disables exceptions when the browser closes a connection.
          -->
        <ignore-client-disconnect>true</ignore-client-disconnect>    <!--
           - Enables the cache
          -->
        <cache path="cache" memory-size="10M"/>    <!--
           - Sets timeout values for cacheable pages, e.g. static pages.
          -->
        <web-app-default>
          <cache-mapping url-pattern="/" expires="5s"/>
          <cache-mapping url-pattern="*.gif" expires="60s"/>
          <cache-mapping url-pattern="*.jpg" expires="60s"/>
        </web-app-default>    <!--
           - Sample database pool configuration
           -
           - The JDBC name is java:comp/env/jdbc/test
           -
             <database>
               <jndi-name>jdbc/mysql</jndi-name>
               <driver type="org.gjt.mm.mysql.Driver">
                 <url>jdbc:mysql://localhost:3306/test</url>
                 <user></user>
                 <password></password>
                </driver>
                <prepared-statement-cache-size>8</prepared-statement-cache-size>
                <max-connections>20</max-connections>
                <max-idle-time>30s</max-idle-time>
              </database>
          -->    <!--
           - Default host configuration applied to all virtual hosts.
          -->
        <host-default>
          <class-loader>
            <compiling-loader path='webapps/WEB-INF/classes'/>
            <library-loader path='webapps/WEB-INF/lib'/>
          </class-loader>      <!--
             - With another web server, like Apache, this can be commented out
             - because the web server will log this information.
            -->
          <access-log path='logs/access.log' 
                format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"'
                rollover-period='1W'/>      <!-- creates the webapps directory for .war expansion -->
          <web-app-deploy path='webapps'/>      <!-- creates the deploy directory for .ear expansion -->
          <ear-deploy path='deploy'/>      <!-- creates the deploy directory for .rar expansion -->
          <resource-deploy path='deploy'/>      <!-- creates a second deploy directory for .war expansion -->
          <web-app-deploy path='deploy'/>
        </host-default>    <!-- includes the web-app-default for default web-app behavior -->
        <resin:include path="app-default.xml"/>    <!-- configures the default host, matching any host name -->
        <host id=''>
          <document-directory>doc</document-directory>      <!-- configures the root web-app -->
          <web-app id='/'>
            <!-- adds xsl to the search path -->
            <class-loader>
              <simple-loader path="$host-root/xsl"/>
            </class-loader>        <servlet-mapping url-pattern="/servlet/*" servlet-name="invoker"/>
          </web-app>
          <web-app id='你的目录'>//
            <!-- adds xsl to the search path -->
            <class-loader>
              <simple-loader path="$host-root/xsl"/>
            </class-loader>        <servlet-mapping url-pattern="/servlet/*" servlet-name="invoker"/>
          </web-app>
        </host>
      </server>
    </resin>
      

  7.   

    不用配置,用默认配置就可以
    把servlet文件存放到/WEB-INF/classes/目录就可以用了
    访问地址:http://yourhost/servlet/yourservlet
      

  8.   

    To:yy52(52yy) 
    如你所说的可以了。
    不过,环境变量如果不设置,不能编译servlet的class呀,如下的小程序
    package test;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class test extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    PrintWriter out=response.getWriter();
    out.println("<html><body><h1>This is a servlet test.</h1></body></html>");
    out.flush();
    }
    }
    找不到package javax.servlet,怎么解决?
      

  9.   

    设置环境变量 CLASSPATH=‘servlet.jar的路径’