JSP程序如下:<%@ page contentType="text/html;charset=GB2312" 
import="java.util.*,java.io.*,oracle.jdbc.driver.*,javax.servlet.*,javax.servlet.http.*,java.sql.*,com.bean.*"
%>
<%!
// 定义连接数据库所需的变量。
private static final String CONFIG_BUNDLE_NAME = "jdbcurl"; private static String user = null;
private static String password = null;
private static String source = null;
private static String host = null;
private static String port = null;
private static String sid = null;
private static String url = null; // subuser.jsp 初始化方法。
public void init(ServletConfig config) throws ServletException
  {
   super.init(config);
// 取得 Properties 文件中定义的参数的值。
  try {
      PropertyResourceBundle configBundle = (PropertyResourceBundle) PropertyResourceBundle.getBundle(CONFIG_BUNDLE_NAME);      user     = configBundle.getString("servlet.user");
      password = configBundle.getString("servlet.password");
      source   = configBundle.getString("servlet.source");
      host     = configBundle.getString("servlet.host");
      port     = configBundle.getString("servlet.port");
      sid      = configBundle.getString("servlet.sid");
      url      = source + host + ":" + port + ":" +sid;    }
    catch (Exception e) {
      System.out.println("Find properties error in subuser.jsp.init(): " + e.toString());
      System.out.println((new java.util.Date()).toString());
    }.
.
.
.
.

解决方案 »

  1.   

    在websphere3.5下编译可以通过,比较编译JSP的软件japbatchcompiler,发现如下不同:
    websphere3.5 调用的是ibmwebap.jar中的
    com.ibm.websphere.batchcompiler.BatchCompiler
    websphere4.0 调用的是jsp.jar中的org.apache.jasper.compiler.ibmtools.JspBatchCompiler
    不知该如何修改?
      

  2.   

    init方法是servlet类中的方法啊,你在jsp中重载这个方法发生的错误。具体什么原因我也太清楚,学习中,帮你UP
      

  3.   

    好象jsp都需要一个叫ant.jar的包。你把那个包包进去看看。我遇到过。默认情况是不包的。出错了就包进去看看,jb中有,tomcat也有,只要是服务器都有
      

  4.   

    重载这个方法没有错误,你看编译中的错误提示是:声明的方法 
    void init(javax.servlet.ServletConfig) 不能覆盖在 class org.apache.jasper.runtime.HttpJspBase 中声明的具有相同签名的终态方法。终态方法 不能被覆盖。说明是方法重复了!
      

  5.   

    public class jsp文件 extends HttpJspBase这是一个jsp文件被编译成servlet后的原文件说明jsp文件是继承于HttpJspBase这个抽象的类,在HttpJspBase下定义了final void init(ServletConfig config) throws ServletException由于方法是最终的,那么他的子类是不能够超载方法的(请察看think-in-java关于多态性的说明)建议你把方法名修改一下祝你好运!
      

  6.   

    通过分析你的源程序,我理解你是不是想让你的jsp文件的init方法被制动调用我认为可能不行,如果你修改方法名称虽然可以正确的编译但是恐怕达不到你的要求了祝你好运!
      

  7.   

    faint在Servlet中才要写init方法啊
      

  8.   

    我在JSP中也可以写init方法啊!