How to send the jsp page with the data as attachment

hi
my application is to display all the datas from the database.In the same page. i'm having a option to select mail address from the combo box and to send the page with the same format thru mail as an attachment .
<%      String from="192.168.10.1";
          String to=request.getParameter("to");
          System.err.println(to);
          String mailhost="localhost";
         System.err.println("hiiiiiiiii");
          try
               System.err.println("byeeeeeee");
               Properties prop=System.getProperties();
               prop.put("mail.smtp.host", mailhost);
               Session ss=Session.getInstance(prop,null);
            System.err.println("session props");
               Message message = new MimeMessage(ss);
               System.err.println("message");
               message.setFrom(new InternetAddress(from));
               System.err.println("form not null");
               message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
               System.err.println("from and to r set");
               message.setSubject("Hello JavaMail Attachment");
          // Create the message part
               BodyPart messageBodyPart = new MimeBodyPart();
          // Fill the message
               messageBodyPart.setText("have u got the attachement?");
               Multipart multipart = new MimeMultipart();
               multipart.addBodyPart(messageBodyPart);
          // Part two is attachment
               messageBodyPart = new MimeBodyPart();
               DataSource source = new FileDataSource("C:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/MgmtTool/emsReport.jsp");
               messageBodyPart.setDataHandler(new DataHandler(source));
               messageBodyPart.setFileName("emsReport.jsp");
               multipart.addBodyPart(messageBodyPart);
          // Put parts in message
               message.setContent(multipart);
               System.err.println("ready");
          // Send the message
               Transport.send(message);
               out.println("mail was sent successfully");
          catch(Exception e)
          {out.println(e);}
          %>
by using this code i 'm sending the emsreport page as attachment
i'm recieving only the tabular format but i cant able to get those data which are present on that page
i dont know wat to do???
kindly help me
thank u in advance

Some of the points might help you in thinking towards right direction, you might already know this but doesn't look like you are following in your code anyway.
1. The JSP that you are emailing is uncompiled source file. It need JVM environment to be able to run on.
2. The JSP is a view technology so try to separate the view logic from the business.
3. Try to put entire business logic in a Bean and use that in your JSP to start off with.
You may need to write the HttpServletResponse#content on to the Writer and then persist it on the filesystem. and then send that persisted file as an attachment.
Have a look at http://java.sun.com/j2se/1.5.0/docs/api/java/io/Writer.html
It provide different type of writer implementations.
HttpServletResponse#getWriter() provides PrintWriter instance.
Does it make sense?

