Can a report of Jasper operate with an af:button on a page fragment (jsff) or simply on a jsf page?

Mr President.

Can a report of Jasper operate with an af:button on a page fragment (jsff) or simply on a jsf page?

Because I'm running report jasper jsff page but it does not work but the same report runs on a jsf page.

Concerning

Cherish!

The answer to this question is Yes

We can run report jasper with a button on a page jsff using the servlet class

The same code for jdev worm 12.1.3.0.0 is as below

package ash.view;

import ash.model.SchoolAppModuleImpl;

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.xml.JRXmlLoader;

import oracle.jbo.client.Configuration;

@WebServlet(name = "ReportServlet", urlPatterns = { "/reportservlet" })
public class ReportServlet extends HttpServlet {
    private static final String CONTENT_TYPE = "text/html; charset=UTF-8";

    public void init(ServletConfig config) throws ServletException {
        super.init(config);
    }

    protected Connection getConnection() {

        PreparedStatement st = null;
        String amDef = "ash.model.SchoolAppModule";
        String config = "SchoolAppModuleLocal";
        SchoolAppModuleImpl am = (SchoolAppModuleImpl ) Configuration.createRootApplicationModule(amDef, config);

        st = am.getDBTransaction().createPreparedStatement("select 1 from dual", 0);
        Connection conn = null;    

        try {
            conn = st.getConnection();
            return conn;
        } catch (SQLException e) {
        }   

        return null;
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String var0 = "";
        try {
            var0 = request.getParameter("classId");
        } catch (Exception e) {
            e.printStackTrace();
        }
        response.setContentType(CONTENT_TYPE);
        Map parameters = new HashMap();
               parameters.put("format", "pdf");
               parameters.put("WEBDIR", getServletContext().getRealPath("/"));
               parameters.put("REPORT_LOCALE", new Locale("ar"));

               parameters.put("classId", new String(var0));
               Connection conn = null;
               InputStream is = null;
               try
               {
                 conn = getConnection();
                 is = getServletContext().getResourceAsStream("/WEB-INF/reports/ClassDataReport.jrxml");

                 response.setContentType("application/pdf");
                 response.addHeader("Content-Disposition", "attachment; filename=ClassDataReport.pdf");

                 JasperDesign jasperDesign = JRXmlLoader.load(is);
                 JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
                 JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn);
                 JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());

