快来帮帮我!看看我的我的问题!!jsp+javabean!!!!

lhjiang 2002-03-25 07:56:55
我把bean.jsp放在tomact/.../wap/jsp/下,Lonnowbean.class放在tomact/../wap/WEB-INF/classes/Lonnow/下,且已经加入了classpath。而且我的bean本身没问题的,编译通过了的!!但是编译bean.jsp出错???/错误是:
Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\192.168.201.222\wap\jsp\bean$jsp.java:118: Array index required.
aryTemp[]=lonnowbean.getLonnowInfo();
An error occured between lines: 14 and 19 in the jsp file: /jsp/bean.jsp
Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\192.168.201.222\wap\jsp\bean$jsp.java:118: No method matching getLonnowInfo() found in class Lonnow.Lonnowbean.
aryTemp[]=lonnowbean.getLonnowInfo();
附上带码:
bean.jsp代码:
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.util.*" %>
<%@ page import="Lonnow.Lonnowbean" %>
<jsp:useBean id="lonnowbean" scope="page" class="Lonnow.Lonnowbean"/>
<jsp:setProperty name="lonnowbean" property="strStkCode" value="1A0001"/>
<jsp:setProperty name="lonnowbean" property="strCity" value="sha"/>
<HTML>
<HEAD>
<TITLE>JSP测试页面--hello world!</TITLE>
</HEAD>
<BODY>
<%
double aryTemp[]=lonnowbean.getLonnowInfo();
for(int intT=0;intT<aryTemp.length;intT++)
{
out.println(aryTemp[intT]);
}
%>
</BODY>
</HTML>
Lonnowbean.java代码:
package Lonnow;
import java.util.*;
import java.io.*;
import java.lang.*;
import java.beans.*;
public class Lonnowbean {
String strStkCode;
String strCity;
public String getstrStkCode(){
return strStkCode;
}
public void setstrStkCode(String newstrStkCode){
strStkCode=newstrStkCode;

}
public static double[] getLonnowInfo(String strStkCode,String strCity)
{
double LonnowArray[]=new double[19];
try
{
String strFile="C:\\Program Files\\Apache Tomcat 4.0\\webapps\\wap\\xjsp\\"+strStkCode+"."+strCity;
FileInputStream fi=new FileInputStream(strFile);
BufferedInputStream bi=new BufferedInputStream(fi,512);
byte buffer[]=new byte[4];
String strHex;
bi.skip(16);
if(strStkCode.charAt(1)=='A'||strStkCode.charAt(1)=='a'||strStkCode.charAt(1)=='B'||strStkCode.charAt(1)=='b')
{
for(int intPosOfRecord=0;intPosOfRecord<7;intPosOfRecord++)
{
bi.read(buffer,0,buffer.length);
strHex="";
for(int i=buffer.length-1;i>=0;i--)
{
String strTemp="";
int intTemp;
if(buffer[i]<0)
{
intTemp=256+buffer[i];
strTemp=strTemp+intTemp;
}
else
{
strTemp=strTemp+buffer[i];
}
long intData=Long.parseLong(strTemp);
String strTranf=Long.toHexString(intData);
if(strTranf.length()==1)
strTranf="0"+strTranf;
strHex=strHex+strTranf;
}
Long I=Long.valueOf(strHex,16);
LonnowArray[intPosOfRecord]=((double)I.longValue())/100000;
}
}
else
{
for(int intPosOfRecord=0;intPosOfRecord<19;intPosOfRecord++)
{
bi.read(buffer,0,buffer.length);
strHex="";
for(int i=buffer.length-1;i>=0;i--)
{
String strTemp="";
int intTemp;
if(buffer[i]<0)
{
intTemp=256+buffer[i];
strTemp=strTemp+intTemp;
}
else
{
strTemp=strTemp+buffer[i];
}
long intData=Long.parseLong(strTemp);
String strTranf=Long.toHexString(intData);
if(strTranf.length()==1)
strTranf="0"+strTranf;
strHex=strHex+strTranf;
}
Long I=Long.valueOf(strHex,16);
LonnowArray[intPosOfRecord]=((double)I.longValue())/100000;
}
}
fi.close();
}
catch(FileNotFoundException e)
{
System.err.println("File not Found");
}
catch(IOException e)
{
System.err.println("IO error");
}
return LonnowArray;
}

}
...全文
8 点赞 收藏 6
写回复
6 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
可乐加水 2002-04-08
double aryTemp[]=lonnowbean.getLonnowInfo();
改成double aryTemp[]=Lonnowbean.getLonnowInfo();
把那个l大写了!
回复
jatim 2002-03-28
你把包的名字改为小写得试试看。
回复
ktyl2000 2002-03-28
據你的軟件而定吧.
我用的Weblogic
若打包為jar時放在Applications\DefaultWebApp\WEB-INF\lib之下,若為字節碼文件*.class則應放在 \WEB-INF\CLASSES之下,這是我的應用中的配置,希望你作為參考..
回复
lhjiang 2002-03-25
好像是jsp调用bean的方法没有找到?这是为什么?//
回复
wes109 2002-03-25
什么也没有?!
回复
lhjiang 2002-03-25
问题:::
我把bean.jsp放在tomact/.../wap/jsp/下,Lonnowbean.class放在tomact/../wap/WEB-INF/classes/Lonnow/下,且已经加入了classpath。而且我的bean本身没问题的,编译通过了的!!但是编译bean.jsp出错???不知道错在哪里??/错误是:
Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\192.168.201.222\wap\jsp\bean$jsp.java:118: Array index required.
aryTemp[]=lonnowbean.getLonnowInfo();
An error occured between lines: 14 and 19 in the jsp file: /jsp/bean.jsp
Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\192.168.201.222\wap\jsp\bean$jsp.java:118: No method matching getLonnowInfo() found in class Lonnow.Lonnowbean.
aryTemp[]=lonnowbean.getLonnowInfo();
附上带码:
bean.jsp代码:
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.util.*" %>
<%@ page import="Lonnow.Lonnowbean" %>
<jsp:useBean id="lonnowbean" scope="page" class="Lonnow.Lonnowbean"/>
<jsp:setProperty name="lonnowbean" property="strStkCode" value="1A0001"/>
<jsp:setProperty name="lonnowbean" property="strCity" value="sha"/>
<HTML>
<HEAD>
<TITLE>JSP测试页面--hello world!</TITLE>
</HEAD>
<BODY>
<%
double aryTemp[]=lonnowbean.getLonnowInfo();
for(int intT=0;intT<aryTemp.length;intT++)
{
System.out.println(aryTemp[intT]);
}
%>
</BODY>
</HTML>
Lonnowbean.java代码:
package Lonnow;
import java.util.*;
import java.io.*;
import java.lang.*;
import java.beans.*;
public class Lonnowbean {
String strStkCode;
String strCity;
public String getstrStkCode(){
return strStkCode;
}
public void setstrStkCode(String newstrStkCode){
strStkCode=newstrStkCode;

}
public static double[] getLonnowInfo(String strStkCode,String strCity)
{
double LonnowArray[]=new double[19];
try
{
String strFile="C:\\Program Files\\Apache Tomcat 4.0\\webapps\\wap\\xjsp\\"+strStkCode+"."+strCity;
FileInputStream fi=new FileInputStream(strFile);
BufferedInputStream bi=new BufferedInputStream(fi,512);
byte buffer[]=new byte[4];
String strHex;
bi.skip(16);
if(strStkCode.charAt(1)=='A'||strStkCode.charAt(1)=='a'||strStkCode.charAt(1)=='B'||strStkCode.charAt(1)=='b')
{
for(int intPosOfRecord=0;intPosOfRecord<7;intPosOfRecord++)
{
bi.read(buffer,0,buffer.length);
strHex="";
for(int i=buffer.length-1;i>=0;i--)
{
String strTemp="";
int intTemp;
if(buffer[i]<0)
{
intTemp=256+buffer[i];
strTemp=strTemp+intTemp;
}
else
{
strTemp=strTemp+buffer[i];
}
long intData=Long.parseLong(strTemp);
String strTranf=Long.toHexString(intData);
if(strTranf.length()==1)
strTranf="0"+strTranf;
strHex=strHex+strTranf;
}
Long I=Long.valueOf(strHex,16);
LonnowArray[intPosOfRecord]=((double)I.longValue())/100000;
}
}
else
{
for(int intPosOfRecord=0;intPosOfRecord<19;intPosOfRecord++)
{
bi.read(buffer,0,buffer.length);
strHex="";
for(int i=buffer.length-1;i>=0;i--)
{
String strTemp="";
int intTemp;
if(buffer[i]<0)
{
intTemp=256+buffer[i];
strTemp=strTemp+intTemp;
}
else
{
strTemp=strTemp+buffer[i];
}
long intData=Long.parseLong(strTemp);
String strTranf=Long.toHexString(intData);
if(strTranf.length()==1)
strTranf="0"+strTranf;
strHex=strHex+strTranf;
}
Long I=Long.valueOf(strHex,16);
LonnowArray[intPosOfRecord]=((double)I.longValue())/100000;
}
}
fi.close();
}
catch(FileNotFoundException e)
{
System.err.println("File not Found");
}
catch(IOException e)
{
System.err.println("IO error");
}
return LonnowArray;
}

}
回复
发动态
发帖子
Web 开发
创建于2007-09-28

7.9w+

社区成员

Java Web 开发
申请成为版主
社区公告
暂无公告