Similar Messages

  • How to send the data from mac pc to External drive

    how to send the data from mac pc to External HDD
    or Pen Drive but with out deleting the preview as data

    You can use "Finder", which is in your dock, to copy files from your iMac folders over to the external hard drive.
    Hope this helps

  • How to send the data manually

    Hi Experts,
      I need small information.when messages are gone into queue state due to one message 
    When an EDI file came into wrong format and with that some messages are gone into queue state in MONI.
    if i cancel the first message then remaining all the messages are processing successfully.
    So from that cancel message i want sent the data manually as business needs that data.
    Can all please tell  me how to send the data manually with steps.
    Thanks in Advance.
    Bhaskar

    Hi,
    I think you are talking about QoS "EOIO", in which all messages are porcessed in FIFO order and whenever the preceeding message get stuck due to error in the queue, then all the messages are stoped. And yes as soon as you will cancel the message which went into error all the remaining messages will automatically will be delivered.
    In my opinion since QoS is EOIO then it will be not possible to sent the data mannually, you can do one thing, do not cancel the message. Try to correct the messge and then resend it.
    Regards,
    Sarvesh

  • How to send the data from jsp page to excel ???

    hi all,
    i want to send the data from my jsp form to excel sheet. any one can help me ??

    Hope this sample code might help :
    StringBuffer data = new StringBuffer();
    OutputStream ostream = response.getOutputStream();
    response.setContentType("application/vnd.ms-excel");
    response.setHeader( "Content-Disposition",
    "attachment; filename=sample.xls" );
    ostream.write(data.toString().getBytes());
    ostream.flush();
    Try it out.
    Swathi

  • How to integrate BIBean JSP page with Portal after deploying to iAS?

    Hi all,
    Right now we can deploy a JSP page contains BI Bean crosstab to iAS and can display the page using this url: http://xxx.xxx.xxx.xxx:7779/Application2/Analyze1.jsp.
    BIBean version: 10.1.2.0.2
    JDEV version: 10.1.2.1.0
    iAS version: 10.1.2
    Then according to a sample: http://otn.oracle.com/products/bib/htdocs/samples/samples_overview.html
    , we should test PDKProviderAdapter, but we don't know how to create a provider for it. In the sample project "Portal" I can find a "provider" floder contains provider.xml under the "web content" node.
    My question is : how to create the provider? which document or example can we refer to for help. Eagerly waiting for help.
    Thanks in advance.
    Scott

    thnx for your response.
    Basically we need to develop few JSP pages and that will insert data into the Oracle tables. These tables will hold user information for further processing. Now the requirement is to call these JSP pages from OBI dashboard. We can easily call the JSP pages if OBI runs on OC4J (that we have checked). But in our production environment we are having IIS server to run OBI. So our concern is how to deploy these JSP pages on IIS server?

  • How to send the quotation as attachment in notification

    Hi folks,
    I have a small clarification regarding workflows. I am creating a Quotation and Iam trigering the workflow . The Workflow gets trigerred and a notification is sent to the Manager . The Manager can either Approve or reject . If Approved the status of the Quotation gets changed to Approved. if Rejected the status of the Quotation gets changed to rejected. I am also sending the sales order number.  I have achieved upto this step.
    But I am not able to send the Quotation as attachment in the notification to the Manager. The Business Object for the quotation is  BUS20001.
    Please guide me how to send attachments in notifications.
    Regards,
    Palani.

    Hi Palani,
        You can acheive this by using the step type FORM.
    Regards,
    A.Fahrudeen

  • How to send the data to SQL server group in Reciever JDBC scenario

    Hi Experts,
    I have done IDOC to JDBC scenario, the data is successfully going to SQL server in reciever side, but in reciever side they got local server and other server groups also there, the data ia m sending is going to local server group, so where can i mention the other server group name in reciever JDBC adapter.
    Kind Regards,
    Praveen.

    Hi,
    Except if there is a way to specity this in the URL field (either using a suitable properties or a specific syntax), I do not see such feature in the JDBC adapter ... I'm not familiar with SQLServer group concept, but maybe you could use multiple receivers instead ?
    So far, I haven't been able to see how to use groups in the URL ... Maybe there is way to trigger replication at SQLServer level ? Stored proc ?
    Chris
    Edited by: Christophe PFERTZEL on Dec 9, 2009 11:26 AM

  • How to send inline HTML page in mail(not as attachment)

    Hi,
    I am using JavaMail to send details to users using text mail. Its working successfully. But now i have to send the details on mails that will contain HTML page (not as attachment but as inline HTML page containing text) and details in it. Plz help me. Its urgent.
    Thanks in advance,
    Devom

    Set the contentType to "text/html" and send away.
    (If you need both text and html you will need to make a multi-part message), this is covered in the FAQ.
    http://java.sun.com/products/javamail/FAQ.html
    travis (at) overwrittenstack.com

  • How to suppress printing of pages with no data

    Dear all,
    My report consists of 3 distinct sub reports. The first two sub reports should be printed as portrait on A-4 sheet while the third one should be printed as landscape A-4 . I have put the first two sub reports layout in the main section with orientation as portrait while the third one is placed in trailer section with orientation as landscape. The printing of subreports 2 and 3 is conditional. There may be case when first two sub reports get printed while we do not have third report as there is no data in the database for the same. In this case , I am still getting a blank page corresponding to the third sub report in the final report. How do I suppress this?
    Regards,
    Ranjit
    P.S. I am using Reports 6i

    maybe, you don't understand me.
    I have below jtable:
    ============================
    I column1 name l column2 name I
    ============================
    l data l data l
    ============================
    l data l data l
    ============================
    XXX
    ============================
    I wrote:
    table.setBackground(Color.black) then only data area has black colour, but XXX area hasn't black colour.
    How to XXX area also has black colour?
    help me, thanks very much.

  • How to send mail from linux with .txt file as attachment ..

    I want to send email from linux box and in the body of the email i want to have the content of dblog.txt file.
    I want dglob.txt file content to be part of the mail body.
    Thanks in advance!!

    Apr 29 15:19:35 lctwprddb01 sendmail[1616]: m3TJJZ4k001616: to=[email protected], ctladdr=oracle (500/500), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30109, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m3TJJZhB001617 Message accepted for delivery)
    Apr 29 16:04:52 lctwprddb01 sendmail[1422]: m3TIP6LJ031388: to=<[email protected]>, ctladdr=<[email protected]> (500/500), delay=01:39:46, xdelay=00:48:01, mailer=esmtp, pri=120423, relay=cluster2a.us.messagelabs.com. [216.82.249.211], dsn=4.0.0, stat=Deferred: Connection timed out with cluster2a.us.messagelabs.com.
    Apr 29 16:07:36 lctwprddb01 sendmail[1619]: m3TJJZhB001617: to=<[email protected]>, ctladdr=<[email protected]> (500/500), delay=00:48:01, xdelay=00:48:01, mailer=esmtp, pri=120425, relay=cluster2a.us.messagelabs.com. [216.82.248.44], dsn=4.0.0, stat=Deferred: Connection timed out with cluster2a.us.messagelabs.com.
    Apr 29 16:07:52 lctwprddb01 sendmail[1627]: m3TILs2r031176: to=<[email protected]>, ctladdr=<[email protected]> (500/500), delay=01:45:58, xdelay=00:48:01, mailer=esmtp, pri=120429, relay=cluster2a.us.messagelabs.com. [216.82.248.45], dsn=4.0.0, stat=Deferred: Connection timed out with cluster2a.us.messagelabs.com.

  • Pls let me know how to fetch the data from tables bdcp or bdcps

    Hi guru's!!!!
    I want to post the changed master data to the legacy.
    I am npt using IDOC. I want to go ahead by using the change doc. I want to know how we can filer the change doc. data for my equirement. & also how to send the data
    transaction wise. I am using the FMs "change_pointers_read.
    it is very urgent..
    Thanks in advance!!!!!

    Hi,
    1. You will have to activate the change pointers for the master data you are looking for.
    2. You can do the configuration so that whenever master data is changed, a IDOC is triggered for that master data.
    3. You can configure the IDOC's to be transmitted to your legacy system in the form of files or to your middleware system.
    <b>You don't have to read the CHANGE POINTERS yourself.</b>
    Regards,
    Ravi
    Note : Please mark all the helpful answers
    Message was edited by: Ravikumar Allampallam

  • How can I send email from an JSP page  with HTML format either using jsp

    hi,
    I have an jsp page with online application form,after compleating the form if i select submit it will send all the compleated data to the mail id we mentioned in the form tag,for this i am using javascript,but instead of receiving the data in the format of strings,my client want to receive the data in the same format as he's filling in the jsp page(html format) through e-mail.any help would be appreciated.the fallowing is the code right now i am using for email application.
    <code>
    function send()
    if(validatePersonalInfo(document.theform))
         document.theform.submit()
         location.href=location.reload()
    function validatePersonalInfo(form)
         var tmpStr ="";
         if (form.Name.value == "") {
              tmpStr = "Name";
              document.all.dName.style.visibility="visible";
              document.theform.Name.focus();
         else{
              document.all.dName.style.visibility="hidden";
         if (form.SSN.value == "") {
              tmpStr = tmpStr + ", Social Security Number";
         document.all.dSSN.style.visibility="visible";
         if(form.Name.value != "")
              {document.theform.SSN.focus();}
         else{
              document.all.dSSN.style.visibility="hidden";
    if (tmpStr == "") {
              return true;
         } else {
              alert("Please Fill the Following Fields: " + tmpStr);
              return false;
    <FORM NAME="theform" METHOD="post"
    ACTION="mailto:[email protected]?subject=Online Application Form for MinorityDealer." ENCTYPE="text/plain">
    <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="10" NOF="LY">
    <TH>
    <P>
         <FONT SIZE="3" FACE="Arial,Helvetica,Univers,Zurich BT">Online�Application</font></TH><BR>
    </TABLE>
    <table width="718" border="1" cellspacing="0" cellpadding="3" bgcolor="#CCCCFF" align="center">
         <tr>
    <td colspan="2"><font class="captionText">Name*�</font><br><input type="text" size="25" name="Name" class="bodyText">
    <div id="dName" name="dName" style="position:absolute;visibility:hidden"><font color="red">Name is Mandatory*</font></div>
    </td>
              <td colspan="2"><font class="captionText">Social Security Number*�</font><br><input type="text" size="9" name="SSN" class="bodyText">
              <div id="dSSN" name="dSSN" style="position:absolute;visibility:hidden"><font color="red">SSN is Mandatory*</font></div></td>
    </tr>
    <tr>
    <td colspan="2"><font class="captionText">Total Personal Assets</font><br><input type="text" size="10" name="TotPersAss3" class="bodyText"></td>
              <td colspan="2"><font class="captionText">Total Personal Liabilities & NetWorth</font><br><input type="text" size="10" name="TotPerLiab3" class="bodyText"></td>
    </tr>
         </tr>
    </TABLE>
    <IMG Valign="middle" name="imgSubmit" src="images/buttons/Submit.gif" width="66" height="29" border="0" alt="Submit">
    </code>

    Can any one do some help to solve this problem.
    Regards.

  • How to Hightlight the Data in Jsp Page

    How to Hightlight the Data in Jsp Page,
    I am doing doing search page,based on values given search page those are sent to servlet,in servlet based on some conditions if particuler id i am getting then i am redirecting to Respective jsp page with highlight the data from database..
    Thanks in advance...

    "Highlighting data in JSP sounds strange".
    Without looking at your search specific algorithms I feel you are finally going to display a page (HTML content) to user which contains highlighted text. Highlighting is not directly related to server side language you use (JSP, ASP, PHP etc.). This is purely HTML and CSS. However, server side script (such as JSP) should generate HTML content for getting highlight effect.
    Following HTML shows highlighted text using background-color property on span element.
    <html>
      <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
      </head>
      <body>
          <p style="font-size:1.1em">This is a long paragraph which contains <span style="background-color: yellow;">highlighted text</span> and non highlighted text.</p>
      </body>
    </html>Thanks,
    Mrityunjoy
    Edited by: mrityunjoy on 14 Jun, 2010 3:30 AM

  • How to send the payload to a jsp using receiver Http adapter?

    Hi experts,
    I have this scenario from Legacy to XI to external app server.I have a test jsp to execute that functionality .Its a jsp which has 1 textarea named "test" and when I click on the submit buton I get a response back.This way I am able to test this independently.Now from XI when I am executing my scenario I am getting status code '1250' and message as ' http request(test) is null'.Now in the scenario in http adapter I just provide the target host : ip of server ,
    service number : port no ,
    path: the container or the request handler. But this scenario fails and gives me the above erroneous response.Now Basically I am not able to get how to send the value to the textarea "test"? please provide help as soon as possible.Do we have to put the name of the jsp in the "path" in http adapter and use prolog as test=.I tried this but it doesnt work.
    Is there any way to check the URL that it forms after appending the querystring in the url ...?
    So please provide help on this or suggest a solution to [email protected] as soon as possible.....
    Thanx in advance.
    Akshata

    hey Shekhar,
    thanx for that prompt reply but I have configured the communication channel in the same manner as suggested by u.
    actually I have this jsp page http://xx.xx.xx.xx:8080/abcdef/try/efg.jsp where there is a textarea "test" which has to be filled and there is a submit button.When I test this http client i.e the above jsp page independently then it goes to handler
    http://xx.xx.xx.xx:8080/abcdef/trial/    And it gives a proper response message after clicking on the submit button.
    now I want to carry out the same using receiver http adapter. I need to pass the value for this inputfield names "test" on that jsp . so right now I have configyured the adapter as
    addressing type: url
    target host : xx.xx.xx.xx
    service no:8080
    path : here I have given the path of handler i.e /abcdef/trial I tried giving the jsp page also but logically I guess it should be the handler.
    content type: text/xml; charset=iso-8859-1
    xml code: UTF-8
    Mask special characters (URL escaping) checked.
    now since the name of the inputfield is "test" in the prolog I gave test=
    But it doesnt work I get this error "http request parameter [test] is null" in the response message  which I guess suggests that it is not able to send the value for the field"test" to that handler.Please suggest how to send this and tell me if there are any other configurations that I have to do in the receiver communication channel.
    Thanx ,
    Akshata

  • How to redirect a JSP page after the session is killed

    Hello!
    I am quite new to JSP. I have a question about how to redirect a jsp page after the session is killed. Could anyone help?
    thanks a lot in advance!

    You can't, directly. There's no connection betweenthe server and browser.
    even after invalidating the session. we can do it
    directly using the statement
    response.sendRedirect("....");
    or we can use the meta refresh tag.if session is invalidated and if we try to do response.sendRedirect(".. ") it throws IllegalStateException

  • How to send the Adobe page as mail attachement from webdynpro...

    Hi Experts,
    How to send the Adobe page as external mail attachment from webdynpro automatically (for example: If I input the data for sales order in a view and created the sales order, if the sales order is created then have to place the created sales order number and the some details in a adobe form and should send as external mail and have to specifying the body as "Sales order created and details can be found in the attached adobe form" from webdynpro).
    Do the needful.
    Thanks & regards,
    Ravi.

    Hi ravi,
    See the WDA forum for the how to attach a file in webdynpro component for the attachments.

Maybe you are looking for

  • How to delete all data in a table

    What's the best way to delete all of the data from a table? I wan't to do a data wipe of our database to eliminate all of the test data we've been putting into it over the last few months. I've tried using: DELETE FROM TABLENAME; but killed SQL+ afte

  • Migrating a 2009 mini to a 2013 macbook pro

    I want to migrate my licensed applications from a 2009 mac mini to my new 2013 macbook pro. What is the best method? firewire 800 to ethernet, or firewire 800 to thunderbolt? Or should I just manually reinstall all of these applications from scratch?

  • Spotlight not finding files it should be, including file types it shouldn't

    I have several folders and documents with the word "Kiosk" in the name as a full word (not as part of another word or preceded by an underscore.) When I search my hard drive for "Kiosk" spotlight shows no results. These documents are in my documents

  • I tunes problem

    i had the problem on itunes when i opened it it said 'the file i tunes library cannot read because it was created by the a newer version'. well, i looked up how to fix it, followed the steps and it didn't work. but now i had a mess of copied librarie

  • Apple intentially delays shipment

    Do you know apple has an agreement with ups to delay shipment intentially?