How to print content of JSP

hi ,
i have a JSP with content beyond the limit of offset( with scroll bar, i have data after width of screen)
with window.print i can not print the whole document
any way to do that?
please help me with some way........

with .CSS also we can not make it out, right?
any way?

Similar Messages

  • How to print report from JSP Page

    Hi Everybody,
    I am developing a simple project in JSP with MS Access. I hav some tables and reports for them. I hav a JSP page which gets inputs from user and save it in the table. Its working fine. But my problems are,
    1) I hav a button called "SAVE & PRINT" in that bottom of the page, if i click that button, the currently entered data has to save in the table and the same data has to print from the MS Access report. I dont know how to print this report from JSP page.
    2) Another button called "REPRINT". If i click that button, it has to ask a number to print the report page, that number is nothing but a field in that report.
    Could anyone help me to solve this problem.

    Hi Everybody,
    I am developing a simple project in JSP with MS Access. I hav some tables and reports for them. I hav a JSP page which gets inputs from user and save it in the table. Its working fine. But my problems are,
    1) I hav a button called "SAVE & PRINT" in that bottom of the page, if i click that button, the currently entered data has to save in the table and the same data has to print from the MS Access report. I dont know how to print this report from JSP page.
    2) Another button called "REPRINT". If i click that button, it has to ask a number to print the report page, that number is nothing but a field in that report.
    Could anyone help me to solve this problem.

  • How to print contents in an object?

    I would like to print content of object as it is printing like AccountSearchReqBOD@726d23. AccountSearchReeqBOD is generated by ant task clientgen which is not overriding toString method. how can i print contents in an object. Plz help me..
    Thanks in advance.

    i tried with reflection as below
    public String toString1(Object obj)
         StringBuffer buff = new StringBuffer();
         Field[] fields = obj.getClass().getDeclaredFields();
         for (int i = 0; i < fields.length; i++)
         try
         fields.setAccessible(true);
         buff.append(fields[i].getName())
         .append("\t=>\t")
         .append(fields[i].get(obj))
         .append("\n");
         //System.out.println(fields[i].getName() + " : values: " +
         // fields[i].get(this));
         catch (IllegalAccessException ex)
         ex.printStackTrace(System.out);
         catch (IllegalArgumentException ex)
         ex.printStackTrace(System.out);
         return buff.toString();
         * Method logRequest<p/>
         * Logs a SOAP request.
         * @param request
         private void logRequest(Object request) {
              if (mLog.isDebugEnabled()) {
                   if (request != null) {
                        mLog.debug("request:");
                        mLog.debug(toString1(request));
                   } else {
                        mLog.debug("request is null");
    But the above also doesn't log the object with in object. it gives log as
    2011-02-08 12:31:44,170 - DEBUG (WSClient:1168) - request:
    2011-02-08 12:31:45,405 - DEBUG (WSClient:1169) - hostInput     =>     HostInput
    2011-02-08 12:32:08,935 - DEBUG (WSClient:1186) - response:
    2011-02-08 12:32:10,060 - DEBUG (WSClient:1187) - processService     =>     com.tfs.tfs.sharedcomponents.serviceschemas.hostavailable.hostavailableressync.ProcessService@1d43cab
    Request is in correct format but response object got another object as processService which is not outputting correctly. Please help me..
    Edited by: user8660327 on Feb 8, 2011 2:25 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to print report in jsp page?

    excuse me,i am new to jsp
    may i know how to pritn report in jsp page or html?
    tq

    here is a hacked up example.. i ripped out a lot, so it may not compile, but you get the idea... the full version is really long and not much new info.. just all awt/display stuff...
    package rowe;
    import javax.swing.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    import java.sql.*;
    import utility.*;
    import java.awt.print.*;
    public class rowePrint extends JFrame implements ActionListener, Printable{
         String printType = "";
         static JButton j = new JButton("Print");
         FontMetrics fm;
         String jID, promotion, product, jComments;
         public void getInfo(int jid) {
              ResultSet rs;
              try {
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   Connection conn = DriverManager.getConnection("jdbc:odbc:rowe");
                   Statement stmt = conn.createStatement();
                   rs = stmt.executeQuery("select j.id as jID, j.comments, p.title as pTitle, p.product, p.packagingCartonCost, p.foldingQuarterCostPerM, p.foldingQuarterCostPerM, j.customizationOption as setupFee, p.perMcost, p.qtyCarton, d.name as dName, d.contact as dContact, d.email as dEmail, d.address as dAddress, d.city as dCity, d.state as dState, d.zip as dZip, d.phone as dPhone, d.fax as dFax, r.name as rName, j.totalQty, j.orderIn, j.estFreight, j.miscCost, j.coverSelection, j.imprintSelection from jobs j, promotions p, dealers d, reps r where j.promotion = p.id and j.dealer = d.id and j.rep = r.id and j.id = " + jid);
                   rs.next();
                   jID = rs.getString("jID");
                   jComments = rs.getString("comments");
                   promotion = rs.getString("pTitle");
                   product = rs.getString("product");
              } catch (Exception e) {
                   System.out.println("getinfo: " + e);
       public void actionPerformed(ActionEvent e) {
            if (e.getSource() instanceof JButton) {  
                   wookie();
         public void wookie() {
              PrinterJob printJob = PrinterJob.getPrinterJob();
              Paper paper = new Paper();
              PageFormat page = new PageFormat();
              paper.setImageableArea(0, 0, 600, 780);            
              page.setPaper(paper);
              printJob.setPrintable(this, page);
              try{
                   //printJob.pageDialog(page);
              //     if (printJob.printDialog()) {
                        printJob.print();
              } catch (Exception e) {
                   System.out.println("wookie1" + e);
         public static void main(String[] args) {
              rowePrint at = new rowePrint("Invoice");
              at.getInfo((new Integer(args[0])).intValue());
              at.drawShapes();
         //     at.wookie();
         public void drawShapes() {
              setBounds(0, 0, 670, 550);
              addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) {System.exit(0);}});
              j.setBounds(10, 10, 10, 10);
              j.addActionListener(this);
              getContentPane().setLayout(null);
              getContentPane().add(l);
              getContentPane().add(j);
              show();
         public rowePrint(String s){
              printType = s;
         public void paint(Graphics g) {
              g.setFont(new Font("Serif", Font.BOLD, 18));
              g.drawString(promotion, 20, 30);
              g.setFont(new Font("SansSerif", Font.PLAIN, 4));
              g.drawString("" + new java.util.Date(), 20, 37);
              g.setFont(new Font("Serif", Font.BOLD, 21));
              g.drawString("Rowe Furniture", 440, 35);
              g.fillRect(440, 40, 145, 25);
              g.setColor(Color.white);
              fm = g.getFontMetrics(new Font("Serif", Font.BOLD, 21));
              g.drawString(printType, 512 - (fm.stringWidth(printType) / 2), 60);
        public int print(Graphics g, PageFormat pf, int pi) throws PrinterException {
            if (pi >= 1) {
                return Printable.NO_SUCH_PAGE;
              paint(g);
            return Printable.PAGE_EXISTS;
    }

  • How to print XMLDocument in JSP

    I have a really basic question: in a JSP page if I get a type XMLDocument object, how do I print the content of this object to the resulting HTML page?
    thanks.

    Hi,
    There is a JSP sample which can be helpful to you in this regard. This is the XML/XSL integration sample under Advanced samples category of JSP Samples #2 on the OTN site.
    Here is a link to the JSP set of samples:
    JSP
    Samples
    Hope that helps.
    Regards,
    Savitha.
    null

  • How to print content of the swing components?Example:JTextArea.

    I have a application,it include a JTextArea,and when user click newfile menu,
    it will load a txt file.but how can I print the txt file content? now ,I can only
    print the panel of the application!
    Thank you!

    Next is the code of the PrintManager I have written. It uses the new Printing technique.
    package jippa.jshell.gui;
    import javax.print.Doc;
    import javax.print.DocFlavor;
    import javax.print.DocPrintJob;
    import javax.print.PrintException;
    import javax.print.PrintService;
    import javax.print.PrintServiceLookup;
    import javax.print.SimpleDoc;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    import javax.print.attribute.standard.MediaSizeName;
    * @author postma
    * To change the template for this generated type comment go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    public class PrintManager {
         * Constructs a new PrintManager.
         public PrintManager() {
              super();          
         * Print the given text.
         * @param text The text to be printed.
         public void print(String text) {
              DocFlavor df = DocFlavor.STRING.TEXT_PLAIN;
              Doc myDoc = new SimpleDoc(text, df, null);
              PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
              aset.add(MediaSizeName.ISO_A4);
              PrintService[] services =
                   PrintServiceLookup.lookupPrintServices(df, aset);
              if (services.length > 0) {
                   DocPrintJob job = services[0].createPrintJob();
                   try {
                        job.print(myDoc, aset);
                   } catch (PrintException pe) {
                        pe.printStackTrace();
    In your code you must add:
    PrintManager pm = new PrintManager();
    pm.print(text);

  • How to print content inside a scroller in Adobe Air

    Hi experts,
    I am currently working on an Adobe AIR application that shows the  user some graphical data. As this data is more in height to fit the  screen height, I've placed it inside a scroller.
    Now I want to take a print of this visual data, mostly some charts  and lists but I only see a single page containing only the part of the  screen that is currently visible to the user. I want to have the entire  content inside the scroller to appear on the page.
    I tried using both PrintJob and FlexPrintJob but couldn't find a way  around. Can anyone please help me by providing an insight, some source  code will be greatly appreciated.
    Looking forward to your replies,
    Thanks

    Alex,
    From http://www.darronschall.com/weblog/2005/11/the-secret-to-printing-in-flex.cfm,
    I adjusted my code to
            if (printJob.start())
                FlexGlobals.application.contentGroup.clipAndEnableScrolling = false;
                results.scroller.viewport.clipAndEnableScrolling = false;
                setTimeout(continuePrinting, 250)
            function continuePrinting():void
                printJob.addPage(results.scroller.viewport as Sprite);
                printJob.send();
                results.scroller.viewport.clipAndEnableScrolling = true;
                FlexGlobals.application.contentGroup.clipAndEnableScrolling = true;
    Now it does print a small portion of invisible portion, but the view of limited to a single page. I observed the contentHeight property of the viewport and it is 6097. But the printout is limited to a single page. I also tried giving a rectangle as the second parameter for the addPage method of printJob giving the height of viewPort.contentHeight but of no use.
    How are you suggesting to create a new view of viewport outside the scroller ? Can you please paste some code for reference for better understanding of your suggestion?
    Thanks

  • How to print data using JSP

    I have a jsp/html page. Which has some data and I want to print the data of that page using jsp.Means I want to display the page and an option which will ask whether user wants to print the page or not. And if the user select print option then it will print the displayed page using printer.
    Please help me how I can proceed.
    Regards,
    Sundeep Mohanty

    Yes
    window.print will print the current displayed page
    also...it wuill not print directly...but will open the print dialog box of ur default printer i guess.

  • How to print content of attachments in PDF when clicked on print.

    Hi @,
    I have a requirement where when i click on print the content of attachment present in PDF should be printed instead of attachment symbol. Please let me know whether this is acheivable by any means.This should be done using .NET 2005.
    Thanks in advance.
    Regards
    Meenakshi.

    if you have have a bunch of questions, you can have a div tag set up with nothing in it after each question where you can display the answer. then when you click on the answers in the child window, you can do this:
    window.opener.document.getElementById('divName').innerHTML = 'the html/text to show';

  • How to write printing function using JSP?

    dear all,
    i want to add a printing function in my project but i do not know how to do it? could anyone teach me how to do it?
    thanks
    eric

    salut eric,
    you can do it this way :
    1 - create a html link in your code to this javascript
    function : (I am using Struts, but you can write it in
    pure html
    <html:link href="#bodyStart"
    onclick="openWindowForPrinting()"
    titleKey="msg.status.print">      <bean:message
    key='app.print' />
    <script language="JavaScript">
    <!--
    window.open = SymRealWinOpen;
    //-->
    </script>
    </html:link>
    >
    >
    2 - here is the javascript function : it open a window
    with the "print.jsp" page.
    function openWindowForPrinting(){
    window.open('/your_project/pages/common/print.jsp','',
    'left=150, top=150 , status=no, directories=no,
    toolbar=no, menubar=yes, location=no, scrollbars=yes,
    resizable=yes, dependant=yes');
    3 : here is the print.jsp page : You have only to
    create a session variable called
    "currentBodyRelativeLocation", which content the
    relative URL to the page you want to print (for
    example, the boby of the current page).
    <%@ taglib uri='/WEB-INF/tlds/perso.tld'
    prefix='perso' %>
    <html>
    <head>
    <perso:csslink page='${cssRelativeLocation}' />
    </head>
    <body onload="var SymTmpWinOpen = window.open; window.open = SymWinOpen; printPage();; window.open = SymTmpWinOpen;">
    <body>
    <jsp:include page="${currentBodyRelativeLocation}"/>
    </body>
    <script language="JavaScript">
    <!--
    window.open = SymRealWinOpen;
    //-->
    </script>
    </html>
    <script language='javascript'>
    function printPage(){
    window.print();
    window.close();
    </script>
    hai,
    i'm not very understand how is your code work. when i write html code, do i need to mind about this code: "msg.status.print" ? what is this code mean?
    i have too much question on this thing. would you mind to be further explain to me? or is it any reference for me to refer? i'm really new to write printing function on JSP.
    i never write this function before. i'm feel so lost.....:(
    thanks again
    eric

  • How to print new line in jsp page

    hi
    how to print new line in jsp page
    thanks

    \n - new line character is in java specific not HTML
    specific.Well, if the correct line separator sequence (by far not always \n) would be used, it does add a new line to the HTML output. Too bad that you don't want to see HTML but formatted text. The BR tag is a formatting element for the displayed text, not a line break in HTML. ;)

  • How to print window contents at the backside of a page(In scripts&smartform

    Hi,
    How to print the window contents at the back side of a page
    in scripts and smartforms?
    regards,
    prajwala

    Create a new page with the window and select "duplex" printing. Use Search button to get more information.

  • How to print HTML contents

    can anyone tell me how to print HTML contents...i needed it urgently
    Thanks

    actually i have a print button on html page....when i click on print button using window.print(); the html page gets printed...but along with it print button is also printed...i dont want print button to be printed...
    this is the issue...
    please resolve it
    Thanks a lot...

  • How to realize print function in JSP

    How to realize print function in JSP? I know use Javascript:window.print() can print,but it will print whole page,it don't fit me;Another method is to write JSP into Excel and then print it in Excel,but it don't fit me too,because it don't print directly. Anybody know how to print it directly?

    Many websites offer a "printer friendly" version of a certain page. That IMO is the only way to solve your problem, next to using CSS to use a different style for printer output. Here is a tutorial that covers this:
    http://www.alistapart.com/stories/goingtoprint/

  • I download itext  for convert jsp to PDF. How to set content type for PDF.

    I download itext for convert jsp to PDF. How to set content type for PDF. I try
    <%@ page contentType = "application/pdf;charset=TIS-620" %>
    , but the page does not PDF.
    Thank.

    PDF files are usually binary files, JSPs are not well-suited for binary content.
    (If you download the result of your JSP you'll see that it is not a valid PDF file; it will have probably a lot of whitespace and linefeeds, that will choke your PDF reader.). The first few characters must be
    "%PDF-" without whitespace.
    You can try using PDF files encoded as text - check if you can use text-encoded PDFs in iText.
    Try using a Servlet instead.

Maybe you are looking for

  • Not Printing Item Schedule line items in SAP Script

    Hi , I modified  copied sap standard script(MEDRUCK) and copied my Zprogram to standard program. But here every thing is fine but i am not getting schedule line items and item text  in items data for every item thanks, sriram

  • How do I create AND USE a new iTunes account?

    Hi there, My girlfriend has finally traded in her windows (*spits*) phone for an iphone after months of me drilling it into her that her phone sucked... The problem now is that we share a PC and she wants to fill her spanking new iphone with crap mus

  • Using a Variable to create the SQL Query

    I need to create a "dynamic" Update query. I want to store the meet of the command in a variable and then reference the variable in in query. Example: <cfquery name="fred" datasource="mydb"> update db_table_name set pbname = 'Fred Flintstone', pbnumb

  • Apply TV Cannot mirror to ipad

    Hi Anybody know how to make AirPlay on iPad I cannot see the airplay on my iPad I have been check the network setting is ok But nothing work

  • IWeb In Mountain Lion

    Hi, I just got a new iMac and I had iWeb on my old mac but I sold it and I don't have any of my iWeb files backed up. Is there any other way to get iWeb? I tried other web editors but I love the simplicity of iWeb! Thanks!