Bean is not worked  in the jsff page

Hi
JDeveloper Studio Edition Version 11.1.2.2.0
I Have a bean for run a jasperreport
package Reports;
import javax.faces.event.ActionEvent;
import sp11.model.apm.clubImpl;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.HashMap;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
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.type.WhenNoDataTypeEnum;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.view.JasperViewer;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.binding.BindingContainer;
import oracle.jbo.client.Configuration;
public class CardFrontBean {
public CardFrontBean() {
public String runReportAction(){
DCIteratorBinding rleIter = (DCIteratorBinding)getBindings().get("RealentityIterator");
String RleId = rleIter.getCurrentRow().getAttribute("RleId").toString();
BigDecimal ID = new BigDecimal(RleId);
Map parameter = new HashMap();
parameter.put("ID", ID);// where ID is a jasper report parameter
try
runReport("card_front.jasper", parameter);
catch (Exception e)
return null;
public BindingContainer getBindings(){
return BindingContext.getCurrent().getCurrentBindingsEntry();
public ServletContext getContext(){
return (ServletContext)getFacesContext().getExternalContext().getContext();
public HttpServletResponse getResponse(){
return (HttpServletResponse)getFacesContext().getExternalContext().getResponse();
public static FacesContext getFacesContext(){
return FacesContext.getCurrentInstance();
public void runReport(String repPath, java.util.Map param) throws Exception {
Connection conn = null;
try
HttpServletResponse response = getResponse();
ServletOutputStream out = response.getOutputStream();
response.setHeader("Cache-Control", "attachment;filename=\"CardFront.pdf\"");
response.setContentType("application/pdf");
ServletContext context = getContext();
InputStream fs = context.getResourceAsStream("/ReportsFolder/" + repPath);
JasperReport template = (JasperReport) JRLoader.loadObject(fs);
template.setWhenNoDataType(WhenNoDataTypeEnum.ALL_SECTIONS_NO_DETAIL);
PreparedStatement statement = null;
String amDef = "sp11.model.apm.club";
String config = "clubLocal";
clubImpl am = (clubImpl)Configuration.createRootApplicationModule(amDef,config);
statement = am.getDBTransaction().createPreparedStatement("select 1 from dual", 0);
conn = statement.getConnection();
JasperPrint print = JasperFillManager.fillReport(template, param, conn);
//JasperViewer.viewReport(print, false);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JasperExportManager.exportReportToPdfStream(print, baos);
out.write(baos.toByteArray());
out.flush();
out.close();
FacesContext.getCurrentInstance().responseComplete();
catch (Exception jex)
jex.printStackTrace();
finally
close(conn);
public void close(Connection con){
if (con != null)
try
con.close();
catch (Exception e)
and a commandButton in the .jsff page
<af:commandButton id="Realentitycardfront"
textAndAccessKey="#{nls['REALENTITY_CARDFRONT']}"
shortDesc="#{nls['REALENTITY_CARDFRONT_HINT']}"
action="#{CardFront.runReportAction}"/>
my .jsff page is in a bounded task flow with Use Page Fragments = true
when i click the button. ........>nothing
what is the matter
i read in a post that it is not work in jsff page with page fragmentation
please help me
thanks

One problem is that you write into the output stream from an action method and don't know what's already in the output stream. Once there is one byte written to hte stream (which you can't know from inside the action method) the pdf stream does not behave as you think it would.
Next thing is that you use createRootApplicationModule but never release it. This will get you out of resources error eventually.
A better approach would be to put this code in a servlet and stream the report from there. In the servlet you have control over the output stream.
Check my blog http://tompeez.wordpress.com/2011/12/16/jdev11-1-2-1-0-handling-imagesfiles-in-adf-part-3/ where I show how to serve images from a servlet which can even use the application module pool from the application (no need to use createRootApplicationModule at all). All you have to do is to exchange the part where I get and stream the image data to your needs.
Timo

Similar Messages

  • "New Document" button on ribbon not working in the "Master Page Gallery" in Internet Explorer 10 & 11

    I'm trying to add a "JavaScript Display Template" to my "Master Page Gallery" but when I click on the "New Document" button and select "JavaScript Display Template" it opens the "Add a master page" dialog
    and prompts me to upload a file.  I've ran into this problem with "Compatibility View" set to both "On" or "Off".  I'm able to upload files but I can't get the new forms to show up.
    This happens on the root site collection site.  For subsites, the "New Document" button is completely grayed out.  
    FYI - I am a site collection admin and in the "Owners" group for each site.
    How can I fix this?

    Hi,
    According to your post, my understanding is that "New Document" button on ribbon falied to work in the "Master Page Gallery".
    In the root site, please make sure you enter all the necessary information when you upload file.
    In the other word, you need to make sure the save the “JavaScript Display Template" successfully.
    In the subsites, when you click the “Master Page” under Master Page Gallery in the sub site site setting page, the "New Document" button is completely grayed out.
    If you want to add the template, you need to active the “SharePoint Server Publishing” feature in the Site sitting->Manage site features.
    However, the “Master Page” under Master Page Gallery will become to “Master pages and page layouts”.
    If you click the Master pages and page layouts”, you will go to the
    Master Page Gallery of the root site, and then you can add Document.
    Thank you for your understanding.
    Thanks,
    Linda Li
    Linda Li
    TechNet Community Support

  • Script does not work on the second page

    Hi, I believe it's just a little problem:
    I use the following script( I just copied a part of it, so don't care
    about missing brackets etc.)
    to automatically fill some text field according to the selection in a drop-down field:
    switch (xfa.event.newText) {
    case "8 8x1":
    berstdruck.rawValue = "≥65";
    htberst.rawValue = "≥20";
    maxflex.rawValue = "≥34";
    deflect.rawValue = "≥6";
    flexforce.rawValue = "≤44";
    minbend.rawValue = "≤40";
    permeation.rawValue = "≤2";
    length1.rawValue = "-1,5...+1,5"; remark:these fields are on page 2
    length2.rawValue = "-1,2...+1,2"; remark:these fields are on page 2
    break;
    The last two fields on page 2 of
    my document are not filled automatically.
    The others work well.
    Can somebody help?
    Thanks
    Alex

    You'll need to fully qualify the fields that are on other pages. The reason for this is these fields are not underneath the same parent in the XML DOM as where you're script is running (the drop-down). So it does not find the fields on the other pages and doesn't know where to look for them.
    A fully qualified SOM expression would look something like this:
    xfa.form.formName.pageName.subFormOnThePageNameIfExists.fieldName
    H.

  • OnClick not working in the validation page

    Hi All,
    In my jsp i used onClcik for radio buttons. if i click the radio button this hide some fields and show some fields based on the radio button. For this Jsp Page
    i did validation in my action(Struts1.1) using ActionMessages class.I can choose the radio button. That time onclick working properly. then after when i click submit (that time i did validation. For example check the field is empty or not) if error occurs, then it redirects the same page. That page doesn't hide the fields based on the radio button. so again i need to click the radio button. My question is, Is this possible to show the fields based on the radio button(without click again radio button) when it redirects the same page (Validation is here)?
    please assist me .
    Thanks in advance.
    Regards
    Lakshmi

    Hi,
    According to your description, my understanding is that you want to add button in a calculated field to call custom JavaScript function.
    I suggest you can use concatenate formula function to achieve it.
    You can add button use concatenate function like below:
    =CONCATENATE("<input type='button' name='btnAddToBasket' id='btnAddToBasket' value='Add to basket' onclick=","addToBasket('",[Document Name],"','",[Original],"')"," />")
    More information:
    How can I get a button in SharePoint to display info about a record?
    CONCATENATE function
    Thanks
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Multiple portlets using javascripts not working on the same page!!!

    Does anyone know a work around for this problem????
    I have two seperate dynamic pages. Each page has a drop down menu which is built from javascript and dhtml. Individually they both work fine. However they stop working when placed on a page together. Even when in seperate regions. I need to keep both of them as seperate portlets so i cannot solve the conflicts in the javascript as i would if they were coded together.
    Any Ideas????
    Anyone?????

    Daniel,
    It could be a script conflict - "any duplication in variable declaration, function name, or event-handler access in two scripts can cause at least one, if not both scripts to become inoperative." Check this site to see if this applies to you:
    http://www.javascriptkit.com/javatutors/multiplejava2.shtml
    Good luck!

  • EndNote plug-in does not work in the new Pages?

    I have EndNote X7 installed as well as the Pages EndNote Plug-in v1.0. It worked fine for Pages before the update. Now, I can see the ' EndNote Citation' in the insert menu, but it is grey and cannot be selected. I have re-installed the Plug-in again, but problem still exists. Any suggestions?

    I had Endnote x5 but after realizing mavericks does not support it then i updated it to x6 ( and also x7 to try  and find where is the problem). However, i also meet the same problem with Endote x6 / x7 and Pages 5.0! Version 2 supports adding citation for pages BUT; there is no chance to select Bibliography and its predefined citation Styles although endnote has a different (my desired) citation style. (no Sync with papes :S)
    An immediate Update Please!
    I am nothing without this integration as a master student! THESIS!!!!!

  • Procon Latte is not working and the home page is up for sale. Is it still viable?

    It worked fine until last week. I have a password on the settings but nothing is working. Is it still a good add-on?

    It worked, keeping out the bad words, I checked my settings but it stopped working. And the creator no longer has a web page.

  • I upgraded to version 9 from version 8. The following items do not work properly - menu, home page, navigation bar, wheel click. I backed up to version 8, and none of this stuff works right. How do I fix this?

    When I open Firefox, the bookmark menu is a little tab in the upper left corner. If I go to view and un-click bookmark menu and then view, click it, the standard menu bar shows up. The Back and Forward buttons don't work. The navigation window does not show the URL of the current page. When opening, the home page does not come up. The wheel click works on the bookmark bar, but not within a page. The menu (file, edit, etc) does not work after the first page. Version 8 worked well. When I upgraded to version 9, all this trouble started. I backed up to version 8, but the problem persists.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    Create a new profile as a test to check if your current profile is causing the problems.
    See "Basic Troubleshooting: Make a new profile":
    *https://support.mozilla.com/kb/Basic+Troubleshooting#w_8-make-a-new-profile
    There may be extensions and plugins installed by default in a new profile, so check that in "Tools > Add-ons > Extensions & Plugins" in case there are still problems.
    If that new profile works then you can transfer some files from the old profile to that new profile, but be careful not to copy corrupted files.
    See:
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox
    *http://kb.mozillazine.org/Standard_diagnostic_-_Firefox

  • Firefox did an automatic update to 6.01, and now my middle mouse button is not working in the browser. It doesn't close tabs, it doesn't open new tabs by middle clicking a link, it doesn't allow me to middle click to scroll the page...

    Firefox did an automatic update to 6.01, and now my middle mouse button is not working in the browser. It doesn't close tabs, it doesn't open new tabs by middle clicking a link, it doesn't allow me to middle click to scroll the page..

    [BUG FIXED, see "EDIT 2" at the end of my post]
    I'm on Firefox 3.6.21, and I got this problem today after a Greasemonkey update (To version 0.9.10, apparently).
    Disabling Greasemonkey solved the problem, and re-enabling it reproduced the problem (middle-clicking links to open in new tab did not work, merely highlighted the link).
    I should also note that while Greasemonkey was enabled and the bug was affecting me, Ctrl+Click to open links in new tabs was also broken.
    I hope this helps!
    EDIT: It appears this is a known incompatibility/conflict bug between current versions of Greasemonkey and Tab Mix Plus. Read more here:
    https://github.com/greasemonkey/greasemonkey/issues/1406
    EDIT 2: GREASEMONKEY HAS NOW BEEN UPDATED with a workaround to fix the problem. Go to https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/versions/ to install the update manually. It hasn't been reviewed by Mozilla yet, so it won't be an automatic update for another day or two. All credit to "cannonfodder" below for noticing this; please mark his post as helpful!

  • I wanted to send a push notification, unfortunately it does not work. The page will not load. Anyone know why?

    I wanted to send a push notification, unfortunately it does not work. The page will not load. Anyone know why?

    Push notifications, I believe, is only for iOS.
    If it is for iOS, take a look at Using Apple push notifications with Digital Publishing Suite | Adobe Developer Connection

  • Front page opens works shortly freezes. only yellow green buttons work. I click yellow to minimize normal top bar menu appears I choose new page, opens works normally. The restart saved tabs does not work on that first page.

    front page opens works shortly freezes.
    only yellow green buttons work. I click yellow to minimize normal top bar menu appears I choose new page, opens works normally.
    The restart saved tabs does not work on that first page.

    Hi @prdstudio3 ,
    Thank you for visiting the HP Support Forums. The Serial Number needed to be removed from your Post. This is From our Rules of Participation:
    Protect privacy - yours and others'. Don't share anything about yourself that you would not want to see on a road-side billboard. Don't post contact or other personal information-your own or anyone else's-or any content that you receive in one-to-one communications without the author's consent. For example, don’t post your computer’s serial # or contact information publicly, and do not allow someone you don’t know to remotely take control of your computer.
    If you need people to contact you directly, either ask them to send you a private message or subscribe to the thread so you will be notified when there are replies. You may also click on your name anywhere in the forum and you will be taken to your profile page, where you can find a list of threads you have participated in.
    Sharing personal email addresses, telephone numbers, and last names is not allowed for your safety. If you have any questions feel free to send me a private message in reply.
    Thank you
    George
    I work for HP

  • I would like to create the a swatch, add it to the library and import to the swatch panel.  The help pages available relate to earlier versions of Muse, which does not work with the 2014.2 release version that I have.  I have created a library folder, imp

    I would like to create the a swatch, add it to the library and import to the swatch panel.  The help pages available relate to earlier versions of Muse, which does not work with the 2014.2 release version that I have.  I have created a library folder, imported the colour swatch as just 4 colours as a mulib file.  I drag the four colours on to the muse page in design view but that is as far as I get.  Can anyone help?  Thanks

    I don't know since I don't share anything. You'll have to peruse the help files and check the permissions and ACLs on the Shared folder. According to the permissions on the Shared folder everyone can R&W. If you want those to be inherited by everything dropped into the folder, add an ACL for
    everyone allow read, write
    Details in the manpage for chmod. The actual steps are left as an exercise.

  • Wireless mouse will not work at the top of the page on ANY website while running Firefox 7.0.1

    I am currently running Firefox 7.0.1 and have not had many problems until today. I have noticed that my wireless mouse will not work at the top of any website. This means I cannot log into many sites. I have also noticed that during page downloads, I have to move the mouse in order for the page to load or it just pauses. Any help would be appreciated!

    If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    *Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")
    Se also:
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • I am having trouble printing I have a connection to my printer wirelessly but does not print out the correct page I want.When I do print I get a bunch of pages more than is needed and also get a code and symbols please help I am jammed at work

    I am having trouble printing I have a connection to my printer wirelessly but does not print out the correct page I want.When I do print I get a bunch of pages more than is needed and also get a code and symbols please help I am jammed at work

    This can be the result of selecting the wrong driver. An older, unsupported laser printer will sometimes work with the generic Postscript driver.

  • I have a printer xerox 3220 on networking ,have pc´s and a mac ,problem:it´s already install but does not work ,only print many page with code program,i will appreciate the solution

    i have a printer xerox 3220 on networking ,have pc´s and a mac ,problem:it´s already install but does not work ,only print many page with code program,i will appreciate the solution

    Hi guillermospain,
    Welcome to the Support Communities!
    The article below may be able to help you with this.
    Click on the link to see more details and screenshots. 
    OS X: Connecting a Wi-Fi printer to your Wi-Fi network
    http://support.apple.com/kb/ht3500
    OS X Mountain Lion: Set up a printer
    http://support.apple.com/kb/PH11145
    OS X Mountain Lion: Reset the printing system
    http://support.apple.com/kb/PH11143
    Cheers,
    - Judy

Maybe you are looking for

  • How do I Delete an iTunes U Site?

    Does anyone know how to delete an iTunes U Site? We are looking to create a new account.

  • Itunes can not read its library

    itunes will not load and gives message "the file 'itunes library' cannot be opened because it was created by a newer version of itunes" I keep getting this message even though I have reinstalled the latest version twice.

  • WINE, MS Office 2003, and ugly fonts

    I thought that there was a thread floating around about this, but I couldn't seem to find it... I need to learn Access in a hurry, so I installed MS Office 2003 on my 64 bit workstation. Everything seems to working alright, but the fonts look like cr

  • Print Workbench file

    Hello I would like to know what is the best way to work with files in the print workbench. The 3rd part company wants to work with txt files. Should I create XML(SmartForm), or RDI(SAPscript) and then convert to txt? Online documentation has a lot of

  • Push data/ trigger event in Web Dynpro app

    Hello All. I'm a newbie with web dynpro.  I have a need to “push” information to a web dynpro application.  Is there a way I can trigger an event in web dynpro to refresh the screen from another application running on the Netweaver J2EE?  Is it possi