How to send the jsp page to .txt format

Hi All
Please suggest me how to create a .txt file using the desformat. My requirement is file should be saved as txt format and it will be sended by mail to be user pager. He can see the txt file through his pager. I tried several techniques but it not working.
I am using the following URL:
http://123.223 /reports/rwservlet? report=Admission.jsp&destype=file&desname=c:/demo/Admission.txt&userid=am/ampazz@tempdb
The above URL is correct or any changes required.
Pls suggest me…
Thanking all
Regards
Srinivas

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 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?

  • 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.

  • How to get the jsp page name in jsp?

    how to get the jsp page name in jsp? how the jsp get the jsp page name dynamic.
    thanks in advance.

    Try request.getServletPath()

  • How to test the JSP pages and sevlets using JUnit. ?

    How to test the JSP pages using JUnit. How to configure what are all the steps to execute the JUnit test cases.

    Hi xiepei,
    since you are using modbus, a simple error checking is implicit in the protocol and is the comparison between returned checksum and the calculated one on the received message: checksum errors, if any, are an effect of communications errors (you should have at least 2 bits changed and on particular patterns to have the checksum be calculated correctly!). You won't be able to calculate BER on them, but you can calculate PER (Packet Error Rate).
    Another flag for communication errors, on the other direction, is to intercept error messages from the device: if it fully implements modbus protocol, it should return some warning in case of error (I seem to remember that in some cases it returns the reveived message with some error bits added: please check in modbus documentation).
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How can I save web pages in .txt format?

    I often want to save information I find online so I can look at it later. When I open the 'file; save as' box, it offers me four options, one of which is text files. but no matter which option I choose, it always saves as a web page. I just want the basic text, in .txt format. How can I get it to do this?

    You should see the option for ''' "Text Files" ''' when going to save a web page, in addition to Web Page, complete and Web Page, HTML only - but that is probably going to have a lot more than just the pure text of that web page.
    This should work better, but you might miss some of what appears to be "text" when viewing the web page. <br />
    {Ctrl + A} to highlight the entire web page, then {Ctrl + C} to copy everything that is highlighted to the Clipboard. Then Paste the contents of the Clipboard into a Text Editor program, then use {Ctrl + S} to bring up the Save As... dialog. Name that file and make sure you include '''.txt'''.

  • How to export a JSP page into other formats

    Hi All!
    Actually, I am generating some dynamic reports using the JSP technology. However, i also want them to be exported into other storable formats like .Doc, .xls or .pdf.
    Is there any way of doing it? plz help. its urgent. Someone told me this could be done using JSF technology. Hence I am posting this thread here.
    Plz Help!
    Thanks & Regards,
    Rajat Aggarwal

    For outputting h:datatables (but not whole page) to excel, you can check out jsfexcelcreator
    http://www.jroller.com/page/mert?entry=jsfexcelcreator_sample_webapp_is_out

  • How to return the JSP page name

    Hello guys:
    for some reasons,i want show the page name on itself,but it always return NULL when use request.getPathInfo().
    Thanks

    Hiii,
    If you want the relative path....then the following will do the job.
    String vPath = request.getRequestURI();
    Otherwise you can get the whole path with the use of following.
    String rPath = getServletConfig().getServletContext().getRealPath("/your.jsp")
    Hope that helps.

  • Can any body tell me how to map the jsp page with sling servlet

    here is my content.jsp
    <%@include file="/libs/foundation/global.jsp"%>
    <cq:include script="/libs/wcm/core/components/init/init.jsp"/>
    <div>
    <h3>Login</h3>
    <form name="frm" method="doGet" action="/LoginServlet">
    <cq:include path="texot" resourceType="sapphirenow_web/components/foundation/textlog"/>
    <cq:include path="text1" resourceType="sapphirenow_web/components/foundation/textlog"/>
    <cq:include path="text3" resourceType="sapphirenow_web/components/foundation/submit"/>
        </form>
    </div>
    here is my LoginServlet.java
    package com.sapphirenow.web;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import org.apache.sling.api.SlingHttpServletRequest;
    import org.apache.sling.api.SlingHttpServletResponse;
    import org.apache.sling.api.servlets.SlingAllMethodsServlet;
    * @scr.component metatype="true"
    * @scr.service interface="javax.servlet.Servlet"
    * @scr.property name="sling.servlet.paths"  value="/bin/mn"
    * @scr.property name="sling.servlet.methods" values="GET"
    public class LoginServlet extends SlingAllMethodsServlet
      public void doGet(SlingHttpServletRequest request,SlingHttpServletResponse response) throws ServletException,IOException
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              String name = request.getParameter("Username");
              String pass = request.getParameter("Password");
              out.println("<html>");
              out.println("<body>");
              out.println("Thanks  Mr." + "  " + name + "  " + "for visiting roseindia<br>" );
              out.println("Now you can see your password : " + "  " + pass + "<br>");
              out.println("</body></html>");
       its showing "The requested URL /LoginServlet was not found on this server."  how to solve this pls help me

    Hi,
    Bellow some links which maybe hepls you:
    -> http://sling.apache.org/site/manipulating-content-the-slingpostservlet-servletspost.html
    -> http://edivad.wordpress.com/2011/07/18/cq-sling-servlets-resourcetype/
    -> http://sling.apache.org/site/servlets.html
    -> http://blogs.adobe.com/aaa/tag/sling
    and some threads from the forum:
    -> http://forums.adobe.com/message/4943006#4943006
    -> http://forums.adobe.com/message/4915799#4915799
    By the way there is a lot of information which you can find in th network.
    Regards,
    kasq

  • How to increase the size of textbox in the .jsp page of Human Workflow

    Hi All,
    I need to increase the size of the textbox in the .jsp page of Human Task.
    I am showint some text in the textbox which are currently not editable, and as the length of textbox is small, the complete text is not visible.
    If anyone know how to customize the jsp page of Human Task, please share.
    Regards,
    Vivek

    Thanks Eric,
    but i think this one is different.
    I am trying to edit the source of .jsp page in JDev. which has the code for textbox as below:
    <%=getField(payload, form, context, thisDisabled, locale, task, "CustID", "/ns0:task/ns0:payload/ns1:Customer_Verification_Data/ns1:Company_Information/ns1:CustID", "string")%>
    now how can i add some class format in .css file and how will i access that particular class in this textbox.
    Thanks,
    Vivek

  • How to view the JSP file from JBuilder 2007?

    Hi,
    I want to know that how to preview the JSP page from jbuilder 2007. whenever i am changing the jsp code, i would like to see the reflection in preview page. but i couldn't find that tab in jbuilder. Is JBuilder not supporting the preview feature ?? :-(
    awaiting for your immediate response.
    thanks
    pannar

    it's more likely because you lack even a basic understanding about both JBuilder and JSP.
    If you have even a modicum of intelligence the documentation is enough to get you up and running, but don't expect it to be a how-to document that holds your hand every step of the way through implementing an entire application from scratch.
    And no, we're not going to write something like that for you.

  • 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 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 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 use custome tag lib in the JSP page?

    How to use custome tag lib in the JSP page?...with JDeveloper

    http://www.oracle.com/webapps/online-help/jdeveloper/10.1.2/state/content/navId.4/navSetId._/vtTopicFile.working_with_jsp_pages%7Cjsp_ptagsregistering~html/

