Convert jsp processed result into a file??
when a JSP file has been processed, it returns HTML codes to browser, so how can i get that pure HTML source code and save it in an other html files.
If you have a good idea, open your JSP file and (in Sun ONE anyways) you can right click and do "Show JSP Code in Servlet" since a JSP is just translated into a servlet anyways (you could alos find the <Your JSP>.java file in your web server's working directory.
Anyways you will see a lot of out.println() statements where out is the response writer. So your options are:
1. Create a FileWriter fwOut and copy all the out.println() statements and paste them as fwOut.println()'s.
2. Create a class (or find one) that mimics the tee functionality in the UX world ie the class myTee opens the respose writer and the FileWriter, then some method (like myTeePrintln()) would take the input as a string and write it to both the response and FileWriter (and flush the streams).
3. http://nitric.com/jnp/source/jnp-src/Tee.java
If helps, I'm hungry for Dukies!
--Thunder
Similar Messages
-
Write the ldapsearch results into a file
We are using ldapsearch from the command line and want to write the search results into a file. How can we do this?
What OS are you using - If Unix / Linux then use the standard redirection > or >> facility.
-
Write big query results into a file ? ? ?
Hi all,
The problem is: I want to write a simple query results into a file. I have no idea how to do that. Only thing I know is utl_ functions. Please advise GURUS how can I use them for big queries. Any example will be really appreciable.
Thank you in advance.
Message was edited by:
v838hi,
i´ld do it like that:
filedir varchar2(30):= '/usr/frajo/';
filename varchar2(30):= 'file.txt';
fhandle utl_file.file_type;
cursor x is
select ... (what ever)
begin
fhandle := utl_file.fopen (filedir, filename,'a');
open x;
loop
fetch x into (what ever)
exit when x%notfound;
utl_file.put_line (fhandle,'text and you results');
end loop;
utl_file.fclose(fhandle);
end;
happy xmas. franz -
Saving jsp query results to csv file
I have a query form jsp application which does as you would expect - throw in some search parameters - results set is returned - my question is how I go about writing an instance to save these results into a csv notepad file. I've used JBuilder a lot and within that it is relatively simple to create a save-to-file instance - is it the same within JDeveloper?? Sorry if this is a fairly obvious question - I just havent come across anything in the docs yet
Try this in a JSP:
<%
response.setContentType( "text/x-csv" );
response.setHeader( "Content-disposition", "inline;filename=myfilename.csv" );
%>
"value1","value2","value3"
"valueX","valueY","valueZ" -
Help... Why did the dvd to ipod converter split one movie into 2 files?
I have a 80GB Video Ipod and I'm confused on why when I ripped a dvd using the dvd to ipod converter for mac program it split the dvd into 2 files.. Is there a way I can merge the files together so it is 1 file?.. I would apprciate any help or suggestions...
G3 Ibook.. 15, 40 and 80GB Video Ipods... G4 PowerMac Mac OS X (10.4.2)Go to their support forum and ask-you will get a better answer from people who actually use the program.
It's not a paid for program is it?
A totally free program that rips and converts DVD's for Macs can be found here: http://handbrake.m0k.org/
Why would anyone on a Mac pay for a DVD rip program? -
Saving a process/thread into a file
I want to simulate a Object Oriented Database using a Process or a Thread. I need to save and load a the thread quickly and if possible, I would like not to serialize. Is there a way to just dump the Thread status and memory content into a file and Load it back when I load the application? or do I need to serialize all the objects and recreate them every single time?
It's an interesting area of CS research to be able to do this, but unfortunately not possible in Java. Once you start thinking about the fact that, in the internals, all the object references and such are just pointers to blocks of memory, and when you dump the memory to disk, and load it back in... the object data may not be in the same place as it was when you first had it loaded. This makes all the pointers break, etc...
Now, once you start thinking about things like open file handles and network sockets, or thread/process stacks, registers (even in Java, virtual registers) and execution locations... it's kind of mind-boggling that there are people out there smart enough to be working on a way to do it!
Anyways, no there's no way to do it in Java.. you've got to serialize all your objects, and start back from scratch- furthermore, to my knowledge, there's absolutely no way to pick up program execution where it left off (i.e., if you were in the middle of executing a method when you dumped to disk). Could be wrong about that, though...
Sorry I went on like that, hope it was informative at least! -
How to convert a large PDF into smaller files
How does one convert a large PDF file into smaller files and not get odd page breaks. Need to get the page breaks at the headers. Just looking for instructions for an end user of Acrobat Pro who reports getting random page breaks and couldn't get help from the Adobe help desk. I was directed here when I tried to contact support ... Figure this forum may have information. ... thanks.
You can't. If you split the file into pages it will remain in the same layout the original has. PDF files were not meant to be edited in the way you're describing.
-
How to programmatically extract VL10C results into a file?
Hi Experts,
I need to extract VL10C results programmatically into a file for a downstream non-SAP application to consume.
What's the best way to do it in a ABAP program?
Many thanks!
-Lilyif you have some enhancement points (ECC) or user exit before the data is thrown to show on screen, use Export to memory in the code of VL10C and write one custom program where you import that memory to a local structure.
OR
Schedule a background job of this program get the spool and download the spool to local file.
There are lots of program in SCN / WIKI and lots of thread which would help more to do this... -
Converting left channel audio into stereo file
I'm using an edirol ua 25 which has two inputs, 1 which is a left channel and 2 a right channel. As i'm using the first input, the recorded audio pans hard left, how do I go about converting the recorded audio into a central stereo file?
Why do you want to change it to stereo? It isn't a stereo (two-channel) recording, it's a mono, single-channel recording.
Mono is not somehow "worse" than stereo, don't feel that need that everything should be recorded to two channels, it's a waste of resources.
You can pan it anywhere in the stereo field - with the pan knob central, the mono track will be centered in the stereo field. You can pan it left or right accordingly. -
30EA2 - refuses to unload results into new file
With ver 3.0.02.83 I'm getting "Not writable" message every time when I try to unload the results into a new file. SqllDeveloper refuses to write to a new file and I have to preallocate it first and then answer yes on override question.
Does anybody else have the same situation?On what OS version?
K. -
How to convert the source code in JSP,HTML&BEANS into executable files?
Sir,
We are developing one s/w product in JSP,HTML&BEANS.Now we are in the implementation phase.During the time of Installation,without copying our source code in the customer's site I want to copy the executable files of the entire source codes? Is it possible in JSP,HTML&BEANS?In theory you can do it even with JSP but the you will be unable to run it on the standard JSP engine. :-)
From other hand, all critical logic should be in the Java Beans or at least in custom tags but not in the JSP code. Then you can protect that code and leave JSP open because there is nothing to steal or break. -
Export query results into .csv file?
Hello I have a T-SQL script that gets row counts for a specified date range and then needs to loop (by incrementing +1 day to get the next day's counts) for a large date range. I'm aiming to output & append each query results day counts
into a .csv file via a SQL Agent job since this will take quite a while to complete.
Would using the following as an example template...
INSERT INTO OPENROWSET('Microsoft.ACE.OLEDB.12.0','Text;Database=D:\;HDR=YES;FMT=Delimited','SELECT * FROM [FileName.csv]')
SELECT Field1, Field2, Field3
FROM DatabaseName
...be the method or something else?
If this is good to use I've tried running this but get the following error:
Msg 7357, Level 16, State 2, Line 76
Cannot process the object "SELECT * FROM [FileName.csv]". The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" indicates that either the object has no columns or the current user does not have permissions
on that object.
Thanks in advance.Hi Techresearch7777777,
The error in your post says that the file FileName.csv has to be created with the column names in the first row. Like:
Field1,Field2,Field3
Either you can create a schema.ini file under the same folder:
[FileName.csv]
Format=CSVDelimited
ColNameHeader=False
Col1=Field1 [DataType]
Col2=Field2 [DataType]
Col3=Field3 [DataType]
For the [DataType],you can reference
Schema.ini File (Text File Driver)
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
How to Convert an internal table into Text File
Hello friends,
Can you help me to find out the way to convert an internal table data into a flat file.
the problem is that my internal table contains fields with data type INT also.please go through the code and the parameter passed to the finction module ... since you didn't show your coding i am giving you the sample code also ..
REPORT y_ss_test_ekko .
* To hold selection data
DATA: i_ekko TYPE STANDARD TABLE OF ekko.
* To hold converted text data
DATA: i_text(4096) TYPE c OCCURS 0.
* Selection Screen
PARAMETERS: p_ebeln LIKE ekko-ebeln.
* Select data into an ITAB based on the selection Criteria
SELECT * FROM ekko
INTO TABLE i_ekko
WHERE ebeln = p_ebeln.
* Process further only if found some data
IF NOT i_ekko[] IS INITIAL.
* Convert data in internal table to a delimited text data
CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
EXPORTING
i_field_seperator = '|'
TABLES
i_tab_sap_data = i_ekko
CHANGING
i_tab_converted_data = i_text
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE: / 'Program failed to Convert data.'.
ELSE.
* Download convert data to Presentation Server
CALL FUNCTION 'DOWNLOAD'
TABLES
data_tab = i_text
EXCEPTIONS
OTHERS = 8.
IF sy-subrc <> 0.
WRITE: / 'Program failed to download data.'.
ENDIF.
ENDIF.
ENDIF.
reward points if it is usefull ....
Girish -
Converting Dom Document object into XML file removes the DTD
Hi All
My xml is dtd. I have one xml file. i changed the node value after that i want to create a xml file with the same name. I created new xml file but i am not seeing the old dtd in the new file. This process is done with the help of jaxp.
My code is given below
File fileInput = new File("input.xml");
File fileOutput = new File("output.xml");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setExpandEntityReferences(false);
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(fileInput);
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
transformer.setOutputProperty(javax.xml.transform.OutputKeys.INDENT, "true");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
DOMSource source = new DOMSource(document);
FileOutputStream fos = new FileOutputStream(fileOutput);
StreamResult result = new StreamResult(fos);
transformer.transform(source, result);
Thanks in advanceThe Transformer API does not guarantee the preservation of that information. You may want to check the DOM L3 Load/Save package (http://java.sun.com/javase/6/docs/api/index.html). Alternatively, you may force things by setting the additional output properties 'doctype-public' and 'doctype-system'.
-
Loading Query results into a file/cache
Hi,
We have a Query which returns huge volume of data.
spooling all the records will take a lot of time.
Is there any other way through which we can load the results of this huge query into Oracle's Cache / File
Tables used in the Query are Range hash composite partitioned tables.
But, in the query only a single partition is being used.
Suggest any method to acheive the same.
Thanks,
Kris.Alex Nuijten wrote:
.... Blu, you're not suggesting that OP use the database what it's good for, are you?.... But then OP would loose database-independence...
:)Ermm.... darn it, you're right, what was I thinking. ;)
Anyway, should there really be a requirement to output the data to a file, then there's nothing wrong with using UTL_FILE...
SQL> ed
Wrote file afiedt.buf
1 declare
2 v_fh UTL_FILE.FILE_TYPE;
3 begin
4 v_fh := UTL_FILE.FOPEN('TEST_DIR','output.txt','w',32767);
5 DBMS_OUTPUT.PUT_LINE(TO_CHAR(SYSDATE,'HH24:MI:SS'));
6 FOR i IN (SELECT * FROM large_tbl)
7 LOOP
8 UTL_FILE.PUT_LINE(v_fh,
9 TO_CHAR(i.large_id,'fm999999')||','||
10 i.large_area||','||
11 TO_CHAR(i.large_line,'fm999999')||','||
12 TO_CHAR(i.datelogged,'DD/MM/YYYY')||','||
13 TO_CHAR(i.large_flag,'fm9')||','||
14 '"'||i.large_text||'"');
15 END LOOP;
16 DBMS_OUTPUT.PUT_LINE(TO_CHAR(SYSDATE,'HH24:MI:SS'));
17 UTL_FILE.FCLOSE(v_fh);
18* end;
SQL> /
09:01:08
09:05:20
PL/SQL procedure successfully completed.
Elapsed: 00:04:12.47
SQL> select count(*) from largetbl;
COUNT(*)
6637873Over 6.5 million records in 4 minutes 12 seconds, and that's with data formatting.
Maybe you are looking for
-
Failure to report error when redacting in Acrobat X
I have experienced a problem when using Acrobat X whereby after highlighting all of the text in a file that I wish to redact and then clicking redact certain passages of text fail to redact but fail to alert me of the failure. As I may be redacting
-
Error while using Create or Replace Java Soruce ....
Hello, I am very much new to JAVA. I got requirement which is very urgent. I have a Java file in the UNIX box and i am trying to put them in the Data base and call them through the PLSQL Package. These Java files were using for OA Framework, Now i ha
-
Bug in DLight process selection dialog
When running DLight on a host with a large number of processes, the child "/usr/bin/pargs" process spawned (presumably to collect a set of processes to present for selection) blocks writing to stderr. DLight needs to drain the stderr output stream of
-
Updated OS X and aperture doesn't work
updated operating system and now aperture doesn't work - it won't open.. I can't update it and it wants me to repurchase
-
Hello, I have some problem with my switch and the statistics. Im useing firmware: YA.15.13.0005 When I run "show interfaces" the counters are completely still. If I run "show interface 28" (witch is my uplink port) I get =============================