import java.io.*;
import jxl.*;
class Xlparsing
{
Workbook wb =wb.getWorkbook(new File(
"C:\\Documents and Settings\\kmoorthi\\Desktop\\ak\\new.xls"));
// Illegal forward reference What it means
Sheet st = wb.getSheet(0);
Cell cell1 = st.getCell(0,0);
String a1 = cell1.getContents();
public static void main(String s[])
{
System.out.println(new Xlparsing().a1);
}
}
Run Code Online (Sandbox Code Playgroud)
嗨当我尝试从Excel工作表中提取数据时,非法前向引用错误会出现在文件对象创建中.
怎么解决这个?
我尝试使用Apache Commons上传文件,但抛出了以下异常
org.apache.commons.fileupload.FileUploadBase $ InvalidContentTypeException:请求不包含multipart/form-data或multipart/mixed流,内容类型标头为null
我的HTML代码是
<form name="inp" action="upload.jsp" method="get" onsubmit="return valid();" enctype="multipart/form-data">
<table align="center" cellspacing="2">
<tr><td><font size="5" color="#E41B17">Select File</font> </td>
<td><input type="file" name="infile"></td>
</tr>
<tr><td><font size="5" color="#E41B17">Target File Name</font></td>
<td><input type="text" size="20" name="filename"></input></td>
</tr>
<tr></tr>
<tr><td colspan="2" align="center"><input type=submit value="Upload" ></td></tr>
</table>
<br></br>
<center>
<a href="index.html"><font color="#E41B17">HOME</font></a>
</center>
</form>
Run Code Online (Sandbox Code Playgroud)
我的JSP代码是
<%
String user = (String)session.getAttribute("uname");
String f = request.getParameter("filename");
DiskFileUpload upload = new DiskFileUpload();
boolean isMultipart=upload.isMultipartContent(request);
upload.setSizeMax(1048576);
List items = upload.parseRequest(request);
FileItem file = (FileItem) items.get(0);
String source = …Run Code Online (Sandbox Code Playgroud) 我想将图像存储在MySQL数据库中.我创建了一个具有BLOB数据类型的表,但现在如何将图像存储在此表中?
我是Java新手.我试图从文本文件中提取员工数据并将其存储在集合中.我使用Stringtokenizer从文件中获取字符串,但在第二次迭代中,while循环变为无限; 它不会出现在while循环中.我的代码是:
public class Reader1 {
String a;
int i = 0;
int count = 0;
int x = 0;
int y = 0;
File f = new File(
"C:\\Documents and Settings\\kmoorthi\\Desktop\\ak\\sample.txt");
ArrayList<Employee> al = new ArrayList<Employee>();
public void notePad() throws IOException {
try {
FileReader fis = new FileReader(f);
BufferedReader br = new BufferedReader(fis);
do {
a = br.readLine();
i++;
if (i > 1) {
if (a != null) {
StringTokenizer st = new StringTokenizer(a, " ");
Employee e …Run Code Online (Sandbox Code Playgroud) 当我尝试用Java读取Excel文件时,它会抛出"biff exception".
这是什么意思?我试图谷歌它,但无法找到正确的解释.
jxl.read.biff.BiffException: Unable to recognize OLE stream
at jxl.read.biff.CompoundFile.<init>(CompoundFile.java:116)
at jxl.read.biff.File.<init>(File.java:127)
at jxl.Workbook.getWorkbook(Workbook.java:221)
at jxl.Workbook.getWorkbook(Workbook.java:198)
at Com.Parsing.ExcelFile.excel(Extract.java:20)
at Com.Parsing.Extract.main(Extract.java:55)
Run Code Online (Sandbox Code Playgroud) 在我的servlet中
一个被抛出的例外
org.apache.jasper.JasperException: java.lang.IllegalStateException: getOutputStream() has already been called for this response
Run Code Online (Sandbox Code Playgroud)
帮我解决这个问题
提前致谢
在我的jsp代码中,我使用request.getParameter()来检索在html中输入的数据.使用get方法时检索数据,但是当我使用post方法时它不是为什么会发生这种情况
我的HTML表单是
<code>
<form name="inp" action="upload.jsp" method="post" onsubmit="return valid();" enctype="multipart/form-data">
<table align="center" cellspacing="2">
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td><font size="5" color="#E41B17">Select File</font> </td>
<td><input type="file" name="infile"></td>
</tr>
<tr><td><font size="5" color="#E41B17">Target File Name</font></td>
<td><input type="text" size="20" name="filename"></input></td>
</tr>
<tr></tr>
<tr><td colspan="2" align="center"><input type=submit value="Upload" ></td></tr>
</table>
<br></br>
<center>
<a href="index.html"><font color="#E41B17">HOME</font></a>
</center>
</form>
</code>
Run Code Online (Sandbox Code Playgroud)
我的jsp scriptlet是
<% String f = request.getParameter("filename");
System.out.println(f); %>
Run Code Online (Sandbox Code Playgroud)
提前致谢