Advertisement

02.26.2008 at 05:17AM PST, ID: 23193357 | Points: 125
[x]
Attachment Details
how to upload excel file in jboss web application
how can i read an excel file from jsp? I am using jboss application server
Start your free trial to view this solution
Question Stats
Zone: Software
Question Asked By: nilopher
Question Asked On: 02.26.2008
Participating Experts: 1
Points: 125
Views: 0
Translate:
Loading Advertisement...
02.26.2008 at 08:57AM PST, ID: 20986158

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.26.2008 at 05:44PM PST, ID: 20990679

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.27.2008 at 10:26PM PST, ID: 21001598

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.28.2008 at 07:39AM PST, ID: 21004747

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
02.26.2008 at 08:57AM PST, ID: 20986158

Rank: Guru

We like to use the JExcel API:
http://www.andykhan.com/jexcelapi/index.html

However, a lot of people like to use POI from Apache:
http://poi.apache.org/

 
02.26.2008 at 05:44PM PST, ID: 20990679

Rank: Guru

Or do you mean file upload?  In that case, you upload an Excel file the same as any other -- with HTML file upload:
<form  method="post" enctype="multipart/form-data" action="/loadfile.jsp" >
<input name="infile" id="infile" size="40" maxlength="256"  type="file"/>

Then read the uploaded file in the JSP page.  You can read the multipart request by writing your own reader, or you can use a package like the Jakarta commons fileupload:
http://commons.apache.org/fileupload/
 
02.27.2008 at 10:26PM PST, ID: 21001598
when i am writing a code in jsp as below i am getting
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)

the code:
try{
      WorkbookSettings ws = new WorkbookSettings();
      ws.setLocale(new Locale("en", "EN"));
      Workbook workbook = Workbook.getWorkbook( new File filename),ws);
      Sheet s = workbook.getSheet(1);
      System.out.println("Sheet Name::"+s.getName());
      sheet = readDataSheet(s);
      workbook.close();
}catch
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
package org.ggpl.bankreconciliation;
import java.io.File;
import java.io.*;
import jxl.*;
import java.util.*;
import jxl.Workbook;
import jxl.read.biff.*;
import java.sql.*;
import org.ggpl.TrialBalance.ConnectDB;
 
 
public class ReadXls{ 
	public ArrayList getExcel(String filename){
		ArrayList sheet = new ArrayList();
		try{
			WorkbookSettings ws = new WorkbookSettings();
			ws.setLocale(new Locale("en", "EN"));
			Workbook workbook = Workbook.getWorkbook( new File(filename),ws);
			Sheet s = workbook.getSheet(1); 
			System.out.println("Sheet Name::"+s.getName()); 
			sheet = readDataSheet(s);
			workbook.close();
		}catch (IOException e){ 
		e.printStackTrace(); 
		}catch (BiffException e){ 
		e.printStackTrace();
		} 
		return sheet;
	}
	private ArrayList readDataSheet(Sheet s){ 
		//gets the value of cell at specified column and row
		int rows = s.getRows();
		int cols = s.getColumns();
		ArrayList al1 = new ArrayList();
		ArrayList al2 = new ArrayList();
		ArrayList al3 = new ArrayList();
		ArrayList al4 = new ArrayList();
		int row = s.findCell("1").getRow();
		int col = s.findCell("1").getColumn();
		int chqcol = s.findCell("ChequeNo.").getColumn();
		for(int i=row;i<rows;i++){		
			if(s.getCell(col,i).getContents().equals(""))
				break;
			else{
				reconBean rb = new reconBean();				
				for(int j=col+1;j<cols;j++){
					if(j==1){
						rb.setBankdate(s.getCell(j,i).getContents());
					}else if(j==2){
						rb.setNarration(s.getCell(j,i).getContents());
					}else if(j==3){
						rb.setChequeNo(s.getCell(j,i).getContents());
					}else if(j==4){
						rb.setAmounttype(s.getCell(j,i).getContents());
					}else if(j==5){
						rb.setAmount(setAmount(s.getCell(j,i).getContents()));
					}
				}
				if(!s.getCell(chqcol,i).getContents().equals("")){
					String docid = getDocid(rb.getChequeNo(),rb.getAmount());
					if(!docid.equals("")){					
						docIDBean dbean = new docIDBean();
						dbean.setDocid(docid);
						al3.add(dbean);
						al1.add(rb);
					}else{
						al2.add(rb);
					}
				}else{
					al2.add(rb);
				}
			}
		}
		al4.add(al1);
		al4.add(al2);
		al4.add(al3);
		System.out.println("al1 size :"+al1.size());
		System.out.println("al2 size :"+al2.size());
		System.out.println("al3 size :"+al3.size());
		return al4;
	}
 
	public double setAmount(String amt){
		double amount = 0.00D;
		if(amt.equals("")){
			amount = 0.00;
		}else{
			String amts[] = amt.split(",");
			amt = "";
			for(int i=0;i<amts.length;i++){
				amt = amt + amts[i];
			}
			amount = Double.parseDouble(amt);
		}
		return amount;
	}
 
	public String getDocid(String chqno,double amt){
		String docid = "";
		ConnectDB db = new ConnectDB();
		try{
			db.connect();
			Connection con = db.getConnection();
			Statement st = con.createStatement();
			ResultSet rs = st.executeQuery("select doc_id from CHEQUE_MASTER c,DOC_MASTER d where c.CHEQUE_ID=d.CHEQUE_ID and c.CHEQUE_NO='"+chqno+"' and c.CHEQUE_AMOUNT='"+amt+"'");
			while(rs.next()){
				docid = rs.getString(1);
			}
		}catch (Exception e){
			System.out.println("There is a Problem in ReadXls Class ");
			e.printStackTrace();
			db.disconnect();
		}
		return docid;
	}
}
Open in New Window
 
02.28.2008 at 07:39AM PST, ID: 21004747

Rank: Guru

Which line of code is the problem?  I've tested your basic read of a sheet name, and it's fine.

The exception you're getting is from the JSP code, right?  So which line from the JSP code is the problem, and is it pointing to a line from the Java class above?
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628