不应该的,你看你的代码方法大小写是否正确。方法名称是否正确。方法是否为公有(public)的
解决方案 »
- jsp怎么从mysql数据库把树形结构展现出来
- IE6不能调用Javascript的方法
- 求指点:myeclipse8.5添加自带struts2支持,然后部署发布,就报错了 严重:exception starting filter struts2
- servlet 怎么获取ie字符编码
- 请问,jsp里面,怎样把javascript的值赋给java的变量阿
- out.print没有显示,初学问题。
- java中怎样使用游标?急!!!
- Netscape下用JS中的window.open() 打开JSP,无发正常接收参数??????
- 我做一个计数器的jsp程序,那个记录文档(*.txt)放在哪个目录下啊?
- 有没有哪位大卡知道怎么设置这样一个代码:打开并浏览A网页,当关闭A网页的同时打开B网页
- 高手老手看过来~~~~~~~~~~
- jsp的域名解析
bean里为什么要加main()方法呀?
{
public int Error; /**
* Constructs a DOG exception that contain
* an error number returned by DOG device driver
*
* @param ErrorNumber Value returned by last call to DOG device driver.
*/
public DOGException( int ErrorNumber )
{
super( "Dog Operation Error " + ErrorNumber );
Error = ErrorNumber;
}
}第二个文件:GSDOG.java
package p1.p1;public class GSDOG
{
//in most cases, this Global variable should be set zero.
public int DogCascade; //The globle variable DogAddr indicates the first memory
//address(range from 0 to 199) of user area in the MicroDog
//The sum of DogAddr and DogBytes should not exceed 200
public int DogAddr;
//The globle variable DogBytes indicates the number of bytes
//in reading/writing operation or convertion
//The sum of DogAddr and DogBytes should not exceed 200
public int DogBytes;
//The globle variable DogCode refers to the user code in
//the MicroDog and can be changed by DOGEDIT.exe
public int DogPassword;
//The globle variable refers to the result of convererting operation
public long DogResult;
//the globle variable DogData refers to the pointer variable
//which points to the data for writing/reading or converting
public byte[] DogData;
public GSDOG()
{
}
/**
* Perform Dog Check Service
* @param none.
*/ public native int DogCheck(); /**
* Perform Dog Convert Service
* @param none.
*/ public native int DogConvert(); /**
* Perform Dog Write Service
* @param none.
*/ public native int WriteDog();
/**
* Perform Dog Read Service
* @param none.
*/ public native int ReadDog();
/**
* Perform Dog DisableShare Service
* @param none.
*/ public native int DisableShare(); /**
* Perform Dog GetCurrentNo Service
* @param none.
*/ public native int GetCurrentNo();
/**
* Static initializer
*/ static
{
try
{
System.loadLibrary("DOGJava");
}
catch( UnsatisfiedLinkError e )
{
System.err.println("Can't find library DOGJava.DLL");
System.exit( -1 );
}
}
} 第三个文件:DOGGSMH.java
package p1.p1;public class DOGGSMH extends GSDOG
{ /**
*Checks whether a Dog is plugged in the parallel ports
*return 0 if success
*
*/
public boolean CallDogCheck()
throws DOGException
{
int retCode; if((retCode=DogCheck())!=0)
return false;
else
return true;
}
/**
*send a byte array to Dog and convert it to an int
*return 0 if success
*
*/ public void CallDogConvert()
throws DOGException
{
int retCode; if((retCode=DogConvert())!=0)
throw new DOGException(retCode);
else
{
System.out.println("Dog Convert is OK!" + " Convert result is: "+ DogResult);
}
} /**
*write a byte array to Dog memory
*return 0 if success
*
*/ public void CallWriteDog()
throws DOGException
{
int retCode; if((retCode=WriteDog())!=0)
throw new DOGException(retCode);
else
{
System.out.println("WriteDog is OK!");
}
}
/**
*read Dog memory
*return 0 if success
*
*/ public void CallReadDog()
throws DOGException
{
int retCode;
char[] toPrint;
int i;
int serialno=0;
toPrint=new char[DogBytes];
if((retCode=ReadDog())!=0)
throw new DOGException(retCode);
else
{
System.out.println("Dog Read is OK!");
System.out.print("Dog Read result ");
for(i=0;i<DogBytes;i++)
{
toPrint[i]=(char)DogData[i];
System.out.print(toPrint[i]);
}
System.out.println("");
} } /**
*get the current no
*return 0 if success
*
*/
public void CallGetCurrentNo()
throws DOGException
{
int retCode; if((retCode=GetCurrentNo())!=0)
throw new DOGException(retCode);
else
{
System.out.println("GetCurrentNo is OK!" + " current no is: " + DogResult);
}
} /**
* disable share
*return 0 if success
*
*/
public void CallDisableShare()
throws DOGException
{
int retCode; if((retCode=DisableShare())!=0)
throw new DOGException(retCode);
else
System.out.println("DisableShare is OK!");
}}第四个文件:DogDemo.java(JSP调用这个)
package p1;import p1.p1.*;public class DogDemo
{
public boolean checkdog()
{
int retCode,i;
//System.out.println( "Microdog Sample Program for Java." );
//System.out.println( "Copyright (C) 2002 Rainbow China Co.,Ltd. All Rigths Reserved." );
// System.out.println( "Implemented by JDK 1.2 release\n" );
DOGGSMH sample = new DOGGSMH();
sample.DogCascade = 0;
sample.DogPassword=0; sample.DogData = new byte[200];
for (i=0;i<200;i++)
sample.DogData[i]=(byte)(i+48);
try
{
sample.CallDisableShare();
}
catch(DOGException e)
{
//System.err.println( " DisableShare Error: " + e.Error);
return false;
}
try
{
sample.CallDogCheck();
}
catch(DOGException e)
{
//System.err.println( " Dog Check Error: " + e.Error);
return false;
} return true;
}
/* public static void main(String[] args) { DogDemo a = new DogDemo();
if(!a.checkdog())
{
System.out.println("The Call is fail!");
}
else
System.out.println("The Call is ok!");
} */} JSP:
<jsp:useBean id="dog" scope="page" class="p1.DogDemo" />
<%
out.println("The Counter is : " + "<BR>");
if(dog.checkdog()){
out.println("The Call is ok" + "<BR>");
}
else
{
out.println("The call is fail!");
}
%>然后就是上面的错!
java文件都在package p1中
{
try
{
System.loadLibrary("DOGJava");
}
catch( UnsatisfiedLinkError e )
{
System.err.println("Can't find library DOGJava.DLL");
System.exit( -1 );
}
}
这段代码有问题,servlet中自己的代码不能退出System.exit( -1 );这样会造成web server退出。
你上面提的问题没有问题,不知道你那里怎么会错
<jsp:useBean id="dog" scope="page" class="p1.DogDemo" />
就会产生错误。
我建议你把jsp放到Jbuilder中检查一下,Jbuilder或许能帮你发现错误。