关于函数的问题,请教高手 out是jsp的内置对象你在方法中调用是不可以的只能在页面种调用 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 out是implicit object,不能在<%! %>里使用。 那么要在函数里调用JSP的内置对象,有没有办法实现的呢? out是JSP的内定义对象,要在函数中调得通过javax.servlet.jsp.JspWriter或PrintWriter:/****************************************************************//* Function Name : bReadFile *//* Function Para : File pfileRead *//* PrintWriter ppwOut *//* Function Func : Read file *//****************************************************************/private boolean bReadFile(File pfileRead, PrintWriter ppwOut){ String strRead; long lCurPointer = 0 ; long lFileLength; byte buffer[] = new byte[1024]; boolean blnRet = false; //Use RandomAccessFile to read file try { RandomAccessFile fileRead = new RandomAccessFile(pfileRead,"r"); lFileLength = pfileRead.length(); ppwOut.println("File Content:<br>"); while(lCurPointer < lFileLength) { strRead = fileRead.readLine(); ppwOut.println(strRead); ppwOut.println("<br>"); lCurPointer = fileRead.getFilePointer(); } fileRead.close(); } catch(Exception e) { String err = e.toString(); //out.println(err); return blnRet; } blnRet = true; return blnRet;} 那我该怎么调用这样的方法呀,这个PrintWriter ppwOut的实参应该用什么呢??? JSP的一个问题:如何截取字符串 dwr的问题 weblogic 连接池连接数不够用? Ajax 和 Session 之间的矛盾????? 懂php和jsp的高手,帮我把php转化为jsp,谢 jsp连接access数据库问题 出100分急求JSP中bordercolor的问题 javascript中的一个疑问,请大家赐教 iis和resin的解决resin的端口的问题!!!!!!!! 请问如何在Windows下整合Jbuilder与ORACLE8I(在线等待) TOMCAT支持J2EE吗?谢谢! 帮忙看一个简单的问题!
/* Function Name : bReadFile */
/* Function Para : File pfileRead */
/* PrintWriter ppwOut */
/* Function Func : Read file */
/****************************************************************/
private boolean bReadFile(File pfileRead, PrintWriter ppwOut)
{
String strRead;
long lCurPointer = 0 ;
long lFileLength;
byte buffer[] = new byte[1024];
boolean blnRet = false; //Use RandomAccessFile to read file
try
{
RandomAccessFile fileRead = new RandomAccessFile(pfileRead,"r");
lFileLength = pfileRead.length();
ppwOut.println("File Content:<br>");
while(lCurPointer < lFileLength)
{
strRead = fileRead.readLine();
ppwOut.println(strRead);
ppwOut.println("<br>");
lCurPointer = fileRead.getFilePointer();
}
fileRead.close();
}
catch(Exception e)
{
String err = e.toString();
//out.println(err);
return blnRet;
} blnRet = true;
return blnRet;}