Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2008

Tip: Looking for answers? Try searching our database.

Generating excel sheets through JSP

Thread view: 
ruds - 16 Mar 2008 07:37 GMT
Hi,
I have previously created excel sheets in JSP in weblogic, and i get
the result accurately.
I had used;
<%@ page contentType="application/vnd.ms-excel" import="java.sql.*"
language="java"%>
at the top of the page and,
<meta http-equi="Content-Type" content="application/vnd.ms-excel;
charset=iso-8859-1">
in the head tag of my page.
Now I'm using tomcat 5.5 and this is just not working....
Can someone help me out with this?
Andrew Thompson - 16 Mar 2008 07:46 GMT
...
> Now I'm using tomcat 5.5 and this is just not working....

Lazy is it?*  Try beating it with a stick, or
alternately, offer it inducements - like cash.

* WTF does 'not working' mean?

--
Andrew T.
ruds - 16 Mar 2008 09:19 GMT
the file is getting created but the data is not there..
Andrew Thompson - 16 Mar 2008 10:06 GMT
> the file is getting created but the data is not there..

Thanks for clarifying.  Now hopefully someone* who
is experienced with WebSphere and Tomcat can explain
the difference in behaviour.

( * I can offer no useful suggestions, so I will bow
out of the thread now.  Hope you get it sorted. )

--
Andrew T.
PhySci.org
Andrew Thompson - 16 Mar 2008 10:38 GMT
...
> ( * I can offer no useful suggestions, ..

But now I think about it, I will ask a general
question re JSP of anybody that can answer it.

Is there any chance of 'swallowing exceptions'
within a JSP?  I did some JSP, but my recollection
is fuzzy.

And to the OP.  Do you understand what I mean by
'swallow exceptions'?  OK.. since I'm here, the
general form would be

 try {
   // something that might fail
 catch(Exception e) {
   //do nothing useful with the information
   // and continue
 }

That owuld be 'swallowing an exception'.

Whereas the way to do the opposite (*not*
swallow exceptions) would be to..

 try {
   // something that might fail
 catch(Exception e) {
   // be very verbose about what went wrong
   e.printStackTrace();
 }

How long is the JSP file?  If it is short, it
may pay to post it to this thread.

--
Andrew T.
PhySci.org
diz4tech@gmail.com - 16 Mar 2008 16:29 GMT
> Is there any chance of 'swallowing exceptions'
> within a JSP?  I did some JSP, but my recollection
> is fuzzy.

Hi Friends,

Ruds, am realy sorry- i dont have any idea abt ur query, hope somebody
else will clarify it.

Thompson,

       JSTL provides library tags to maintain Exceptions in JSP pages
& is

<%@ taglib prefix="c" uri="http://www.java.sun.com/jsp/jstl/core" %>

<c:catch var="sampleExc">

 - code  -

</c:catch>

By this JSP container will handle the exception, using the custom var
we can able to display the type of error occured in the later part of
the code.

Thank you,
Lew - 16 Mar 2008 18:17 GMT
> Ruds, am realy sorry- i [sic] dont have any idea abt ur query, hope somebody
> else will clarify it.

Sure:
<http://en.wikipedia.org/wiki/Ur>

And it's spelled with an upper-case "U".

Signature

Lew

Roger Lindsjö - 16 Mar 2008 19:52 GMT
> ...
>> ( * I can offer no useful suggestions, ..
[quoted text clipped - 5 lines]
> within a JSP?  I did some JSP, but my recollection
> is fuzzy.

You could of course use <% try } %>
... JSP code ...
<% } catch (Exception e) {} %>

or use JSTL core.
<c:catch var="e">
... JSP code ...
</c:catch>
<c:if test="${e != null}">
  Exception ${e}
</c:if>

Signature

Roger Lindsjö

Arne Vajhøj - 17 Mar 2008 00:06 GMT
> But now I think about it, I will ask a general
> question re JSP of anybody that can answer it.
>
> Is there any chance of 'swallowing exceptions'
> within a JSP?  I did some JSP, but my recollection
> is fuzzy.

It is possible to catch exceptions in Java code embedded
in or called from a JSP page.

It is also possible to redirect to an error page
in case of an exception.

My assumption would be that if someone is capable of using
either of those techniques, then are also able to
troubleshoot effectively. They are not something that
get added standard.

Arne
Tim Smith - 17 Mar 2008 05:48 GMT
In article
<3d307e1c-44e2-4e86-9f11-1339fb90d277@s13g2000prd.googlegroups.com>,
> > the file is getting created but the data is not there..
>
[quoted text clipped - 4 lines]
> ( * I can offer no useful suggestions, so I will bow
> out of the thread now.  Hope you get it sorted. )

Empty output is sorted, so he's OK there. :-)

Signature

--Tim Smith

Mark Space - 16 Mar 2008 21:47 GMT
> Hi,
> I have previously created excel sheets in JSP in weblogic, and i get
[quoted text clipped - 8 lines]
> Now I'm using tomcat 5.5 and this is just not working....
> Can someone help me out with this?

Can you show us the complete JSP?  That would be a start.
Arne Vajhøj - 17 Mar 2008 00:10 GMT
> I have previously created excel sheets in JSP in weblogic, and i get
> the result accurately.
[quoted text clipped - 6 lines]
> in the head tag of my page.
> Now I'm using tomcat 5.5 and this is just not working....

Are you generating CSV or XLS format ?

Generating XLS format from JSP is error prone. You should
use a servlet for that.

Generating CSV should be possible from JSP even though I would
still recommend a servlet.

An empty file has nothing to do with the content type, so
we need more info.

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.