tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@stinky.com (Alex Chaffee)
Subject [FAQ] jGuru FAQ Update
Date Sat, 01 Sep 2001 00:22:33 GMT
jGuru maintains FAQs and Forums on Servlets, JSP, and Tomcat (as well as
many other Java topics).  Here is an automated update on recent postings to
Tomcat-related FAQs.  Please direct flames and feedback to alex@jguru.com .

 - Alex

--------------------------------------------------------------------------------
SPONSORED BY developerWorks

need it? get it. tools, code and tutorials for open-standards based development.

Stay informed with dW's weekly email newsletter
http://www.jguru.com/misc/register_devworks.jsp?src=notify
---------------------------------------------------------------------------------

Hi.  You asked to be notified weekly when certain jGuru.com items get new entries.

You can shut email notification off at the FAQ home
page(s) or:

  http://www.jguru.com/guru/notifyprefs.jsp


++ JavaServer Pages (JSP) FAQ: http://www.jguru.com/faq/JSP

I need to trap all kinds 500 error on my jsp page. I have tried the <%@ page errorPage="myerror.jsp">
but it only works on selected errors. How can I trap all errors, including syntax errors?
	http://www.jguru.com/misc/faqtrampoline.jsp?src=notify&EID=484004

Does anyone know how I could display an rtf string from JSP? I have resumes stored in a database
and want to display them in a browser.
	http://www.jguru.com/misc/faqtrampoline.jsp?src=notify&EID=484003

Does anyone know how I could display an rtf string from JSP? I have resumes stored in a database
and want to display them in a browser.
	http://www.jguru.com/misc/faqtrampoline.jsp?src=notify&EID=484002

How can I create complex, pretty reports which can be printed at the client from JSP?
	http://www.jguru.com/misc/faqtrampoline.jsp?src=notify&EID=484001

I know I can get JP tag attributes with setXXX() method but I want to know if  it is possible
to modify attribute values within a tag handler.
<p>
For example:<br>
I want to do iterator tag that iterates  over a list and at each iteation it can assign the
current iterated value to one of its attributes and cause the JSP page to display different
values at each iteration.
Is there any way to do this?
	http://www.jguru.com/misc/faqtrampoline.jsp?src=notify&EID=484000

Is it possible to view which web server or servlet engine is used: IIS, iPlanet etc. on a
JSP page? Just like System.getProperty(os.name) for the operating system?
	http://www.jguru.com/misc/faqtrampoline.jsp?src=notify&EID=483999

How do I stop a JSP based download adding a newline to the first character of a file?
I am using JSP to set a Content-Disposition in order to keep IE from automatically opening
Excel/Word/Acrobat/etc when it sees a file type it recognizes.  However, when I use ServletOutputStream
to do this, for some reason I end up with a newline (ASCII hex 0A) character at the beginning
of my file (I discovered this with a hex editor). This causes Word and Excel to blow up when
I try to open the files because they can't cope with the extra character. (I am using the
ATG Dynamo Application Server and am hoping this is not an artifact of the implementation.)
<p>
This is what my JSP looks like:
<pre>
&lt;%
// fname is the file name
File f = new File(fname);
InputStream in = new FileInputStream(f);
ServletOutputStream outs = response.getOutputStream();
		
int bufferSize = 4096;
byte[] ioBuffer = new byte[bufferSize];
byte[] lastBuffer; // last buffer
long counter = 0; // how many bytes we have gotten through
long fileSize = f.length();

response.setHeader("Content-Disposition", "attachment;filename=" + shortname);
response.setContentType("application/download");	

// in a big file, use big buffer chunks
while (fileSize &gt; (counter + bufferSize))
{
	in.read(ioBuffer);
	outs.write(ioBuffer);
           counter += bufferSize;
}
		
// add final chunk if the fileSize does not happen to be divisible by the bufferSize
if (fileSize &gt; counter)
{
	lastBuffer = new byte[ (int) (fileSize - counter) ];
	in.read(lastBuffer);
	outs.write(lastBuffer);
}
		
outs.flush();
outs.close();
in.close();
%&gt;
</pre>
I also tried to do this:
<pre>
String headers = "Content-Disposition:attachment;filename=" + shortname + "\r\n" +
		 "Content-Type: application/download\r\n\r\n";
		
outs.write(headers.getBytes());
</pre>
in place of the setHeader() and setContentType() but I end up just opening a webpage with
that string followed by the bytes from the file I want downloaded.
	http://www.jguru.com/misc/faqtrampoline.jsp?src=notify&EID=483996

++ Servlets FAQ: http://www.jguru.com/faq/Servlets

Are there any restrictions placed on applets loaded from HTML pages generated from servlets
/ JSP pages?
	http://www.jguru.com/misc/faqtrampoline.jsp?src=notify&EID=485955



Mime
View raw message