Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 27th, 2006, 05:34 AM
amsuone amsuone is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 9 amsuone User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 21 m 11 sec
Reputation Power: 0
How to do for multi access for open excle file in browser?

I would like to know how to open multi file of excel on web. Now I can create a file and open it on web already but I can open it only one excel page. when I try to open it more than one, the content of excel file will be move to the new page.

** I have tried to test it, if I have two form to post data to two servlet for each form, I can open two excel file in browser. but I have only one servlet, and I want to open it more than one page. it's not work with one servlet. I don't know how to do. Please help me if you know how to do !!!!

I have used tag form to post data to xml file then it go to servlet.

>>
<Form name="form" action="srv-xlsdata" method="POST" target="_blank">


>> servlet File

public abstract class AbstractExcelView extends HttpServlet {

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

doPost(request, response);
}

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
HSSFWorkbook workbook = null;

long start = System.currentTimeMillis();
File newFile = null;

if (getTemplatePath(request) != null) {
String path = getServletContext().getRealPath(getTemplatePath(re quest));


POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(path));
workbook = new HSSFWorkbook(fs);

} else {
workbook = new HSSFWorkbook();
}

buildWorkbook(request, workbook);

String filename = getOutputFilename(request);
if (filename.toLowerCase().endsWith(".xls")) {

filename = filename.substring(0, filename.length() - 4);
}

OutputStream ostream = response.getOutputStream();

response.setContentType("application/vnd.ms-excel");

workbook.write(ostream);

ostream.close();

} catch (Exception e) {
throw new ServletException("Unable to build Excel Document", e);
}
}

Reply With Quote
  #2  
Old September 30th, 2006, 07:09 AM
amsuone amsuone is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 9 amsuone User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 21 m 11 sec
Reputation Power: 0
Yeah...

Now I know how do I do...
I have to create new pattern for each servlet name.
It's work!!!!
So now I can open excel in browser more than 1 page.

Reply With Quote
  #3  
Old March 13th, 2008, 02:29 PM
sangk76 sangk76 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 1 sangk76 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 57 sec
Reputation Power: 0
What patterns did you use ???

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > How to do for multi access for open excle file in browser?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT