Saving the output from a JSP request
I have developed a decision support web site that amongst other things generates a "report" page. Now my client would like to add the ability for users of the site to have that report emailed out to them.
Sending the email obviously isn't a problem, but getting the content into it is. I really don't want to have to duplicate all the JSP code from the report page (there's a lot, including calls to beans etc), and reformat the entire thing with hundreds of out.write("<table>") like statements, or nasty plain-text formatted equivalents.
So...is there a way to "save" the output generated by the server before it gets sent back to the user - ideally to a local file that I can then just dump straight into the email message. I can't just call the page (internally on the server) to see its output, as it's user-specific and uses a lot of session-related information.
Cheers for any advice...
Iain
It's actually possible to do what I want to do by getting the server to call the page internally (I didn't think it was).
A simple URLConnection to the appropriate page with the jessionid appended gives me back the page as the user would see it. I can then just stream the response from that to file/email/whatever.
When the user clicks on their "email" link, I just call a jsp file (or a servlet) with the following code:
URLConnection uc;
BufferedInputStream fin;
BufferedOutputStream fout;
String location = "http://localhost:8080/blah/report.jsp"
+ ";jsessionid=" + session.getId();
String filename = "C:\\output.html";
try
uc = new URL(location).openConnection();
fin = new BufferedInputStream(uc.getInputStream());
fout = new BufferedOutputStream(new FileOutputStream(filename));
int byteRead = fin.read();
while (byteRead != -1)
fout.write(byteRead);
byteRead = fin.read();
fout.close();
fin.close();
catch (Exception e) {}Now all I have to do is go learn how to write multipart emails using JavaMail...
Similar Messages
-
While saving the output from Conc Prog it saves in .PCL instead of .XLS
Hi,
I have one concurrent program which gives Excel Output directly without using XML Publisher.
Using following Link I have designed the same.
[http://knoworacle.wordpress.com/2008/11/03/excel-output-directly-from-oracle-application-concurrent-request-output/]
Here it is giving problem when I click View Output Button after runing the concurrent request.
It should Open and Save the file with .XLS format. Instead of that it is taking .PCL format to save.
Please help me to get the file in .XLS and save it to local system.
Thanks
AlakaAlaka wrote:
Hi,
I have one concurrent program which gives Excel Output directly without using XML Publisher.
Using following Link I have designed the same.
[http://knoworacle.wordpress.com/2008/11/03/excel-output-directly-from-oracle-application-concurrent-request-output/]
Here it is giving problem when I click View Output Button after runing the concurrent request.
It should Open and Save the file with .XLS format. Instead of that it is taking .PCL format to save.
Please help me to get the file in .XLS and save it to local system.
Thanks
AlakaPerhaps you included the optional step 4 in your coding...
>
4. Hijack one of the little used Viewer Options (PCL) so that we can get the Concurrent Request output browser to automatically open Microsoft Excel. Note this is optional, you can just create a new Viewer Option but then you may get the “Choose Viewer” box when viewing concurrent request output. NB: Navigation path is System Administrator, Install, Viewer Options
update fnd_mime_types_tl
set mime_type = ‘application/vnd.ms-excel’
, description = ‘Excel (SYLK) used to be application/vnd.hp-PCL: Printer Control Language’
, last_updated_by = 0
, last_update_date = sysdate
where file_format_code = ‘PCL’
and mime_type = ‘application/vnd.hp-PCL’;
commit; -
How to retrieve the data from a jsp page for print?
i have a dynamic jsp file which will get the data at runtime.I have a print button in the jsp.When i chick the print button it should capture the data from the jsp and print it as LANDSCAPE mode. Now i am using Java Api for this
Following code is a working sample which prints some data in LANDSCAPE mode..This is working fine....How can i modify this to get the data from a jsp?....I am using weblogic workshop for development
package Awtjava;
//working example
import java.awt.*;
import java.awt.print.*;
public class testPrint implements Printable {
private static String s[];
private static Font f;
private static int nLines;
public static void main (String arg[]){
s = new String[10];
f = new Font("Arial", Font.PLAIN, 11);
int i;
s[0] = "This is a printer test";
for (i=1; i<10; i++){
s[i] = "The next line";
nLines = 10;
testPrint.printa();
public static void printa(){
System.out.println("public static void printa () ");
PrinterJob pj=PrinterJob.getPrinterJob();
Book b = new Book();;
PageFormat pf = new PageFormat();
pf = pj.defaultPage(pf);
b.append(new testPrint(), pf, 2);
pj.setPageable (b);
try{
if (pj.printDialog()){
pj.print();
catch (Exception e) { System.out.println ("Error"); }
public int print (Graphics g1, PageFormat pf, int n){
System.out.println("public int print");
int x,y,i,fa,fh;
FontMetrics fm;
Graphics2D g = (Graphics2D) g1;
pf.setOrientation(PageFormat.LANDSCAPE);
fm = g.getFontMetrics (f);
fa = fm.getMaxAscent();
fh = fm.getHeight();
x = (int)pf.getImageableX();
y = (int)pf.getImageableY() + fa;
g.setFont (f);
g.setColor(Color.black);
if (n==1){
for (i=0; i<10; i++){
g.drawString (s, x, y);
y += fh;
return PAGE_EXISTS;
else {
for (i=10;i<10; i++){
g.drawString (s[i], x, y);
y += fh;
return PAGE_EXISTS;
Hope you will reply soon...
Thanks in advance
MariaHey, I got a doubt that who will call the print method in the same program and what about the g.drawString() it is showing any output effect. Finally how the variable n will get initializing to 0 and 1 for two times respectively. Can u please elaborate on this...
-
Reading the output from a object running in the local machine.
Reading the output from a object running in the local machine.
By using a signed applet i am lunching a small application that returns an image object, how to read that without storing it in the hard disk.
Which means i need to read the image object return by the local application using applet or jsp .
i am using tomacat and an html page with an applet with it to lunch the application.You can write that image in a binary format using OutputStream for System.out and then read it in your applet.
-
How to capture the data from a JSP form
Hi
I have a JSP form, My task is to capture the data from a JSP and submit to Data Base. for example I have the field like
Enter Table name to be created in data base: The table name is to be captured by a servlet and by that table name, table should be created in the data base.
Edited by: Reddy_Prasad on ?? ?????, ???? ?:?? ???????
Edited by: Reddy_Prasad on ?? ?????, ???? ?:?? ???????Get the entered value from the jsp into servlet using request.getParameter("enteredTableName"). it will return the String,pass this table name to execute query using JDBC connection and statement objects.
-cheers Ram -
Saving the output of a .sql file in .csv format
Hi,
I am saving the output of a .sql file in .csv format. But the problem is , the record of few columns have "new line" character in it, so when it is getting saved in .csv format, those records are coming in multiple rows, but they should come in one single row in single block. Please advise how to overcome this problem.
Regards,
NirajHi Guys,
I guess, there is a misunderstanding.
He is talking about the issue caused as a result of the data containing a "CRLF" ( Carriage return Line feed ) .
That is mainly a data issue.
The query i presume, must be right.
I guess you should be able to fix it using some string functions.
Some thing similar to this
CREATE TABLE ASH (NAME VARCHAR2(10))
SELECT REPLACE(NAME, CHR(13)||CHR(10), 'ISH') FROM ASH;
SELECT REPLACE(NAME, CHR(10), 'ISH') FROM ASH;
SELECT REPLACE(NAME, CHR(13), 'ISH') FROM ASH;
depending on the type of new line whether it is CR or LF. or CRLF.
Regards
Ashish/- -
Is there a way to send output from a Concurrent Request via email in r12?
We are looking for a way to send emails out from the Concurrent Request output in r12.
Discussions internally have involved using Unix procedures/commands but we were looking for an EBS integrated solution if one is available.
I did find document 811716.1which seems to provide a solution, but the patches and information given are for 11i (we are r12). If this functionality is available in r12, is there any further documentation we can use?
Any assistance would be appreciated.
Thanks.
Kevin
Edited by: user3065048 on Jul 21, 2009 2:52 PMDuplicate post.
Is there a way to send output from a Concurrent Request via email in r12?
Re: Is there a way to send output from a Concurrent Request via email in r12? -
i am trying to display the output from my ipod touch on apple tv. i can get the audio but no video. Thank you for any advice.
What output are you trying to get to your tv?
-
Getting the output from a Perl script using Runtime.exec
I cannot get the output from a perl script using Java. Can someone PLEASE help?
I used the following code:
Process p = Runtime.getRuntime().exec("C:\\Perl\\bin\\Perl.exe script.pl) ;
InputSream in = p.getInputStream();
b...
do
System.out.println(b);
while ((b = in.read()) > 0)
But there is no way that I get the output in the inputstream. If I use the command "cmd script.pl", the output is displayed in the Dos box, but also not in the inputstream.
I will appreciate any help.Try this
Process p = Runtime.getRuntime().exec("C:\\Perl\\bin\\Perl.exe script.pl) ;
BufferedReader rd = new BufferedReader(new InputStreamReader(p.getInputStream()));
String str;
while((str=rd.readLine())!=null){
System.out.println(str);
Manu -
Is it Possible to upload the output from Oracle reports To Access database
Hi All,
Wish you All a Very Happy New Year.
I have a query.Is it possible to
upload the output from the Oracle reports
to the Access database???
Any suggestions would be appreciated.
TIA
sgHi sg,
Research the DDE option.
Dynamic Data Exchange (DDE) is a mechanism by which applications can communicate and exchange data in Windows.
I have imported data into the excel spreadsheet using DDE built in functions. I am sure it can work with MS Acess as well. If not, then you need to create a 2 step process .. reports -> excel -> access. -
Update LIKP table while saving the output type in VT02N transaction
Hi All,
I have a requirement where i have to update Delivery Priority(LPRIO) field in LIKP table while saving the output type in VT02N transaction. I am not able to use the BAPI "BAPI_OUTB_DELIVERY_CHANGE" or FM "WS_DELIVERY_UPDATE" because, when we save the output type the programs that are configured in NACE are triggered in update mode and hence i will get a roll back error.
Let me know other ways of updating the table at the time of saving output type for shipment transaction VT02N.This could be a result of one of the following reasons:
1: Incorrect smart form/routine assigned in the output configuration (NACE)
2: Serial number range of the delivery expired
3: The default settings of the user (SU01) processing the delivery is missing the default printer name.
Hope this is helpful
Manish -
Openshot + Blender: No frame was found in the Output from Blender
Can't get this to work. Anyone know why?
Using OpenShot version 1.4.0
blender -v
Blender 2.61 (sub 0)
build date: 2012-01-05
build time: 10:31:02
build revision: unknown
build platform: Linux
build type: Release
build c flags: -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fopenmp -msse2 -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing -Wall -Wcast-align -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=return-type -Wstrict-prototypes -Wno-char-subscripts -Wno-unknown-pragmas -Wpointer-arith -Wunused-parameter -Wwrite-strings -Wno-error=unused-but-set-variable
build c++ flags: -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -D__STDC_CONSTANT_MACROS -fopenmp -msse2 -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing -Wall -Wno-invalid-offsetof -Wno-sign-compare
build link flags: -pthread
build system: CMake
Blender command: blender -b '/usr/lib/python2.7/site-packages/openshot/blender/blend/blur.blend' -P '/home/user/.openshot/blender/fdd1c574-44dd-11e1-bf0d-54e6fc88c972/blur.py'
Traceback (most recent call last):
File "/home/user/.openshot/blender/fdd1c574-44dd-11e1-bf0d-54e6fc88c972/blur.py", line 150, in <module>
bpy.context.scene.render.file_format = params["file_format"]
AttributeError: 'RenderSettings' object has no attribute 'file_format'
No frame was found in the output from Blender
Blender render thread finished
Last edited by whoops (2012-01-22 09:47:37)yes, that is correct that it crashes with the new code when i have both made it a separate library function node and when i incorporated it into an existing code. the odd thing is that it actually seems to work now. i believe that i was using the wrong environment to call the new codes, which is why whenever i tried to revert to the original code previously, it still crashed. it seems that in order to be called, i need to use Deployment rather than Development and ppc instead of i386 in the active configuration and architecture in Xcode, respectively. while playing around with the iphone app, it must have reset my defaults to a non-labview friendly form. so now that i've got that part of the code working, i need to find out why it's still crashing on me. at first, i thought it must be the random number generator, but testing that separately in the code works just fine, so there must be something internal in the code. probably a memory allocation fault. but now that i can actually get everything running once more, i should be able to sort that issue out myself.
thank you very much for the help. sorry i didn't actually have anything to fix, unfortunately. i'm going to spend some time trying to debug this section of code to find where the fault lays. i may come back if i cannot find it in there, but hopefully it will not come to that.
take care and many thanks,
justin -
Need to fetch results as the output from QGA2
Hi Gurus,
My scenario is that i need to develop an interface in which I would send Material,Plant,MIC and Period from one system to SAP R/3 and I need to fetch the output as I get the output from QGA2 while i enter the above mentioned fields.
Input: Material,Plant,MIC and Period
Output:
1) Inspection Start Date
2) Inspection Lot number
3) Material
4) Material Description
5) UD code and code group
6) Quality Score( at inspection lot level)
7) UD code text
8) Valuation of characterstic
9) System Status of lot
10) Characterstcic description
11) Operation Number at which charaterstic was inspected
12) Characterstic Number inspected
Please let me know any BADI or FM which could help me in fetching out these values as standard QGA2 transaction does fetch out these values.
Thankshi
Please check
BAPI_INSPCHAR_GETREQUIREMENTS
BAPI_INSPCHAR_GETRESULT
BAPI Modify result lot inspection
Regards
Sujit -
Capturing the output of a jsp page and save that output in a WORD .doc file
Hi,
This is Naveen. I got stuck up with a problem/doubt. URGENT ! URGENT !
My doubt is how to capture the output of a jsp page(the content is dynamic generated) and save that output to a MS-Word doc file.
I know that therez an option of using Servlets Filters, but this concept is supported by Servlet 2.3 spec. and not earlier. And we are working on previous spec. and our web-servers also supports the prev. version and not the 2.3 version.
If incase, therez a third-party utility for free usage, suggestions are appreciated.
Hope most of them came across this kind of functional requirement. If anyone of them succeeded in this, please express ur bitter experience if any, faced during the coding.
Thanks in Advance for help.
NaveenYou can set the MIME content type as .doc and try to open the Page.
res.setContentType("application/vnd.ms-excel"); to generate the Page output as Excel
res.setContentType("application/vnd.ms-word"); to generate the Page output as MS Word doc
Hope this helps.. -
Can the output from ADC port power a HDTV
This is part of my other post http://discussions.apple.com/thread.jspa?threadID=2222857&tstart=0
*I've been told that the output from an ADC port is not sufficient to power a HDTV.*
I have my ADC port connected by a ADC/DVI adaptor cable to a HDMI port on my HDTV.
Is this correct?
Can anyone confirm it?This is the update for some NVIDIA cards.
<http://docs.info.apple.com/article.html?artnum=120168>
Maybe you are looking for
-
After I restore the computer, will I also lose Lion? If so, will it be possible to get it back? Will it be possible to catch back up to the latest software without having to spend any money? I bought and installed Snow Leopard when it came out, bu
-
Library loaded but unsatisfies
Hi All, I have the following problem: with the following signature generated by javah -jni -d media/huffyuv media.huffyuv.HuffYUVEncoder /* signature taken from generated .h file JNIEXPORT jint JNICALL Java_media_huffyuv_HuffYUVEncoder_openEnc (JNI
-
Web service Client developing!
Hi, I've developed a web service client with JDeveloper 9i. I did it using the WSDL file location and the stub/skeleton generator wizard. Once made it, I wrote a client class with a method as follows: // code beggining public static Integer calculato
-
After several minutes, it becomes "not responding" and then after several more minutes it ceases to be "not responding" but takes several more minutes to display an "unresponsive script" message. I killed the script, then several minutes more before
-
Problem with transfering attachment on item of purchase order in Sus
Dear customizer, I 'm implementing a scenario of plan driven procurement with R/3, i have a release of SRM SERVER 5.5,R/3 is connected to sus via XI. I'm not able to trasfer attachment and text from R/3 purchase order item to Sus purchase order item.