[JBoss Seam] - Re: Some doubts about Seam
by SmokingAPipe
To answer your questions:
1. Seam works with either EJB3 or Hibernate. I'm using EJB3 in my projects because EJB3 is a standard. I think that Hibernate itself is a bit more powerful in what it can do. Under the hood, JBoss EJB3 is based on Hibernate I believe.
2. Don't use Tomahawk. I tried that. It was extremely frustrating. Tomahawk is not recommended. Use Richfaces or Icefaces. They are both beautiful and excellent and capable of some incredible "Web 2.0" effects. And they both work nicely with Seam. Last time I tried it Tomahawk does NOT work nicely with Seam.
Problems with Seam: If there's a problem in the configuration, tracking it down and fixing it can be a major headache. Seam-gen should "just work" but it is not always the answer and it doesn't always just work. Once you learn all this config stuff you do eventually figure out how to debug config-related exceptions, but it's a painful learning process. My one hint to the Seam developers would be, it would be great if we had more informative exceptions that would give us more ideas where to look for problems.
Good things about Seam: there is no better model for web development that I have ever seen. It lets you really focus on doing the work. Once config problems are sorted out, you can work directly with your objects. No more SQL, no more low-level HTML, no more writing validators. It'a amazing.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069412#4069412
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069412
17Â years, 3Â months
[JBoss Seam] - Open PDF in new window
by jfrankman
I am trying to stream a PDF to a new browser window. I can get this to work, but the strange thing that happens is that a new browser window gets opened, but instead of the PDF geting displayed inside the browser window, it is opened separately by Adobe Acrobat. So, the user is forced to close two windows, the Adobe Acrobat window and the blank Browser window. I have gone over my code but have never seen any behavior quite like this.
What will cause a new browser window to open up, but still open Adobe Acrobat outside of the browser?
Any thoughts on why this is happening?
Could this have something to do with using the seam link or is this more likely a JSF response issue?
My code is as follows:
JBoss Seam Link:
<s:link id="link1"
| action="#{reportDocumentBean.viewPhysicalDamagePDF}" target="_blank">
| <h:outputText value="Print" />
| </s:link>
here is the heart of the Print Report Bean's method:
| HttpServletResponse response = (HttpServletResponse) faces
| .getExternalContext().getResponse();
| response.setContentType("application/pdf");
| response.setContentLength(pdf.length);
| response.setHeader("Content-disposition", "attachment;filename=\""
| + reportName+"crystalreport.pdf" + "\"");
|
| ServletOutputStream out;
| out = response.getOutputStream();
| out.write(pdf);
| out.flush(); //new
|
| out.close();
| bais.close();
| reportClientDocument.close();
| faces.responseComplete(); //new
|
|
Here is the entire method incase you need to see the context of the snippet above.
| private void viewPDF(String reportName, String fullClassName, String tableAlias, String subreportTableAlias, List dataSet)
| {
| FacesContext faces = FacesContext.getCurrentInstance();
|
| try {
| ReportClientDocument reportClientDocument = new ReportClientDocument();
| String report = reportName;
| //String report = "RDC_To_CR.Net.rpt";
| reportClientDocument.open(report, 0);
|
|
| List<CrystalDTO> crystalTranferObjects = new ArrayList<CrystalDTO>();
|
| //fill dto
| CrystalDTO crystalDTO1 = new CrystalDTO(dataSet,
| fullClassName,
| tableAlias, subreportTableAlias);
| crystalTranferObjects.add(crystalDTO1);
|
|
|
| Iterator crystalDTOIterator= crystalTranferObjects.iterator();
| while(crystalDTOIterator.hasNext())
| {
| CrystalDTO dto=(CrystalDTO)crystalDTOIterator.next();
|
| ReportCreator.passPOJO(reportClientDocument, dto.getDataSet(), dto.getClassName(), dto.getTableAlias(), dto.getSubreportName());
| }
|
| ByteArrayInputStream bais;
| bais = (ByteArrayInputStream) reportClientDocument
| .getPrintOutputController().export(ReportExportFormat.PDF);
| byte[] pdf = new byte[bais.available()];
| bais.read(pdf, 0, bais.available());
|
| HttpServletResponse response = (HttpServletResponse) faces
| .getExternalContext().getResponse();
| response.setContentType("application/pdf");
| response.setContentLength(pdf.length);
| response.setHeader("Content-disposition", "attachment;filename=\""
| + reportName+"crystalreport.pdf" + "\"");
| ServletOutputStream out;
| out = response.getOutputStream();
| out.write(pdf);
| out.flush(); //new
|
| out.close();
| bais.close();
| reportClientDocument.close();
| faces.responseComplete(); //new
|
| }
|
| catch (ReportSDKException e) {
| e.printStackTrace();
| } catch (IOException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| } catch (ClassNotFoundException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
| faces.responseComplete();
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069405#4069405
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069405
17Â years, 3Â months