• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF in Struts.

 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Not sure wheather to post this question in Struts or JSF forum.

I have a Struts application running in production and i want to include a new functionality to it, we are planning to do the new fucntionality in JSF as we are more into JSF now. I tried to define a JSF page in tiles-defs.xml, but its thorwing exception at runtime

This is my tiles definition.



this is the exception trace.



[ServletException in:/jsfTest.jsp] Cannot find FacesContext' javax.servlet.jsp.JspException: Cannot find FacesContext at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:399) at com.sun.faces.taglib.jsf_core.ViewTag.doStartTag(ViewTag.java:106) at com.ibm._jsp._jsfTest._jspx_meth_f_view_0(_jsfTest.java:102) at com.ibm._jsp._jsfTest._jspService(_jsfTest.java:79) at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:88) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629) at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:117) at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:171) at com.ibm.ws.jsp.webcontainerext.JSPExtensionProcessor.handleRequest(JSPExtensionProcessor.java:230) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:552) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:1034) at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:475) at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137) at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177) at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756) at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881) at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473) at com.ibm._jsp._defaultLayout._jspx_meth_tiles_get_2(_defaultLayout.java:163) at com.ibm._jsp._defaultLayout._jspService(_defaultLayout.java:87) at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:88) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629) at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest



PS :
If i try to run jsfTest.jsp directly, it will run fine. It make me feel like my JSF configuation for the web app is working good..

In the web xml, i set load-on-startup for "javax.faces.webapp.FacesServlet" to 1. so it should have initialized at startup !

Can anyone help me with this ? Im thinking to implement the new funtionality in struts itself. Will it to be good to go with JSF just for one new functionality ? Appretiate any suggestions.

Thanks,
Rajeev
[ October 23, 2006: Message edited by: Rajeev Ravindran ]
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm a consultant and have worked on many projects that I didn't start and won't finish. I learned a long time ago that even if I totally hate the framework the application was built in, it's best to "go with the flow" of the current application. Implementing a single page in a different framework makes nothing but trouble for you and for any other developers trying to maintain this application in the future. Unless you're planning to rewrite the entire applicatoin in JSF, my advice is to just do the page in Struts.
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Merrill Higginson:
Implementing a single page in a different framework makes nothing but trouble for you and for any other developers trying to maintain this application in the future. Unless you're planning to rewrite the entire applicatoin in JSF, my advice is to just do the page in Struts.



+1.

Good point.
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
+1

Thanks for the inputs Merrill and Jason !! Appretiate it.

Rajeev !
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok lets forget my application

Im trying to make it work just to check how JSF works with tiles. I went through few docs but im unable to resolve this issue. I was able to solve "unable to find FacesContext" now im getting this error. Any help ?


[Exception in:/faces/HelloJSF.jsp] Cannot forward. Response already committed. java.lang.IllegalStateException: Cannot forward. Response already committed. at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:114) at com.ibm.faces.context.MultipartExternalContextImpl.dispatch(MultipartExternalContextImpl.java:320) at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:249) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:201) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:118) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:552) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:1034) at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:475) at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137) at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177) at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756) at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881) at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473) at com.ibm._jsp._defaultLayout._jspx_meth_tiles_get_2(_defaultLayout.java:163) at com.ibm._jsp._defaultLayout._jspService(_defaultLayout.java:87) at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:88) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629) at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:117) at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:171) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:250) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069) at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274) at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:254) at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:309) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629) at



Thanks,
Rajeev
 
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://wiki.apache.org/myfaces/Tiles_and_JSF
 
reply
    Bookmark Topic Watch Topic
  • New Topic