Return-Path: Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: (qmail 84053 invoked from network); 5 Apr 2006 08:47:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Apr 2006 08:47:54 -0000 Received: (qmail 58174 invoked by uid 500); 5 Apr 2006 08:47:49 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 58085 invoked by uid 500); 5 Apr 2006 08:47:49 -0000 Mailing-List: contact users-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Discussion" Delivered-To: mailing list users@myfaces.apache.org Received: (qmail 58071 invoked by uid 99); 5 Apr 2006 08:47:49 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Apr 2006 01:47:49 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of thogau@gmail.com designates 64.233.184.236 as permitted sender) Received: from [64.233.184.236] (HELO wproxy.gmail.com) (64.233.184.236) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Apr 2006 01:47:48 -0700 Received: by wproxy.gmail.com with SMTP id i32so1463823wra for ; Wed, 05 Apr 2006 01:47:27 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=KAFnZAQcscaPtFDIdq64WHSdABJSi9dklZD52LAFOpwVr5pqHXIBrj2136lpT4xN30k/xcRqa/nDZW1DcBvuuMQe6saFQpHlPgnrC2IwxSv/59xje2ois0bn10mqcPwz1mVpyNzr6PDQq1kOoVAWlklUdLgp51NBl+Cr7o5qCYE= Received: by 10.65.189.1 with SMTP id r1mr228975qbp; Wed, 05 Apr 2006 01:47:27 -0700 (PDT) Received: by 10.65.210.19 with HTTP; Wed, 5 Apr 2006 01:47:27 -0700 (PDT) Message-ID: <4d29c6710604050147t2f9d878dpb47c5de123e864c3@mail.gmail.com> Date: Wed, 5 Apr 2006 10:47:27 +0200 From: "Thomas Gaudin" To: "MyFaces Discussion" Subject: Re: Problem when report generation and JSF navigation In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_17393_24615830.1144226847532" References: <4d29c6710604040508r6c2d0bb1v3e99ddc19d8c0a1b@mail.gmail.com> <1144154313.443268c9113d4@imp3-g19.free.fr> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_17393_24615830.1144226847532 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Works like a charm! Thanks Murat (and Martin) Thomas On 4/4/06, Murat Hazer wrote: > > Hi, > > You should add this line just above facesContext.responseComplete() line; > > facesContext.getApplication().getStateManager().saveSerializedView( > facesContext); > > PS: Martin's solution... > > > On 4/4/06, S=E9bastien Marin wrote: > > > > Hello, i have the same problem. The first action is Ok but the second > > just do a > > refresh or made error. It is the same process when we click on the back > > icon of > > the web browser. > > > > I would like to understand. Thanks > > Selon Thomas Gaudin : > > > > -> Hi, > > -> > > -> I am using JasperReport to generate PDF files "on the fly". > > -> It is working fine the first time I click on the link to the report > > but it > > -> fails alternatively every 2 clicks exactly... > > -> I guess I am somehow messing up the navigation mecanism but I don't > > know > > -> where to start my investigation. > > -> Any hint is warmly welcome. > > -> Thanks, > > -> > > -> Thomas > > -> > > -> Here is the code : > > -> -------------------- > > -> JSF Bean : > > -> public class Reports extends BasePage implements Serializable { > > -> public String users() { > > -> List results =3D userManager.getUsers(null); > > -> Map parameters =3D new HashMap(); > > -> parameters.put("format", "pdf"); > > -> parameters.put("WEBDIR", > > getServletContext().getRealPath("/")); > > -> try{ > > -> InputStream is =3D > > -> > > getServletContext().getResourceAsStream("/WEB-INF/reports/userList.jrxm= l"); > > -> JRBeanCollectionDataSource ds =3D new > > -> JRBeanCollectionDataSource(results); > > -> > > -> getResponse().setContentType("application/pdf"); > > -> getResponse().addHeader("Content-Disposition", > > "attachment; > > -> filename=3DuserList.pdf"); > > -> > > -> JasperDesign jasperDesign =3D JRXmlLoader.load(is); > > -> JasperReport jasperReport =3D > > JasperCompileManager.compileReport > > -> (jasperDesign); > > -> JasperPrint jasperPrint =3D > > -> JasperFillManager.fillReport(jasperReport, > > -> parameters, ds); > > -> JasperExportManager.exportReportToPdfStream(jasperPrint, > > -> getResponse().getOutputStream()); > > -> > > -> getFacesContext().responseComplete(); > > -> } > > -> catch(Exception e){ > > -> log.error(e); > > -> } > > -> return null; > > -> } > > -> -------------------- > > -> The link to generate report : > > -> > > -> -------------------- > > -> faces-config.xml : > > -> > > -> reports > > -> org.appfuse.webapp.action.Reports > > -> > > -> request > > -> > > -> userManager > > -> #{userManager} > > -> > > -> > > > > > > -- > Murat HAZER > Elektrik-Elektronik M=FChendisi - Electrical-Electronics Engineer > Tel - Phone: +90 222 335 05 80 - 1395 > Cep Tel - Mobile Phone: +90 532 472 00 63 > Blog URL: http://www.projedunyasi.org > Yahoo Group: http://groups.yahoo.com/group/malatyafenlisesi/ > ------=_Part_17393_24615830.1144226847532 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Works like a charm!
Thanks Murat (and Martin)

Thomas

= On 4/4/06, Murat = Hazer <murathazer@gmail.com<= /a> > wrote:


On 4/4/06, S=E9bastien Marin < the.marin@free.fr> wrote:
Hello, i have the same problem. The first action is Ok but the second just = do a
refresh or made error. It is the same process when we click on the = back icon of
the web browser.

I would like to understand. Thanks
Selon Thomas Gaudin <thogau@gmai= l.com>:

-> Hi,
->
-> I am using JasperReport t= o generate PDF files "on the fly".
-> It is working fine the first time I click on the link to the repo= rt but it
-> fails alternatively every 2 clicks exactly...
-> I guess I = am somehow messing up the navigation mecanism but I don't know
-> whe= re to start my investigation.
-> Any hint is warmly welcome.
-> Thanks,
->
-> Thomas
->
-> Here is the code :
-> ---= -----------------
-> JSF Bean :
-> public class Reports extends= BasePage implements Serializable {
->     public= String users() {
->         List results =3D = userManager.getUsers(null);
->      &nb= sp;  Map parameters =3D new HashMap();
->    = ;     parameters.put("format", "pdf"= ;);
->         parameters.put= ("WEBDIR", getServletContext().getRealPath("/"));
->         try{
->&nbs= p;            InputS= tream is =3D
-> getServletContext().getResourceAsStream("/WEB-IN= F/reports/userList.jrxml");
->     &nbs= p;       JRBeanCollectionDataSource ds =3D ne= w
-> JRBeanCollectionDataSource(results);
->
->         &nb= sp;   getResponse().setContentType("application/pdf");<= br>->           &= nbsp; getResponse().addHeader("Content-Disposition", "attach= ment;
-> filename=3DuserList.pdf");
->
->         &nb= sp;   JasperDesign jasperDesign =3D JRXmlLoader.load(is);
->= ;             J= asperReport jasperReport =3D JasperCompileManager.compileReport
-> (j= asperDesign);
->         = ;    JasperPrint jasperPrint =3D
-> JasperFillManager.fillReport(jasperReport,
-> parameters, d= s);
->          &nb= sp;  JasperExportManager.exportReportToPdfStream(jasperPrint,
->= getResponse().getOutputStream());
->
->    = ;         getFacesContext().respons= eComplete();
->         }
-> &= nbsp;       catch(Exception e){
-> = ;            log.err= or(e);
->         }
->&= nbsp;        return null;
-> =     }
-> --------------------
-> The link to gen= erate report :
-> <h:commandLink value=3D"report" action=3D"#{rep= orts.users}"/>
-> --------------------
-> faces-config.= xml :
->      <managed-bean>
-= >         <managed-bean-name&= gt;reports</managed-bean-name>
->         <managed-bean-= class>org.appfuse.webapp.action.Reports
-> </managed-bean-class= >
->         <managed-b= ean-scope>request</managed-bean-scope>
->   &= nbsp;     <managed-property>
->           =   <property-name>userManager</property-name>
-> = ;            <val= ue>#{userManager}</value>
->     &n= bsp;   </managed-property>
->    = </managed-bean>



--
Murat HAZER
Elektrik-Elektronik = M=FChendisi - Electrical-Electronics Engineer
Tel - Phone: +90 222 335 0= 5 80 - 1395
Cep Tel - Mobile Phone: +90 532 472 00 63
Blog URL:=20 http://www.projedunyasi.org
= Yahoo Group: http://groups.yahoo.com/group/malatyafenlisesi/

------=_Part_17393_24615830.1144226847532--