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

Similar Messages

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

  • How to write a function in JSP

    I have a few lines of code I would like to store in an external file and then call it from a web page.
    Here is the code
         String isCE = "No";
         String ismobile = "No";
         String accept = request.getHeader("accept");
         String user_agent = request.getHeader("user-agent");
         String accept_charset = request.getHeader("accept-charset");
         String accept_language = request.getHeader("accept-language");
         String profile = request.getHeader("profile");
         String x_wap_profile = request.getHeader("x-wap-profile");
         if (user_agent.contains("CE")) {
              isCE = "Yes";
         if (x_wap_profile == null && isCE == "No") {
              response.setStatus(301);
              response.sendRedirect("someurl.com");
              response.setHeader( "Connection", "close" );
    Now I would like to include this code and then call it with a single function and then pass the url like:
    snif("www.someurl.com");
    Please help

    Thai,
    You can use the "channel" functions for this. I'm far from an expert on channel programming but I've read files line-by-line successfully by going one character at a time, looking for a carriage return.
    You can open up the file channel with something like:
      ChannelT chan;
      FilePathT *path;
      UCharT ptr[1];
      IntT numRead;
      path = F_PathNameToFilePath("C:\\temp\\mydoc.txt", NULL, FDefaultPath);
      if((chan = F_ChannelOpen(path,"r")) == NULL)
          return;
      //read the first character
      numRead = F_ChannelRead(ptr, sizeof(UCharT), 1, chan);
    ...then you can call F_ChannelRead iteratively to build the string in a buffer, looking for a carriage return (ASCII 13) and stopping there. (that is, ptr[0] == 13).
    There might be a better way. This is just the way I've gotten it to work. It probably is not a good method for unicode files.
    Russ

  • Passing values to JavaBean function using jsp scriplet

    Hi,
    I have a JavaBean funtion that is SaveData(parameters)
    which save the values from HTML form.
    Now i want a code for pass the values from HTML form to SaveData() function using jsp scriptlet.
    I used the code
    <jsp:useBean id="JDBC" class="bean.JDBCBean" scope="application"></jsp:useBean>
    <%=JDBC.saveData(phonenumber,manufacturer,model,email,country,newsletter)%>
    Here
    JDBCBean -> Bean Name
    phonenumber,manufacturer,model,email,country,newsletter ->HTML form's text values
    But it didnt work properly.
    Anyone help me to correct this.

    Hi,
    i have the same code like above
    I have to pass the parameters with form name under the following code.
    <jsp:useBean id="JDBC" class="bean.JDBCBean" scope="application"></jsp:useBean>
    <%=JDBC.saveData(registration.phonenumber.value,id_type.value,id_style.value,registration.email.value,registration.scountry.value,player_type.values)%>
    Here
    registration -> HTML form name
    But i got the error for
    package registration does not exist
    out.print(JDBC.saveData(registration.phonenumber.value,id_type.value,id_style.value,registration.email.value,registration.scountry.value,player_type.values));
    How to i correct this?
    Anyone help me......

  • EMAIL FUNCTION USING JSP

    HOW CAN I WRITE A EMAIL FUNCTION USING JSP
    WHICH HAVE FORWARD, REPLY, REPLAY ALL, AND ADDRESS BOOK LIKE YAHOO EMAIL FUNCTION
    HOW CAN I WRITE IT?

    I meant you would face a considerable challenge trying to write
    public static void main(String[] arg) { } with your Caps-Lock key stuck.
    You would not even be able to escape your way out of it with
    \u0070\u0075\u0062\u006C\u0069\u0063 \u0073\u0074\u0061\u0074\u0069\u0063 \u0076\u006F\u0069\u0064 \u006D\u0061\u0069\u006E(S\u0074\u0072\u0069\u006E\u0067[] \u0061\u0072\u0067) { } as the "\u" escape sequence also contains a lowercase character.

  • How to achieve print functionality in OA Framework page

    Hi All,
    I have created one page in OA Framework.
    There is one print button on page for printing the page
    How to achieve print functionality thruoug Print button in OA page.
    Please help me in this if some one has use thif functionality before or if someone knows about it.
    Thanks
    Nisha

    Hi Nisha,
    Have u checked out "printable page" in OA Developer guide??
    Step 1: Add a page-level button as described in the Buttons (Action/Navigation) document.
    Step 2: Assuming your button label is the standard "Printable Page," apply the OA Framework attribute set /oracle/apps/fnd/attributesets/Buttons/PrintablePage.
    Step 3: Set the button's Destination URI property to point to the current page and set the UIX facet parameter (OARF) to printable as shown in the following example (if you don't know what a "facet" is, please see Controlling UIX Rendering Output for additional information). Remember to retain your application module.
    OA.jsp?page=<CURRENT_PAGE>&retainAM=Y&OARF=printable
    Step 4: Set the button's Target Frame property to _blank. This ensures that the printable page opens in a new window.
    Regards,
    Devang

  • How to write a function generator

    How to write a function generator from labview and using PCI-MIO-16

    Hallo, [email protected],
    Du (x) meintest am 27.07.01 zum Thema How to write a function generator:
    > How to write a function generator from labview and using PCI-MIO-16
    Look to the examples - there are many VIs with that function.
    Viele Gruesse!
    Helmut

  • How to write a file using mod pl/sql

    hi,
    i am having a submit button in my procedure. which should inturn create .sql file in a file path.
    is there any way to create a fileusing htp and htf methods.
    Thanks in advance
    Hari

    >
    i am having a submit button in my procedure. which should in turn create .sql file in a file path.
    is there any way to create a file using htp and htf methods.
    >
    Why are you wasting your time coding from scratch using the PL/SQL Web Toolkit instead of the APEX framework?
    From Re: how to write a file using mod pl/sql it appears that you are not using APEX, so a number of the approaches APEX offers are not relevant. You appear to be looking for a file download solution using the <tt>wpg_docload.download_file</tt> method, such as:
    create or replace procedure download_file (
        p_filename  in     varchar2
      , p_mimetype  in     varchar2
      , p_content   in out nocopy blob)
    is
    begin
      -- Set up HTTP header.
      -- Use "application/octet" as default MIME type.
      owa_util.mime_header(nvl(p_mimetype, 'application/octet'), false);
      -- Set the size so the browser knows how much to download.
      htp.p('Content-length: ' || dbms_lob.getlength(p_content));
      -- Filename will be used as default by the browser in "Save as..."
      htp.p('Content-Disposition: attachment; filename="' || p_filename || '"');
      -- Close header.
      owa_util.http_header_close();
      -- Stream the file content to the browser.
      wpg_docload.download_file(p_content);
    end download_file;

  • How to write a application using WDJ with the adobe form ?

    Hi, experts,
    I don't know how to write a application using !!webdynpro for java!! with the adobe form so that I can fill data to the adobe form and get data from the adobe form.
    Note: I have configed the ADS(adobe document services),and I can create a application with a interactiveform in webdynpro for abap and run it successfully, so that I can  fill data to the adobe form and get data from the adobe form.
    Do you give me some hint?
    Thanks a lot.
    Best regards,
    tao
    Edited by: wang tao on Sep 9, 2008 8:59 AM

    Hi,
    Refers the following links.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4fd2d690-0201-0010-de83-b4fa0c93e1a9
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5f27e290-0201-0010-ff82-c21557572da1
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70c9a954-aa20-2a10-64bb-ea0835204e03
    Thanks
    Abhilasha.

  • How to write a function block?

    Hi There,
    Does anybody know how to write a function block with LabVIEW?  Something like those in Real-Time VIs>>Function Blocks>>.
    Thank you very much in advance?
    Solved!
    Go to Solution.

    I don't want to overwelm you but there is tons of free training material online.  One of these is the one already mentioned.
    NI Learning Center
    NI Getting Started
    -Hardware Basics
    -LabVEW Basics
    -DAQ Application Tutorials
    3 Hour LabVIEW Introduction
    6 Hour LabVIEW Introduction
    Self Paced training for students
    Self Paced training beginner to advanced, SSP Required
    LabVIEW Wiki on Training
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • How to tack print out use with Query ?

    Hi
    I have to tack purchase order print out (print details- PO date, BP code, name, item name, Quantity and Amount . System Print Layout means from Purchase Order layout designer) use with Query
    How to tack print out use with Query (system print layout means from  Purchase Order layout designer) ?
    Regards
    Aravind M

    Hi
    I have to take purchase order print out and I created 3 templates for that purchase order in layout designer (Because as per the MIS requirement I created 3 templates, its cover more information). I have to take print out 3 templates at a time. So i try to take print use with Query.
    Regards
    Aravind M

  • How to write SELECT statement using tables ekko,ekpo and eket?

    Hi,
    I got a problem in  performance tuning using below tables?
    how to write SELECT statement using tables EKKO,EKPO and EKET and in conditon ( WHERE clause)  use only fields 
                        ekko~ebeln       IN ebeln
                       ekko~loekz       EQ ' '
                       ekko~lifnr       IN lifnr
                       ekko~ekorg       IN ekorg
                      ekko~ekgrp       IN ekgrp          
                       ekpo~werks       IN werks
                       ekpo~pstyp       EQ  '3'
                       ekpo~loekz       EQ  space
                       ekpo~elikz       EQ  space
                       ekpo~menge       NE  0
                     eket~rsnum       NE space.
    Thanks in Advance.
    bye.

    Hi,
    ekko~ebeln IN ebeln
    ekko~loekz EQ ' '
    ekko~lifnr IN lifnr
    ekko~ekorg IN ekorg
    ekko~ekgrp IN ekgrp
    ekpo~werks IN werks
    ekpo~pstyp EQ '3'
    ekpo~loekz EQ space
    ekpo~elikz EQ space
    ekpo~menge NE 0          " Remove this from where clause
    eket~rsnum NE space.    " Remove this from where clause
    ' instead delete the entries after fetching into the table
    DELETE it_itab WHERE menge EQ '0' AND rsnum EQ ' '.
    Regards
    Bala Krishna

  • Hi can anyone explain me how to  syncronize two database using jsp?

    Hi can anyone explain me how to syncronize two database using jsp?

    I thinking than you really need the jsp page for calling the java methods whith sincronize the database.You think wrong.
    You wrote a bad question.What was bad about it?
    You need a java method for sincronize the two databases using a jsp page.No you don't, see my answer.

  • How to call java method using jsp

    how to call java method using jsp.....
    anyone can help me.....i having problem here...coz i very new in java and jsp.....
    thanks.....

    keep an eye on this person's thread...they have code there and everything.
    http://forum.java.sun.com/thread.jspa?threadID=777263&tstart=0

  • Explain how to implement prompt functionality using @variable

    Hi all,
    Anyone please explain how to implement prompt functionality using @variable.
    We got some sql reports.Those reports have to be converted into BO free hand sql report.
    Please provide any best practices for converting sql reports into BO free hand SQL.
    Thanks & Regards,
    James Charle

    Hi
    Please refer "@Variable" section  in page number 601, in http://help.sap.com/businessobject/product_guides/boexir31SP3/en/xi31_sp3_designer_en.pdf
    Regards
    Ashwini

Maybe you are looking for

  • Error while transport to Consolidation

    Hi All, When I am trying to import the activities in Consolidation I am getting the following error in the SDM log. 'appl/wd_test'/'lonmin.com'/'DEP_APPL_C'/'4410'/'0' dependency:        name:     'appl/ext_lib_sp14'      vendor:     'lonmin.com' And

  • Help with kerning and tracking.

    I am a new InDesign (version 3, Windows) user and am creating a 40 page booklet. I am using the 'justify with last line aligned left' style and some lines have words compressed so it looks like a run-on word and other lines have way too much space in

  • Sender verification e-mail code

    How do I get my sender verification e-mail to be sent to me so I can send photo e-mail's?

  • Time dependant hierarchy

    hi ,    can you give me all time dependant and time independant hierarchy tables . how and what does the system assign the same to parent and child nodes in either case, thanks in advance, sasidhar gunturu

  • Can't find my backup???

    I've backed up my friend's iPhone 4 iOS 4.3 with iTunes on my desktop PC. Then restored to iOS 6.0 on my laptop successfully. After restoring I plugged iphone to my desktop PC. And can't find previous backup. Then I checked the backup folder, here is