                 conn.close();
               }
               catch (Exception e) {
                 e.printStackTrace();
               } finally {
                 closeConnection(conn);
                 try {
                     if(is !=null){
                         is.close();
                     }                   

                 } catch (Exception localException1)
                 {
                 }
               }

        PrintWriter out = response.getWriter();
        out.println("");
        out.println("ReportServlet");
        out.println("");
        out.println("

The servlet has received a GET. This is the reply.

"); out.println(""); out.close(); } protected static void closeConnection(Connection conn) { try { if(conn !=null){ conn.close(); } } catch (Exception ex) { // System.out.println("Developer Msg : Exception in printReport1Servlet.closeConnection()"); } } }

Concerning

Tags: Java

Similar Questions

  • We can create a view or table with a form button?

    We can create a view or table with a form button using forms 6i?
    If Yes, what will be the command?

    Gul says:
    We can create a view or table with a form button using forms 6i?
    If Yes, what will be the command?

    Yes. You can. Use the FORMS_DDL built-in. For example

    BEGIN
      Forms_DDL('create table temp(n NUMBER)');
      IF NOT FORM_SUCCESS THEN
        Message ('Table Creation Failed');
      ELSE
        Message ('Table Created');
      END IF;
    END; 
    

    Hope this helps

    Hamid

  • How can I use on my M40X with WinAmp media buttons?

    Hello
    Today, I received my M40X and I have a question.
    There are 5 media as left button on the keybord (CD/DVD, play/pause, Stop, <->)
    Is it possible to use them with WinAmp?
    With the help of Toshiba, I had the CD/DVD button used to start WinAmp (by allows him to launch a .exe) but the work of Play/pause...don´t. The field of media Apps the only player that I can choose is Win MP10 (I hate this piece of sh * t).
    How can I use these buttons with WinAmp?

    Hello

    As far as I know Toshiba controls have been tested and designed only for Microsoft Media Player and WinDVD. How this topic says:

    http://forums.computers.Toshiba-Europe.com/forums/thread.jspa?threadID=3621&MessageID=11461#11461

    I n t have any experience with WinAmp but I found useful info in this forum on this topic:

    http://forums.computers.Toshiba-Europe.com/forums/thread.jspa?threadID=6673&MessageID=24448#24448

    Select this check box.

    Good bye

  • I can't go to the article with a single button...

    Hi everyone, Im not passing to the Pentecost Article article a button for example, I have need move on to section 1 of article 10, with one button I can do? Thank you

    Yes, you can do, watch this video.

    http://helpx.Adobe.com/Digital-Publishing-Suite/Help/hyperlink-overlays.html#WS9293e1fb3b9 77c5c53fe9e2612b12c9933c-8000

  • How can I fix Comodo Dragon incompatibility with windows 7?

    Please tell me how I can fix my windows 7 incompatibility with comodo dragon. Comodo dragon page trying to load but remains empty now.

    Hello

    For further assistance, please contact Comodo support
    http://www.Comodo.com/support/Comodo-support.php

  • DeskJet 3050 can operate with only the black cartridge?

    I wonder if the printer can operate with only black ink? The manual says that the printer can operate in single-cartridge. My previous color and black ink run out. So I installed a new black cartridge. However, the warning light is still on indicating there is no ink, and he says "door open". Thank you.

    Hi Alice, yes you can use the single cartridge

    Use single-cartridge
    Use single-cartridge use the HP all-in-one with only one cartridge.
    Mode single-cartridge begins when an ink cartridge is removed from the print
    transport of the cartridge. In the mode single-cartridge, the product can only print jobs to the
    computer.
    NOTE: When the HP all-in-one device operating in mode single-cartridge, a message is
    displayed on the screen. If the message appears and two print cartridges are installed
    in the product, check that the piece of tape plastic protection has been removed
    each print cartridge. When the plastic strip covering the contacts of the print cartridge, the product
    cannot detect the cartridge is installed.

    Have you tried to reset the printer to get rid of the open door msg? See the link below for more details

    http://support.HP.com/us-en/document/c00829896

    Ciara

  • I have an idea on the program application Adobe InDesign to increase the power of sale of Adobe InDesign, by adding an additional menu, with an additional menu that I hear more important for the future of printing.  How can I report directly to the

    I have an idea on the program application Adobe InDesign to increase the power of sale of Adobe InDesign, by adding an additional menu, with an additional menu that I hear more important for the future of printing.

    How can I report directly to the developer indesingn adobe...!

    You can create a feature here request:

    Feature requests/bug reports

  • where can I report a problem with a virtual machine died, which I can't save now?

    It looks like a lot of places, but it is not clear where I should take this problem to.

    where can I report a problem with a virtual machine died, which I can't save now?

    He is buried in the VMware Community Infrastructure - here is the link to this forum - http://communities.vmware.com/community/vmtn/server/vi/esx3.5

  • Custom reports do not work with error message: systematic FDPREP can not read...

    Hello

    Can someone help me with this problem pls?

    Dev system is cloned production a few days ago. After you run the clone of post procedure, the dev works very well except when we try to run customized reports he errorred out with the Routine FDPREP - error message cannot read the file fmis/11.5.0/reports/US/POXPRPO1.rep. I checked the files env, and they seem ok. $CUSTOM_TOP is set to the correct value. Other standard Oracle reports properly. Custom report file extension is in the case of low (RDF). I tried to compile the report manually by using rwcon60.sh, the rep file was created under this folder but simultaneous Manager always gives the same error message. So I'm suspecting whther this is the problem of path, from the error message we can see up there, it does not show the absolute path. Can someone pls throw some light on this for me?

    Thank you!
    Liang

    If everything is as it should be, would it be possible to bounce the instance (all services, listener, and database)? Who can solve the problem, but he will not explain how it happened in the first place. If the bounce does not solve the problem, then FMIS_TOP is not set correctly.

    HTH
    Srini

  • Change the locale for a report from jasper who was called pit utl_http

    All,

    When we call the utl_http package to generate a report of jasper within the oracle and save it as a BLOB in the default language (nls_language and nls_territory) gets crushed by AMERICA/America.

    This gives problems as decimal points and comma...

    In regard to is that I know that it is not possible to change the language within the server of jasper.

    I suspect that utl_http creates a virtual browser with a default language (AMERICAN), that it becomes hereditary by server of jasper. Is there a way to change this language?

    I've already tried
    execute immediate ('alter session set nls_language= ''DUTCH'' nls_territory= ''BELGIUM'' nls_numeric_characters='',.''');
    It did not work!

    Work around for now is to change the format mask in my report Jasper query, but so that we can do is more aggregate functions.

    Any help is greatly appreciated...

    Thnx

    Hello

    Just a guess. Try following

    req := utl_http.begin_request('http://www.psoug.org');
    utl_http.set_header(req, 'Content-Language', 'da');
    resp := utl_http.get_response(req);
    

    For more information on HTTP headers, see http://en.wikipedia.org/wiki/List_of_HTTP_header_fields

    ----
    Lavenu
    MaxApex accommodation
    http://www.maxapex.com

  • where can I report spam?

    Where can I report spam?

    Depends on how and where it happens (by e-mail, pop-up etc), it is guidance of apples.

    To report spam or other suspects emails you have received in your Inbox iCloud.com, me.com or mac.com, please send them to [email protected]. To report spam or other suspicious messages that you have received through iMessage, please send them to imessage. spam@apple.com with the requested information.

    http://www.Apple.com/legal/more-resources/phishing/

  • How can I make Firefox 5 work with OS10

    I can't get Firefox 5 operate on my old Mac. Firefox 4 went very well. I get a big circle with a line thruogh it icon

    Firefox 4, or 5 is compiled to run on a PowerPC, only processors Intel processor. Sorry about that.

    You can download Firefox 3.6 here: http://www.mozilla.com/firefox/all-older

    ---

    Alternatively, there is an unofficial 5 Firefox for Mac PowerPC. You can read about it here:

    http://www.floodgap.com/software/tenfourfox/

  • How can I report any apparent bugs in iOS?

    I found two related bugs in iOS. Where can I report them? Both seem to be present from the first version of the iOS 9 to 9.2.1 and one at least was present on my iPhone so 5s.

    Bug1 - when I turn myiPhone 6s more laterally in the landscape mode and try to type (in iMessaging) the keyboard stops responding and I have to return the phone in mode portrait in order to continue.

    Bug2 - the equalizer settings seem to be affecting the system, not only the music sounds. I noticed when I left the setting equalizer "Late Night" while sending and reception of texts (send it and receive sounds). With EQ settings on sounds break and cracked, with EQ off is not.

    iOS version 9.2.1 iPhone 6s longer.

    Comments link is in the bottom-right corner, under the Contact section.

  • After the upgrade to OS 10.11.2, Mac Mini is so slow that it can take an hour to operate and the printer will not scan.

    After the upgrade to OS 10.11.2, Mac Mini is so slow that it can take an hour to operate and the printer will not scan.

    When you see a beachball cursor or the slowness is particularly bad, note the exact time: hour, minute, second.

    These must be run as administrator. If you have only one user account, you are the administrator.

    Run the Console application in one of the following ways:

    ☞ Enter the first letters of his name in a Spotlight search. Select from the results (it should be at the top).

    ☞ In the Finder, select go utilities ▹ of menu bar or press the combination of keys shift-command-U. The application is in the folder that opens.

    ☞ Open LaunchPad and start typing the name.

    The title of the Console window should be all Messages. If it isn't, select

    SYSTEM LOG QUERIES ▹ all Messages

    in the list of logs on the left. If you don't see this list, select

    List of newspapers seen ▹ display

    in the menu at the top of the screen bar.

    Each message in the journal begins with the date and time when it was entered. Highlight date back to the time you noted above.

    Select the messages entered since then until the end of the episode, or until they begin to repeat, whichever comes first.

    Copy messages to the Clipboard by pressing Control-C key combination. Paste into a reply to this message by pressing command + V.

    The journal contains a large amount of information, almost all this is useless to solve any particular problem. When you post a journal excerpt, be selective. A few dozen lines are almost always more than enough.

    Please don't dump blindly thousands of lines in the journal in this discussion.

    Please do not post screenshots of log messages - text poster.

    Some private information, such as your name, may appear in the log. Anonymize before posting.

    When you post the journal excerpt, an error message may appear on the web page: "you include content in your post that is not allowed", or "the message contains invalid characters." It's a bug in the forum software. Thanks for posting the text on Pastebin, then post here a link to the page you created.

    If you have an account on Pastebin, please do not select private in exposure menu to paste on the page, because no one else that you will be able to see it.

  • How can I report email address spam so that it can be blocked from hacking into my account and e-mailing my contacts?

    Original title: How can I report junk e-mail address, so it can be blocked to hack my account & * offshore contacts

    I'm sick & tired of being hacked on & on again by foreign sources, I recently discovered my yahoo account took advantage of Turkey & today that they are now my msn account hacking this is the second time I realized hack & spam there must be an easier way to communicate with someone on msn security represents my friends are pissed at me because it continues to send MSN I changed my the yahoo account password & also my password msn, but nothing seems to stop these predators which is msn do to catch these nut jobs

    Hello

    Sounds like you're being spoofed and not hacked. The emails appear in your sent
    Records showing you sent them?

    Which is called Spoofing and its pretty easy for a spammer to make. Of course, it does
    it look like you or the other person has sent the e-mail. Someone intercepted an email and
    It may not be you who caused him. Account of a friend could have been consulted
    or even someone could have sent an email on your behalf to someone else who has been
    compromise. Your friend can access headers and block the real senders of
    those who will change often.

    How to read the message headers
    http://www.emailaddressmanager.com/tips/header.html

    What Email Headers can tell you about the origin of Spam
    http://email.about.com/cs/spamgeneral/a/spam_headers.htm

    E-mail spoofing
    http://en.Wikipedia.org/wiki/E-mail_spoofing

    E-mail spoofing and Phishing
    http://www.mailsbroadcast.com/email.broadcast.FAQ/46.email.spoofing.htm

    Understanding E-mail Spoofing
    http://www.windowsecurity.com/articles/email-spoofing.html

    Fraudulent emails (false)
    http://pages.eBay.com/education/spooftutorial/

    Google search - email Spoofing
    http://www.Google.com/search?hl=en&EI=FB1nS9DiNo7CsQPNhKGdAw&SA=X&Oi=spell&resnum=0&CT=result&CD=1&ved=0CAgQBSgA&q=email+spoofing&spell=1

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle="" -="" mark="" twain="" said="" it="">

Maybe you are looking for

  • New Daq with the Daq Assistant in the filtering code

    Hei, I have a NI USB-6225 DaqMx I used a couple of years. When I started with LabVIEW, I found the Daq Assistant to the best way to measure the voltage with my Daq etc. My company has purchased another DaqMx NI USB-6225 and now I have a big problem:

  • I have what appears to be a virus/malware/Trojan horse

    and it is located near Microsoft security essentials and is listed as a serious threat, but it is allowed. I never allowed that and I can't get rid of it?

  • Beep code 1-1-1-1 from Presario V5094EA

    My Presario V5000 has renounced begin gradually.  Initially, I had problems with RAM occational market-code sound indicating.  The problem has gradually deteriorated and finally the laptop will not start. After cleaning contacts of the memory and the

  • BlackBerry Smartphones using the BBM after connecting through wifi?

    I just arrived in canada and I have connected my torch to wifi wpa personal, the browser works well but my bbm is not working, can someone please tell what to do to plug on bbm? Thank you

  • Prepare the Linux environment before installing EMP 11.1.2.4

    Hi allCould someone please help with Red Hat Linux environment preparation steps before installing the EMP 11.1.2.4I would like to know the list of RPMS to install and environmental variables to add changes in the settings of operating system files.T