How to download file in jsp
Hi guys,
I am a new member to this java community. I meet some problems in doing my project, hope you experts can help me.
I want to add a download button in my jsp code. When users click the button, a file will be downloaded to his local computer. The files are ASCII files with .asc as extension. My server is Apache 1.3.19 with tomcat 3.2.1 . What kind of code should I add to my jsp?
Anyone's quick response is greatly appreciated.
Thanks for your reply.
I have tried to use the hyper link in html. But since it's ASCII file with .asc extension, every time the link is clicked, the file is opened directly instead of offering save option. So maybe some special code is needed.
Many software web site provides download page. When user clicks the download button, the file will be transfered to user's computer. Does anyone knows how to do it?
Thanks.
Similar Messages
-
How to download files in jsp code {through save dialog}
can you help me to download files in jsp code {through save dialog}
i use the following code but it saves the jsp page instead of the downloaded file but with the name of the wanted file to be downloaded
response.setHeader("Pragma", "public");
response.setHeader("Cache-Control", "no-cache");
*** download file
if((trans !=null)&&(trans.equals("download")) )
response.setContentType ("application/x-download");
response.setHeader ("Content-Disposition","attachment;filename=\""+fileName+"\"");
%>
<script>
window.location.href=<%=gallerypath+fileName%>';
</script>
<%
trans="";
//System.out.print("download : "+fileName );
//***************************************Can you try below code, It should work...
<%
String myFileName = request.getParameter("fileName");
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment; filename=\"" + myFileName + "\"");
String root = "D:/";
InputStream in = null;
ServletOutputStream outs = response.getOutputStream();
try {
in = new BufferedInputStream
(new FileInputStream(root + myFileName));
int ch;
while ((ch = in.read()) != -1) {
outs.print((char) ch);
finally {
if (in != null) in.close(); // very important
outs.flush();
outs.close();
in.close();
%> -
How to download file from application server
Hi Experts,
I developed report and execute in background mode. for this i used Open dataset transfer and close dataset . i got the requried output . But in this case user want downloaded file on presentation server so can anyone tell me How to download file from application server?
i know it is possible through Tcode CG3Y. but i want code in program.This code will download a file to your Client package by package, so it will also work for huge files.
*& Report ZBI_DOWNLOAD_APPSERVER_FILE
REPORT zbi_download_appserver_file.
PARAMETERS: lv_as_fn TYPE sapb-sappfad
DEFAULT '/usr/sap/WBP/DVEBMGS00/work/ZBSPL_R01.CSV'.
PARAMETERS: lv_cl_fn TYPE string
DEFAULT 'C:\Users\atsvioli\Desktop\Budget Backups\ZBSPL_R01.CSV'.
START-OF-SELECTION.
CONSTANTS blocksize TYPE i VALUE 524287.
CONSTANTS packagesize TYPE i VALUE 8.
TYPES ty_datablock(blocksize) TYPE x.
DATA lv_fil TYPE epsf-epsfilnam.
DATA lv_dir TYPE epsf-epsdirnam.
DATA ls_data TYPE ty_datablock.
DATA lt_data TYPE STANDARD TABLE OF ty_datablock.
DATA lv_block_len TYPE i.
DATA lv_package_len TYPE i.
DATA lv_subrc TYPE sy-subrc.
DATA lv_msgv1 LIKE sy-msgv1.
DATA lv_processed_so_far TYPE p.
DATA lv_append TYPE c.
DATA lv_status TYPE string.
DATA lv_filesize TYPE p.
DATA lv_percent TYPE i.
"Determine size
SPLIT lv_as_fn AT '/' INTO lv_dir lv_fil.
CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
EXPORTING
file_name = lv_fil
dir_name = lv_dir
IMPORTING
file_size_long = lv_filesize.
"Open the file on application server
OPEN DATASET lv_as_fn FOR INPUT IN BINARY MODE MESSAGE lv_msgv1.
IF sy-subrc <> 0.
MESSAGE e048(cms) WITH lv_as_fn lv_msgv1 RAISING file_read_error.
EXIT.
ENDIF.
lv_processed_so_far = 0.
DO.
REFRESH lt_data.
lv_package_len = 0.
DO packagesize TIMES.
CLEAR ls_data.
CLEAR lv_block_len.
READ DATASET lv_as_fn INTO ls_data MAXIMUM LENGTH blocksize LENGTH lv_block_len.
lv_subrc = sy-subrc.
IF lv_block_len > 0.
lv_package_len = lv_package_len + lv_block_len.
APPEND ls_data TO lt_data.
ENDIF.
"End of file
IF lv_subrc <> 0.
EXIT.
ENDIF.
ENDDO.
IF lv_package_len > 0.
"Put file to client
IF lv_processed_so_far = 0.
lv_append = ' '.
ELSE.
lv_append = 'X'.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = lv_package_len
filename = lv_cl_fn
filetype = 'BIN'
append = lv_append
show_transfer_status = abap_false
TABLES
data_tab = lt_data.
lv_processed_so_far = lv_processed_so_far + lv_package_len.
"Status display
lv_percent = lv_processed_so_far * 100 / lv_filesize.
lv_status = |{ lv_percent }% - { lv_processed_so_far } bytes downloaded of { lv_filesize }|.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING "percentage = lv_percent - will make it fash
text = lv_status.
ENDIF.
"End of file
IF lv_subrc <> 0.
EXIT.
ENDIF.
ENDDO.
"Close the file on application server
CLOSE DATASET lv_as_fn. -
TS1538 how to download files from laptop to ipad air
how to download files from laptop to ipad air
Sync them via iTunes as you would with any other iDevice.
-
how to move downloaded files from download folder to other relevant folder or how to download files in relevant folders other than download folder
Just drag the file from the Download folder to the folder of your choice in Finder. If you are using Safari you can designate a new default download destination in Safari>Preferences>General tab, 'Save Downloads to...'. Other browsers should have a similar option in their preferences.
-
How to download file from server to client's local ??
How to download a file from the server to the client's local machine in a particular folder without users intervention ie. 'Save As" prompt of the browser should be avoided and if the client clicks on "Download" button, the file should get automaticaly downloaded to say, "c:/reports/' on his/her local machine. This is for Java based web appliaction.
http://jguru.com/faq/view.jsp?EID=10646
-
How use class file in jsp(very urgent)
i have class file called birds (birds is actually a xslt file transformed to java class file) now this class file i have to use in my jsp file. how can i use them. if possible can any one give me sample code please very urgent
can any one help mejava files
import org.w3c.dom.*;
import javax.servlet.http.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
import java.io.*;
public class XmlParser
public String XmlParser()
try
String strXML= "employee.xml";
String xslFile = "employeeId.xsl";
TransformerFactory tFactory = TransformerFactory.newInstance();
StreamResult theTransformationResult = new StreamResult( new ByteArrayOutputStream() );
Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile));
transformer.transform(new StreamSource(new StringReader(strXML)), theTransformationResult);
String output = theTransformationResult.getOutputStream().toString()
catch(Exception e)
System.out.println(" ***** XmlParser.XmlParser ERROR ***** " + e);
return output;
using class files in jsp
<%@ page import="com.qqqq.aaaa.XmlParser"%>
<%
XmlParser xmlParser = new XmlParser();
out.println(xmlParser.XmlParser());
%>
i think it will help you. -
dear all,
to download a *.txt-file via jsp i use following code:
java.io.File file = new java.io.File("C:\\FileName.txt");
response.setHeader("Content-Disposition", "attachment;filename=\""+file.getName()+"\";");
response.setContentType("APPLICATION/OCTET-STREAM");
response.setContentLength((int) file.length());
if(file.isFile()){
java.io.FileInputStream fis = new java.io.FileInputStream(file);
java.io.BufferedOutputStream bos = new java.io.BufferedOutputStream(response.getOutputStream());
byte b[] = new byte[(int)file.length()];
int read = 0;
while((read = fis.read(b)) != -1){
bos.write(b,0,read);
bos.flush();
fis.close();
bos.close();
} the problem is:
the file will be displayed in the browser IE6 (inline), but i want to open a save-dialog!
any ideas?!
thanks for help. andyup to now i tried another browser (mozilla firebird) and several settings about the contenttype like:
- application/x-download
- application/x-msdownload
- application/x-octet-stream
- application/octet-stream
- application/download
... and the file-name like:
*.zip
*.txt
*.exe
but the browser shows the content of the file always inline (even *.zip and *.exe files!!).
anyway, thank you for help.
andy -
How to download files by using ipad
How to download the pictures or files from ipad4 using safari browser,it always says it cannot be downloaded
What alternative is available to solve this issueIn either Applet or AppletContext you should find 2 methods
getCodeBase()
getDocumentBase()
it is possible that those methods may return the same URL although they might not depending on how everything's set up. But anyway you can use that to get a URL and use the URL to open a connection -
How to download files from the internet??
I am a new Mac user, and I am soooo befuddled by downloading files, and what to do with them once they are on the desktop/under devices in Finder. Would someone here be kind enough to explain how to do this, please, or show me in the forum where this is already covered? Thank you very much in advance.
Hiya,
Downloading files is simple. All downloads appear in a download window that will open up. Once they are downloaded, you can click the "clear" button if you wish - you don't need them in there any more, and close the window. Files will then be wherever they're set to download to in your Safari preferences - Desktop, Downloads folder etc - and can then be used as you wish, opened, edited, moved. You can drag the files from the desktop into folders in finder. Sadly, someone at Apple foolishly thinks having no "cut" option in finder as you do in windows was a good idea - not quite sure how they came to that conclusion - so you'll have to drag the files from one folder to another, or copy them and then delete the original.
If you're downloading compressed files (.zip) you may want to look up "Stuffit Expander" - a great file extraction tool.
Hope this was the information you're after. -
ADF: how to download files?
good day,
does anyone know what the best way is to download a file to the client side using ADF? is this a trivial thing to do? i can find docs online on how to upload files using ADF but nothing for downloading files using ADF.
initially, my thought was to use the FacesContext ResponseStream; but quickly realized that facesContext.getResponseStream returns a null with in my backend bean. so, i decided to bypass ADF and use HttpServletResponse's ServletOutputStream and simply write to this object. this works fine but ran into another problem, this comletely bypasses the ADF framework. after downloading the file ADF does not know what state it is in (i.e. my pages do not get updated). nothing gets updated via ADF.
a second approach was to to kick off writing the Servlet OutputStream in a separate thread and have the backend bean return first. well... ran into another problem: java.lang.IllegalStateException: getOutputStream() has already been called!. obviously, i do not understand how the response mechanism works for servlets :-( it appears that per request the ouputstream can be only written to/flushed once.
so if anyone has a way to correctly download a file using ADF please share.
thank youLius,
thank you for the link. i read through it.
for a existing file on the server a redirect works. but what if i do not have a physical file on the server and i simply want to write it from memory to the client side. i would like to write an outputstream object from the server directly to the user's browser.
from the backend bean i do the following:
ServletOutputStream out = response.getOutputStream();
ByteArrayOutputStream outputStream = getOutputStream();
// Reading the bytes through buffered input stream and writing the
// presentation to the servlet output stream in the form of bytes
// using
// buffered output stream\
while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
// Flushing the buffers of Http Response. this is bad for ADF.
response.flushBuffer();
and once i flush the buffer here it returns to the client and the user can than download the file but it completely bypasses the ADF framework and i am unable to make any ADF callbacks (i.e. send messages or use adf progress bar) :-(
is there a way to download a file to an ouputstream without having it on the server side as a file.
thanks for you help,
joon -
How to download files from Application Server of Unix o.s to local director
Hi All,
I am trying to download files from Apllication server of Unix operating Systems to local file in excel sheet format using a z-program.but whenever I am trying to use OPEN dataset ........
it is showing sy-subrc = 8.
Can I have any clew please.
Thanks in advance,
Regards,
AMEER.Hi Sreekanth,
Thanks a lot for quick reply.I have to download that files from z-program only. I am giving you my code below.
*& Report ZTRAK_DOWNLOAD *
REPORT ZTRAK_DOWNLOAD MESSAGE-ID ZCT .
SELECTION-SCREEN BEGIN OF BLOCK DOWNLOAD WITH FRAME TITLE TEXT1.
PARAMETERS :
SERDIR LIKE RLGRAP-FILENAME DEFAULT '/usr/trak',
LOCDIR LIKE RLGRAP-FILENAME DEFAULT 'C:\Trak'.
SELECTION-SCREEN END OF BLOCK DOWNLOAD .
SELECTION-SCREEN BEGIN OF BLOCK INFO2 WITH FRAME.
SELECTION-SCREEN COMMENT 1(79) TEXT2.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT 1(79) TEXT3.
SELECTION-SCREEN END OF BLOCK INFO2 .
SELECTION-SCREEN BEGIN OF BLOCK INFO3 WITH FRAME.
SELECTION-SCREEN COMMENT 1(79) TEXT4.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT 1(79) TEXT5.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT 1(79) TEXT6.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN COMMENT 1(79) TEXT7.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN COMMENT 1(79) TEXT8.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN COMMENT 1(79) TEXT9.
SELECTION-SCREEN END OF BLOCK INFO3.
*- Internal Table to output data in Excel
DATA: BEGIN OF tab_excel OCCURS 0,
col1(50),
col2(132),
col3(255),
col4(100),
col5(100),
col6(50),
COL7(60),
col8(30),
col9(30),
col10(30),
col11(20),
col12(15),
col13(15),
END OF tab_excel.
DATA: FILE LIKE RLGRAP-FILENAME .
DATA: W_DATASET(80).
INITIALIZATION.
TEXT1 = 'Download Reports'.
TEXT2 = 'The Program downloads the reports generated by Trak'.
TEXT3 = 'Utility from Server to Local PC.'.
TEXT4 = 'Check the following before executing the Program.'.
TEXT5 = ' 1. A valid Server path is provided.'.
TEXT6 = ' 2. A valid Local PC path is provided.'.
TEXT7 = ' 3. Local PC has 10 MB free space.'.
TEXT8 = 'The report can be executed in the forground.'.
TEXT9 =
'The report should be executed after execution of Transaction TRAK'.
AT SELECTION-SCREEN.
IF SERDIR EQ ''.
MESSAGE E001(ZCT).
ENDIF.
IF LOCDIR EQ ''.
MESSAGE E002(ZCT).
ENDIF.
START-OF-SELECTION.
Download ABAP Development Summary Report
FILE = '\ABAP_Report_Developments.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/ABAP_Report_Developments.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download BDC Development Report
FILE = '\BDC_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/BDC_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Development Summary Report
FILE = '\Developments_Summary_Report.XLS' .
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/Developments_Summary_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Enhancement Development Report
FILE = '\Enhancement_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/Enhancement_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download field exit Development Report
FILE = '\Field_Exit_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/Field_Exit_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Frequency & Purpose Report
FILE = '\Frequency_And_Purpose_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/Frequency_And_Purpose_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Function Group Developments Report
FILE = '\FunctionGroup_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/FunctionGroup_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Function Module Developments Report
FILE = '\FunctionModule_Developments_Report.XLS' .
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/FunctionModule_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Include Developments Report
FILE = '\Include_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/Include_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download UserGroup Developments Report
FILE = '\UserGroup_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/UserGroup_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Modified_Standard_SAP_Objects_Report
FILE = '\Modified_Standard_SAP_Objects_Report.XLS' .
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/Modified_Standard_SAP_Objects_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Include Developments Report
*FILE = '\Include_Developments_Report.XLS'.
*CONCATENATE LOCDIR FILE INTO FILE.
*W_DATASET = '/Include_Developments_Report.dat'.
*CONCATENATE SERDIR W_DATASET INTO W_DATASET.
*PERFORM INIT.
Download SAP Script Developments Report
FILE = '\SAP_Scipt_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/SAP_Scipt_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Transaction Developments Report
FILE = '\Transaction_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/Transaction_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download User Exits Developments Report
FILE = '\UserExits_Reports.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/UserExits_Reports.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download ABAP Query Developments Report
FILE = '\ABAPQuery_Developments_Reports.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/ABAPQuery_Developments_Reports.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
Download Functional Area Developments Report
FILE = '\FunctionalArea_Developments_Report.XLS'.
CONCATENATE LOCDIR FILE INTO FILE.
W_DATASET = '/FunctionalArea_Developments_Report.dat'.
CONCATENATE SERDIR W_DATASET INTO W_DATASET.
PERFORM INIT.
MESSAGE S003(ZCT) WITH LOCDIR.
END-OF-SELECTION.
This routine checks whether file exists if yes downloads it to
the Local PC
FORM INIT.
OPEN DATASET W_DATASET FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
READ DATASET W_DATASET INTO tab_excel.
APPEND tab_excel.
CLEAR tab_excel.
ENDDO.
PERFORM DOWNLOAD_FILE.
ENDFORM.
This routine downloads the data in an XL format on local PC
FORM Download_File .
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = FILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = tab_excel
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF sy-subrc <> 0.
message ''. " Error in file transfer
ELSE.
CLEAR TAB_EXCEL.
REFRESH TAB_EXCEL.
FILE = ''.
W_DATASET = ''.
ENDIF.
ENDFORM.
I have created those files in Application Server running in another z-program in background mode.Then I am trying to download those files using above the program.I am creating those trak/Trak files manually and I can able to see those files in A.S level.But when downloading the same files I am facing the problem.
regards,
Ameer -
How to download file with Save As dialog
I am trying to download files with a Save As dialog, according to Jason Hunter's instructions in Jave Enterprise Best Practices.
String filename = "content.txt";
// set the headers
res.setContentType( "application/x-download" );
res.setHeader( "Content-Disposition", "attachment; filename=" + filename);
// send the file
OutputStream out = res.getOutputStream();
returnFile( filename, out);
The file content.txt is in the root directory of my webapp. But I get this stack:
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.io.FileNotFoundException: content.txt (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:64)
at com.interwoven.cssdk.examples.servlets.FileDownloadServlet.returnFile(FileDownloadServlet.java:43)
at com.interwoven.cssdk.examples.servlets.FileDownloadServlet.doGet(FileDownloadServlet.java:24)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
at java.lang.Thread.run(Thread.java:484)The root of the webservers changes from server to server and
sometimes it depends on the path you run webserver exe.
The best i have found to overcome this kind of problems is by
using getResourceAstream() method which basically looks at classpath locations only, but still this has some problems like it should kept at the
specified classpath becoz the getResourceAsStrem() method is not static
method and it always associated with the class object and the file
accessing also should be in the same package/classpath.
by using getResourceastream you cannot look at other places (except classpaths)
and this should be used only if you looking for .properites definitions.
the Second best method is
see you have a file called "context.txt" right
before you create a file, first create a directory at the root, let say
"\tmp"
and then create a file \tmp\context.txt
and then open an output stream to it either using fileoutputstreamm...
and then write all output content to servlet/client output stream.
this will be the best becoz you are specifying the "\" the root
and this is common for all operating systems and definitely it will create at the root directory either serverroot or harddiskdrives root
so you will never missout and the exceptin will also not comes along the way
cheers..
if you get new thing , let me know
bye
with regards
Lokesh T.C -
How to download files or video from safari to be saved in an Apps?
Hi, can I find out a way to download video opened in safari in iPad, but don't want to save it in iPad and use up the space. Is there any Apps that I can save those files downloaded? Thanks!
You can't download files in Safari anyway, but even if you use another app to save the video, it will still take up space on your iPad.
It's not possible to store something on your iPad without it taking up space. -
Urgent!! downloading file in jsp
hi all
can anyone plz help me in downloading file from my disk
actual scenario is like this
i have uploaded file path in database, and whole file in to my disk....
i have given links to file name and when one clicks the link the file of that link should be downloaded / opened from the path specified in the database
its really too urgent
plz help me outThe replies on this post : http://forum.java.sun.com/thread.jspa?threadID=5170452&messageID=9655276 should give you some idea
Maybe you are looking for
-
I would like to watch movies and Netflix that a stream on my computer to my regular TV instead of my monitor. I was wondering if a product existed that allowed me to come out of the Computer (DVI) into a splitter or switch of some sort and then out t
-
Expired Password - PLEASE HELP!
Does anyone know how to go about changing all the Administration Passwords? Our DBA set up the lastest 10g version of portal on our server and sent us the URL with the user log in details. Well now we try to log in and it says password has expired co
-
Problem with SWF export and audio looping
When I export from Keynote into SWF, I get an odd audio looping problem when playing the SWF files. Here's the workflow: Create Keynote presentation (includes transitions typically, but also happens with presentations that don't). Record audio using
-
Adobe Presenter 10 Drag and Drop questions - only grey box when trying to create
Hi, I try to create drag and drop questions in Presenter 10 and after clicking on Add Question -> Drag Drop, the new window opens but where I should be able to define the questions etc, the screen is just grey. Have the same issue on three other syst
-
IMPORTING AFTER EFFECTS FRACTAL NOISE?
If I create a fractal noise comp in AE that is the same dimensions as the photoshop file that is going to be used for printing then will that after effects fractal noise comp be suitable for high quality printing? I am not using fibres as I find it n