Maybe you are looking for

  • WebLogic 10.3.2  managed server startup failed : ''31' could not be found'

    Dears: I ran my managed server using script but failed , the weblogic version is 10.3.2 (11g R1) , on Solaris 10 sparc 64bit.: ports=( 7001 7003 7005 7007 ) instances=( instance1 instance2 instance3 ) adminip=192.168.11.174 "startManagedWebLogic.sh $

  • Blank page seen in the print preview ?

    Hi all I have deveoped a smartform and created a second page with main window......but the problem is , iam getting a blank page output when i see it in the print preview . suppose if data is only in two pages iam , i can see the third page with no d

  • Masking a portion of the Payment Card Number in SD

    Does anyone know how to mask a portion of the payment card number in SD (VA02, 03, etc)?  EX: XXXXXXXXXXX2145 Also if you have done this what transaction is used to view the complete number, if needed? Thanks M. Grantham Edited by: Mia M. Grantham on

  • Anybody has a LabVIEW 6 driver for Agilent 8510C?

    Hello. I have LabVIEW version 6 and I am trying to talk to an Agilent 8510C network analyser. I seem to be able to communicate with the instrument only for sweep, number of points, etc, but I cannot transfer any data from the 8510 to the PC (to expor

  • Referenced vs managed VS. file locations

    I've always used referenced files; now keeping the AP library on the local disk and the referenced image files on an external FW800, 7200rpm 16MB cache drive. (I think there was a time when even the library was on an external drive - using a previous