Save rendered JSF page into HTML
Hi,
We have a requirement wherein, a rendered JSF (i.e. JSP) page needs to be saved in HTML form on server side.
One option is to write filter which will process the response and write to File. But in this case filter will intercept all request, while in my case, I want to generate HTML only when user click on particular button. For rest of the request it should bypass this filter.
Apart from filter, can we have some API which will do this?
Thanks
Chintan
Is the page contents idempotent or not? If it is, just use java.net.URLConnection to query the same page. If not, then you need to do more work. You need to clone the response stream before it is been sent to the client and store it somewhere. You can do it using a Filter which replaces the HttpServletResponse with your own HttpServletResponseWrapper implementation.
Similar Messages
-
How to get rendered JSF page (send it as HTML email)
Hello,
I would like to send notification email in my application. Could you please help me to find a way how to get HTML result of JSF page as string-file-stream. Simply anything I could handle and use it as email body or attachment.
My use case: User click to button (raise a action) which change something in DB and confirmation.xhtml(.jsf) is shown to him to confirm that this action was succesful. And I would like to send notification email to all other users with this page (simplified version).
I need a something like String getJsfPage(String url) but I could not find anything in JSF API.
Thanks for any clue.quote gimbal2: +...now write the code to generate the email body...+
Thanks for reply...
Is that mean that I could not use already written code (confirmation.xhtml)? The beuty on JSF is that JSF parser take care about CSS styles, EL, templating (ui: ...), ... When anybody (administrators) wants to change how this email looks - just change this XHTML file.
How should I write email body? I thought about several way but nothing what looks good:
- I really dont want to use StringBuilder do build HTML.
- I dont want to write my own parser of .xhtml template (confirmation.xhtml).
- Write HTML (xml) template and parse it with XSLT transformation seems to me acceptable but complicated. Needs a special library to perform XSLT, complicated template service (future changes)
- JSP page, more-or-less the same problems like JSF page
The sad is that this email (html) body is quite small but highly dynamic (css, language of texts, logos...). -
Save a JSF page as word document
Hi All,
I have a simple JSF page with some generated content. In that page, there is a button as "save as word". When the link is clicked , i need the save dialog to appear and prompt the user to save the content in the JSP page as word document.How can i do this in JSF.
Please guide me in this regard.
Thanks & Regards,
PalsI don't think this is easily achieveable, if even possible
A web page as you see it is the result of a web browser rendering the html in its own way. Different browsers can display the same html differently. So what gets displayed to the user is dependent on their browser.. In order to produce an image of what they see, you would need to somehow render the image differently depending on the value of the User-Agent header.
Maybe by hacking around the hotjava browser you could start to do something like this, but I'd imagine it would be quite messy and again different to what the user views. -
New View Columns are Blank on Rendered JSF Page
In an existing application, I am trying to add a few columns to an ADF Read-Only Table on an existing jsf page. In the model project, I added the columns to the read-only view object by changing the SQL statement. I then tested the business layer changes in the BC tester and the view works as I expected it to. I opened the affected jsf page in the ViewController, and tried to add the columns by copying the last column in the table repeatedly and just changing the sortable and headerText properties of the af:column objects and the text property of the af:outputText objects to values representing the new columns. Upon testing the page, the new columns appeared in the table but they where empty. No headers, no data. I then tried deleting the entire table and creating a new one by dragging the view back onto the page and selecting Create -> Tables -> ADF Read-only Table.... In the dialog I selected all the fields of interest and the new table appeared on the design view of the page. Running this version of the page gave me the same results as manually adding rows.
What am I doing wrong? Is there something I need to do to the pagedef file? Is there another file that is "out of sync" with my jspx and pageDef files? I have been away from ADF for several months and I thought I covered all my bases.
Thanks,
JeffJeff,
Your first scenario should work. What you need to do after copying the columns and changing all of the properties - go into the page definition, find the binding for the iterator upon which the table is based, double-click it, then you need to use the shuttle to add the new VO fields.
Should work like that.
John -
Importing visual jsf page into another jsp page
Hi
I am developing a web application using jsp and struts. I want to embed a visual jsf page that Ive created into another jsp page (which is a normal jsp page, not a jsf one.)
Ive tried quite a few things but nothing seems to work..
<jsp:include page="Page2.jsp">
Ive surrounded the code in the f:subview tags. still doesnt work.
Ive tried using <jsp:useBean id="Page2" scope="page" class="visualwebapplication.Page2" > .. It does not give me an error, but does not embed the page as well. Do I need to some other code after this to use the above bean to display the page.
Any help would be greatly appreciated.
Regards
Sparsh AgarwalHi
This is the error message that is generated in the tomcat log once i try to load the homePage.do
Jul 31, 2008 2:27:47 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Cannot forward after response has been committed
java.lang.IllegalStateException: Cannot forward after response has been committed
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:302)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:115)
at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:320)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
at com.sun.faces.extensions.avatar.lifecycle.PartialTraversalLifecycle.render(PartialTraversalLifecycle.java:106)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
at org.apache.jsp.view.main_005fright_jsp._jspService(main_005fright_jsp.java:54)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:609)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:99)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:135)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:760)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:892)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
at org.apache.jsp.view.templates.layoutBase_jsp._jspx_meth_tiles_005finsert_005f5(layoutBase_jsp.java:255)
at org.apache.jsp.view.templates.layoutBase_jsp._jspService(layoutBase_jsp.java:120)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:239)
at org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:341)
at org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:572)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:221)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Jul 31, 2008 2:27:47 PM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet Faces Servlet threw exception
java.lang.IllegalStateException: Cannot forward after response has been committed
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:302)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:115)
at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:320)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
at com.sun.faces.extensions.avatar.lifecycle.PartialTraversalLifecycle.render(PartialTraversalLifecycle.java:106)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
at org.apache.jsp.view.main_005fright_jsp._jspService(main_005fright_jsp.java:54)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:609)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:99)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:135)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:760)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:892)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
at org.apache.jsp.view.templates.layoutBase_jsp._jspx_meth_tiles_005finsert_005f5(layoutBase_jsp.java:255)
at org.apache.jsp.view.templates.layoutBase_jsp._jspService(layoutBase_jsp.java:120)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:239)
at org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:341)
at org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:572)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:221)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Jul 31, 2008 2:27:47 PM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: Cannot forward after response has been committed
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:302)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:115)
at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:320)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
at com.sun.faces.extensions.avatar.lifecycle.PartialTraversalLifecycle.render(PartialTraversalLifecycle.java:106)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
at org.apache.jsp.view.main_005fright_jsp._jspService(main_005fright_jsp.java:54)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:609)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:99)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:135)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:760)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:892)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
at org.apache.jsp.view.templates.layoutBase_jsp._jspx_meth_tiles_005finsert_005f5(layoutBase_jsp.java:255)
at org.apache.jsp.view.templates.layoutBase_jsp._jspService(layoutBase_jsp.java:120)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:239)
at org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:341)
at org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:572)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:221)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Jul 31, 2008 2:27:47 PM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: ServletException in '/view/main_right.jsp': Cannot forward after response has been committed
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:923)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
at org.apache.jsp.view.templates.layoutBase_jsp._jspx_meth_tiles_005finsert_005f5(layoutBase_jsp.java:255)
at org.apache.jsp.view.templates.layoutBase_jsp._jspService(layoutBase_jsp.java:120)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:239)
at org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:341)
at org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:572)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:221)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Jul 31, 2008 2:27:47 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet action threw exception
javax.servlet.jsp.JspException: ServletException in '/view/main_right.jsp': Cannot forward after response has been committed
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:923)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
at org.apache.jsp.view.templates.layoutBase_jsp._jspx_meth_tiles_005finsert_005f5(layoutBase_jsp.java:255)
at org.apache.jsp.view.templates.layoutBase_jsp._jspService(layoutBase_jsp.java:120)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:239)
at org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:341)
at org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:572)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:221)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619) -
Render a JSP page into HTML in a String
I am using a mail template system that gets templates as JSP pages placed in /WEB-INF/mailtemplates/
I want to internally parse JSPs as if they were real JSPs in my tomcat but:
- Get get them using getResourceAsStream (or any other way)
- make JSP engine translate JSP into HTML into a String object.
- Send a mail with this HTML. (this part is already finished)
What I need is a method with the following proposed signature:
public String getMailTemplate(java.io.InputStream jspPageStream, javax.servlet.HttpServletRequest request) {}
The method must get the JSP from the stream, render it into the HTML and return it as a String.
Of course, it must render the JSP as a real JSP, using the apserver JSP engine. It must so replace any tags and EL objects:
${session.user.name} -> The name of the user
<c:forEach, ...
etc. etc. etc.
�Any ideas / directions on how to achieve this?
thanks,
IgnacioOk, just tried it out myself, and I'm getting the same result you are.
Nothing makes it out to the RedirectingServletResponse.
It appears to be buffering it somewhere in the included page.
If you put a command to flush the buffer on the jsp page being included: <% out.flush; %> then it works.
So why doesn't it work normally? Why doesn't the call to requestDispatcher.include (or forward) flush/commit its response?
I will admit to being stuck on this one. I'm figuring its something in the internal workings of Tomcat/JSP to do with when a page is flushed or not, but I can't thing of anything right now.
Here is the test I put together to try this out (along with a few corrections to my previous code). I will admit to being stumped :-)
The response wrapper:
package web;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
public class RedirectingServletResponse extends HttpServletResponseWrapper {
RedirectServletStream out;
* @param arg0
public RedirectingServletResponse(HttpServletResponse response, OutputStream out) {
super(response);
this.out = new RedirectServletStream(out);
/* (non-Javadoc)
* @see javax.servlet.ServletResponse#flushBuffer()
public void flushBuffer() throws IOException {
out.flush();
/* (non-Javadoc)
* @see javax.servlet.ServletResponse#getOutputStream()
public ServletOutputStream getOutputStream() throws IOException {
return out;
/* (non-Javadoc)
* @see javax.servlet.ServletResponse#getWriter()
public PrintWriter getWriter() throws IOException {
return new PrintWriter(out);
/* (non-Javadoc)
* @see javax.servlet.ServletResponseWrapper#getResponse()
public ServletResponse getResponse() {
return super.getResponse();
/* (non-Javadoc)
* @see javax.servlet.ServletResponseWrapper#setResponse(javax.servlet.ServletResponse)
public void setResponse(ServletResponse arg0) {
super.setResponse(arg0);
private static class RedirectServletStream extends ServletOutputStream {
OutputStream out;
RedirectServletStream(OutputStream out) {
this.out = out;
public void write(int param) throws java.io.IOException {
out.write(param);
A JSP using this class: requestWrapperTest.jsp
<%@ page import="java.io.*" %>
<%@ page import="web.RedirectingServletResponse" %>
<%@ page contentType="text/html;charset=UTF8" %>
<%!
public String getEmailText(HttpServletRequest request, HttpServletResponse response, String emailURL) {
try{
// create an output stream - to file, to memory...
ByteArrayOutputStream out = new ByteArrayOutputStream();
// create the "dummy" response object
RedirectingServletResponse dummyResponse;
dummyResponse = new RedirectingServletResponse(response, out);
// get a request dispatcher for the email template to load
RequestDispatcher rd = request.getRequestDispatcher(emailURL);
// execute that JSP
rd.include(request, dummyResponse);
// at this point the ByteArrayOutputStream has had the response written into it.
dummyResponse.flushBuffer();
byte[] result = out.toByteArray();
System.out.println("result = " + result.length);
// now you can do with it what you will.
String emailText = new String(result);
return emailText;
catch (Exception e){
e.printStackTrace(System.out);
return "DANGER WILL ROBINSON!";
%>
<html>
<body>
<h2> Server Info Virtual!!</h2>
Server info = <%= application.getServerInfo() %> <br>
Servlet engine version = <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %><br>
Java version = <%= System.getProperty("java.vm.version") %><br>
<hr>
<%
String result = getEmailText(request, response, "/testLoad.jsp");
System.out.println(result);
%>
<%= result %>
</body>
</html>------------------------------------------------------------------
And the template page being included: testLoad.jsp
This is the page loaded for testing
<%
System.out.println("in the inner jsp");
// uncomment the following line to see this example work
//out.flush();
%> -
Including a jsf page into simple jsp
hey i m including a xhtml i.e facelet into an jsp file.till this scenarion it is working fine but when i am including that page into another jsp page it is not showing the correct representation of the jsf components
I know it is frustrating to have a problem, but read your own question and ask yourself this: can anybody help me with the information I am giving here? I hope you can reason for yourself that this is simply not true, no matter how much you want it to be.
You'll have to dig deeper yourself until you can either solve it, or unearth more information that might allow people to help you. -
Want to integrate all jsf pages into one application like globle mene
Hi,
i have created lot of jsf pages, that all are in diffrenet-2- systems. Now i want to integrate all page in one system for one application. please tell me how i can integrate these in jdeveloper.
Thanks in Advance.
SanjayHi,
if you want them all under one J2EE context root during runtime then you have to move the files to one project root, which is a manual configuration to do. For build requirements like this i think looking into Apache Maven could hep.
Frank -
Rendering web page into an image
is there any way to render a web page into a thumbnail image using java.
please let me know if there are any...(in case my message has been misunderstood) ...The webpage displayed into the ibook page should allow the reader/user the possibility to have a basic/normal web interaction with it (selecting, scrolling, etc.).
Thank you
Fulvio -
Save report output automatically into html
Hi Gurus!
I have few reports that give a simple list output as result.
Now I want to put an option in the output , an option that will be
a save buttom which when clicked will automatically save the output
into an html file and archive it to a particular folder.
I would like to know how to automatically archive the report output
when this save buttom is clicked to a folder.
DO we do it after we have printed the report in the output
and how do we go abot doing this .
Regards
SumitHi,
After running a report, call this function module WWW_LIST_TO_HTML
to convert the list output to HTML.
Best Regards,
Krishna -
Save as "web page, complete" .html file disappears when overwriting file with same name
On Mac and PC using various versions of FireFox (including 29.0.1 on Win 7) the following occurs:
"Save Page As" a page with several iFrames in the content. I use "Web page, complete" and name the file.
Close FireFox. The .html file and accompanying folder are saved correctly. Then I open the file in FireFox and make some changes to fields in a form. Then "Save Page As" again and use the same name. It prompts to overwrite the existing file and I click Yes.
Three out of four times the file is no longer there. The folder remains but the .html file is gone. Not in the trash or hidden, just gone.
I know this sounds crazy but I have tested it on about 20 computers (both mac and various windows versions), all with different FF versions and different antivirus. The above scenario happens: always on 1 computer, occasionally (random) on 3, and hasn't been observed yet on the others.
Has anyone encountered this before? Are there any antivirus or malware products that could cause this? Any settings in FF that could? Any thing about this page or frames that could cause it?I found the solution. Yes, the first time you replace a file it disappears altogether. Just save it again, and it will reappear with the updated date and time code in the directory you chose to save it in. I only wish this were the problem in Firefox v. 30, but that is worse now.
-
Integrating php page into HTML page
Hello,
I am rebuilding a website for a car club as a favor.
Completely pro bona. They have a phpbb forum, and they feel that
the reason for their demise as a club has been just that...the
forum. Their website became just another forum. My job is to make
the site more interactive and give their members more incentive to
visit the site more frequently, as well as make the site self
sufficient (that is, not requiring a yearly donation from members
to make ends meet). I want to integrate the forum into the rest of
the site. I noticed that the forum uses a MySQL database. I want to
use that database as a reference for login to other parts of the
site. The site as it is right now is
www.negmsc.com/index_template.html .
When you click on forum, I want it to open the forum in that
same window while leaving the sidebar on the right and left side's
in tact, without using frames. How is this done?phpBB 2 is a little more difficult, but it shouldn't be too
bad. Just open the overall_header and overall_footer files from the
Templates/SubSilver (the default template) folder. You will need to
use DW to edit these files and they won't appear as normally
formatted html files so you won't see any colors on your tags. Just
make sure the tags in the header match the footer.
You may also want to let your party know that phpBB version 3
is a major step up, and easier to maintain with a nicer admin
interface. Although it is a beta right now it should be a final
release by year's end or early January seeing the current
development and they may want to consider upgrading at that
time. -
Forbiding rendering html and body elements within jsf page
Hi, I have noticed rendered JSF page always starts and ends with elements
<html> <body>
my content
</body> </html>
but I need page that contains only "my content" for inserting into live html document
It can be this automatic elements rendering disabled??f:subview instead of f:view did no changes. output is also closed with standards elements:
<html><head><title></title></head><body>CONTENT</body></html>
but I need in output only "CONTENT" without "body" and so -
i need to convert a JSF Page into a PDF Document .
any ideas how to do that?SACHINLINUX wrote:
BalusC wrote:
Why are you hijacking other's topic and acting like you're the topic starter? You're rude.Mr Balu. kindly tell the solution if you have instead of dictating rules. As far as rudeness concern i never seen a person rude like you.
Sachin KokchaMr Sachin Mr. BalusC is tellign right thing it is not your topic as well as you are telling that you have only one login name. So no need to act like the topic starter.
Every forum has it's own rules so please kindly obey these rules.
Gantu -
I'm trying to create an e-mail newsletter for a small home business and I was wondering if it's possible to convert a document I made in pages into html?
This question was asked and responded several times.
I don't know Apple's plans and, if I was aware of them, it would be under Non Disclosure Agreement so I would not write about them here.
The code exporting to HTML in Pages '06 gave so poor result that it was a good idea to drop it and, from my point of view, it's a bad idea to ask to a Word Processor program to generate HTML code. It would be more efficient to use dedicated tools for this task.
Yvan KOENIG (from FRANCE mardi 30 septembre 2008 14:04:37)
Maybe you are looking for
-
Problem with calling on some numbers
Hi my mum has problem with calling on my number. She is in the USA and has a lof of money on her Skype account. When she was in Poland (country when I am now) she could without any troubles calling on my number. What is wird now in the USA she can ca
-
How to extend the extractor 0FC_BP_ITEMS?
Hi everybody, Has anyone any information about extend the extractor 0FC_BP_ITEMS? Does it run with a tipical user exit? Thanks and regards! MML
-
Down Payment to Vendors - Document parking
Dear All, Is it possible to park vendor down payment in SAP using F-65? Our requirement is that an employee has made down payment to vendor from his imprest. Now I want to credit his imprest and debit vendor with Spl. GL indicator. I need this docume
-
Hi, I am trying to archive files from a SharePoint 2010 document library by moving them to another library that's a dedicated archive/folder/library. The files to be moved are selected based on their modified date column value that should range betwe
-
What is disk utility for?
what is the function of disk utility under application? can someone tell me how to use it?