JSF And Struts Integration

Can any body give some info on integration of JSF to existing struts application

I describe the main differences between JSF and Struts in this sample Chapter from my JSF book:
http://www.oreilly.com/catalog/jsvrfaces/chapter/ch01.pdf
Hope that helps.

Similar Messages

  • JSF and Struts - differences and integration goal.

    I am a newbie J2EE developer and I am not clear about main differences between JSF and Struts also I saw couple of articles describing integration between JSF and Struts. Could someone give me an explanation, what the main conceptual differences between those technologies and what's the goal of integration both of them?

    I describe the main differences between JSF and Struts in this sample Chapter from my JSF book:
    http://www.oreilly.com/catalog/jsvrfaces/chapter/ch01.pdf
    Hope that helps.

  • JSF and JSTL integration

    Can anyone tell me how to access JSF objects from JSTL tags?
    I want to set a requestScope flag in my changeListener
    ... context.getExternalContext().getRequestMap().put("xxx","ok"); ... and render output depending on existance of this flag:
    ...<c:if test="${requestScope.xxx!=null}" > .... .
    This examplecode doesn't work, JSTL tags cannot access this var! How can I do that?
    What I realy want is to reload another frame when user changed a specific input field.
    Above code should add a JavaScript to reload the frame if this is true .
    I can't do this on submit because the other framepage uses the stored/modified data.
    Maybe there's a better approach for this anyway?
    Thanks for your help!

    Thanks for your help - I found it was my own mistake why it didn't work. Now it does, as you said.
    But in the meentime I ran into another Problem mixing JSTL und JSF:
    I want to build a SelectOneMenu and populate it with data from a database, but with selectItemValue
    other than selectItemLabel (value should be numeric DB-ID, label a readable name).
    Since "selectItems" allows only one dimensional Arrays (?) as parameter, I must use "selectItem" for
    each row. So I wrote following code:
    <h:selectOneMenu id="m1" value="#{worktime.employee}">
       <sql:query var="employees" dataSource="jdbc/WebOfficeDB">
           select oid,displayname from employees order by displayname asc
        </sql:query>
        <c:forEach var="row" items="${employees.rows}" >
           <f:selectItem itemValue="#{row.oid}" itemLabel="#{row.displayname}" />
        </c:forEach>
    </h:selectOneMenu>This doesn't work, I get NullPointer Exceptions from selectItem.setValue().
    I think because JSF "#" references another context than JSTL "$" - is this correct?
    So I tried to set a JSTL variable inside the forEach loop to access the datarow
    <c:set var="data" value="${row}" scope="request"/>
    <f:selectItem itemValue="#{requestScope.data.oid}" itemLabel="#{requestScope.data.displayname}" />
    ...The effect is that all lines of the selectOneMenu have the same content (from the last datarecord)!?
    Since this is my first project in JSTL and JSF and should stay a small one I don't want to go into building
    CustomComponents and so on for such a simple Task.
    I would be very very happy for some tips and hints, since I think this mixing of JSTL and JSF Context
    will be a very common problem within my project.
    Thanks

  • Using JSF and Struts

    I am a bit of a newbie in terms of UI applications on the JEE platform, so I apologize up front if this question seems silly. I was wondering if someone could comment on the approach below. Is this something that's possible or am I barking up the wrong tree?
    We have a vendor application that is written using Struts. We want to add a section of our own pages to this application, but we would rather use a more strategic approach in our pages, so we would like to use JSF for those.
    The original web.xml file in the vendor app uses a dtd of version 2.3 as shown below:
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    When I use JSF, I use a DTD version of 2.5 as shown here:
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    The problem is that when I use version 2.3, the elements needed to support JSF are invalid. When I use 2.5, the elements needed to support struts are invalid.
    Could someone comment in that, if you had this vendor app and you needed to add your own pages, is it not possible to use JSF in this scenario or if you can, what is the best approach to resolving this issue?
    Thank you in advance

    First make sure that your application server supports Servlet API 2.5. Whether the desired Servlet API version is supported or not solely depends on the application server implementation and version used. For example Tomcat 5.5 is a Servlet API 2.4 implementation which only supports the API versions up to with 2.4. If you want to use Servlet API 2.5, then you obviously need a Servlet API 2.5 implementation, for example Tomcat 6.0.
    Consult the website and/or documentation of the application server in question.

  • JSF and Struts

    Why would I still want to use Struts? Doesn't JSF elimintate the need for Struts?
    Can someone please give me the low-down?
    Thanks,
    Michael

    I like Struts a lot and I see it working well with JSF. But I
    am also very impressed with the Tapestry project just brought
    into Jakarta; it seems so much further along than JSF.

  • Unable to use Struts taglib in JSF and Struts-tiles app

    With the taglib correctly defined as follows,
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
    I'm trying to use <link rel="stylesheet" href="<html:rewrite page='/WEB-INF/csslib/layout.css'/>" type="text/css"/> to pull in my stylesheet. But I get an error saying:
    Apr 24, 2007 10:58:31 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    javax.servlet.jsp.JspException: ServletException in '/pages/layout.jsp': null
         at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:921)
         at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:460)
         at org.apache.jsp.pages.runTest_jsp._jspx_meth_tiles_insert_0(runTest_jsp.java:78)
         at org.apache.jsp.pages.runTest_jsp._jspService(runTest_jsp.java:54)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         at org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl.dispatch(JspTilesViewHandlerImpl.java:233)
         at org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl.renderView(JspTilesViewHandlerImpl.java:219)
         at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
         at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
         at org.apache.jsp.index_jsp._jspService(index_jsp.java:49)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Unknown Source)
    If I take out the <html:rewrite> reference, it works like a charm.
    What is the problem here?

    Hi,
    Pls try application-config tag like this
      <application-config>
        <property name="PrivateSharingReference" value="com.sap.portal.htmlb">
        </property>
        <property name="SharingReference" value="com.sap.portal.runtime.application.soap">
        </property>
      </application-config>
    Also check component tag is in this order
    <component name="AddAccounts">
          <component-config>
            <property name="ClassName" value="Test">
            </property>
            <property name="JSP" value="pagelet/test.jsp">
            </property>
          </component-config>
          <component-profile>
            <property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld">
            </property>
          </component-profile>
        </component>
    regards,
    Sujesh

  • JSF - Struts Integration

    Hi,
    At my work place we r trying to integrate JSF and Struts. After doing some research we found out that Struts-Faces is d way we can achieve d same. But d problem is that struts-faces is not available...........
    Wat we need 2 know, are there any other alternatives and from where do we get d struts-faces package.........
    Thanks a lot in advance.

    Change you action from:
    <s:form action="/redirectSelectSite">
    To:
    <s:form action="/redirectSelectSite.do">
    So that your request gets processed by the Srtuts Controller. Assuming you have *.do mapped to your struts controller in web.xml.

  • Using jsf with struts

    hi;
    i am trying to understand the proper architecture when using jsf and struts together.
    i think i understand the differences between the technologies . it seems to me that instead of justifying jsf there should be a focus on how the two technologies actually collaborate.
    specifically, i would like to know or see examples of things like replacing the view portion of struts and plugging in the jsf framework instead or how to i replace the struts actions with jsf commands or maybe they are totally different things.
    where can i get information like this?
    thanks.

    At present, i think the best thing to do is to look at the example provided with the struts-faces integration taglib. I don't know any documentation about it.
    http://cvs.apache.org/builds/jakarta-struts/nightly/struts-faces/

  • JSF or Struts

    Hi,
    We have a web application designed using MVC framework. Besides a web view, we now need to support mobile users using WML.
    We are considering JSF and struts (customising struts to handle WML client).
    I have read that JSF supports disparate clients efficiently using RenderKits.
    Can anyone suggest whether JSF has an easy to use WML RenderKit. How does a renderkit work? Is there any good documentation online?
    Is there a Renderkit for WML readily avaialble or will I have to make one? I know there was a link posted in one of the questions in this forum, but it is a dead link.
    Thanks in advance,
    Harsha

    JSF is better than Sturts. ("Until now there is no sucess story on JSF.")
    Becoz, Struts inventor has been hired by SunMicroSystems to work with JSF. The same guy mentioned in an interview, that struts developement will be stopped in future.
    Also..,
    Until now there is no sucess story on JSF. Only time can decide which is best.
    My suggestion is, better spend your time in learning more jsp and servlets specifications, XML/XSLT, JMS, Webservices rather JSF/Struts.
    All these frameworks like JSF/Sturts will depends on your project requirement. There is a nice book and online document in this website about design patterns. Read those things if you have time. You will get good idea.
    Well.., this is all my personal opinions.

  • JSF versus Struts

    Hi, I'm researching JSF and Struts and they look identical. Seems like the developers of JSF just took Struts and changed the wording. What I mean is:
    struts-config.xml became faces-config.xml
    ActionMappings and Actions became NavigationCases and NavigationRules
    FormBeans became ManagedBeans
    MessageResources became MessageBundle
    ActionServlet became FacesServlet (in web.xml)
    Both have validators and converters.
    So am i missing something?
    Also, are there any performance benchmarks that JSF/Struts add to response times?
    Thanks,
    Mike

    I tried out JSF on some small projects and it worked out OK. However, when I tried using JSF on a major project, I got burned. I ended up converting all my JSF work to Struts.
    Before I say what I didn't like about JSF, let me say what I do like. I like how easy it was to associate a button or a link with a method. I like how easy it is to validate input. I liked how easy it is to show or hide components based on boolean expressions. When it comes to these things, I was able to develop code a bit faster with JSF than with Struts.
    However, the negatives were so great that I eventually abandon JSF...
    (1) If you have a graphic artist that creates prototypes using static HTML, converting those prototypes to actual working pages is MUCH easier with Struts tags than with JSF tags. The problem with JSF tags is that you cannot always mix JSF with standard HTML. This is especially true if you are using Tiles. You may end up having to completely rewrite the static HTML tags to their JSF equivalent. This is simply more trouble than it is worth. (There are JSF tag libraries available that act like standard HTML tags, but I found the tags to be buggy and the code simply very cluttered.)
    (2) Creating tables much more complicated that a textbook example can end up being more trouble than it's worth. For example, if you want to create a table where some rows are sub-headers (rows that span all columns and contain a sub-title), then you will end up having to create a custom renderer and a custom tag library. There is a learning curve involved with this. (Even if you are an expert in writing these, you still have extra code that needs to be written.) With Struts, the same thing can be accomplished with some simple logic tags.
    (3) Sometimes, all I really wanted was to iterate through a list of values. JSF does not come with a simple iterate tag. You can loop through your data with a JSTL tag or you can use a datatable or you can create your own tags, but that is extra work. Even if you choose to do any of these, you still cannot reliably mix standard HTML tags with JSF tags.
    (4) Everything in JSF is submitted as a POST. Sometimes, I really needed to use a GET. You can use GETs in JSF, but I found using them to be less than straightforward.
    My advise: If you are building a web app, use a framework that plays well with HTML. (Ultimately, your web app is generating HTML anyway.) If you are building a stand-alone app, use Swing or some language other than Java. If you need your code to run as both, then JSF might be a solution.
    I really wanted JSF to work for me, but I ended up being disappointed.

  • JSF vs Struts article on Websphere Journel

    This article lists some of the common areas between JSF and Struts and shows the pros and cons of each technology in each area.
    http://www.sys-con.com/story/?storyid=46516
    Ed (JSR-252 Spec co-lead)

    Hmm I can't access that :(
    I liked Craig's blog post about the both tecnologies, I think that everyone should read that.
    http://blogs.sun.com/roller/page/craigmcc/20040927#struts_or_jsf_struts_and

  • JSF Tiles and Struts ActionForward

    Hi All
    I would like to use Tiles with my JSF application.
    In order to get the best from Tiles i would like to use definitions.
    the problem that most of the power of Tiles and definitions is coming from the use of ActionForward.
    Does any one now how i can implement ActionForward with struts definition name in the Navigation in JSF.
    I understand that i need to hack the Navigation model and get the Tiles bean from the Tiles using the outcome value.
    Then i know that i need some how to get the tree that generates and forward it to the JSF or somthing like this.
    Does any one have an idea how to do it???
    Thanks
    Noam

    hi,
    in MyFaces there is an example using JSF and Tiles.
    MyFaces provides a custom ViewHandler faciltity.
    see http://sourceforge.net/projects/myfaces
    hope that helps.
    Regards,
    Matthias

  • Managing blob images using ADF and JSF or struts

    Hello everyone. I am an ADF newbe and I am developing a web app. that has to manage (display, insert,update and delete) blob images from/to an oracle DB. I've seen the "howto" on image managing using intermedia and struts, but, for this new app I wanted to use JSF (something that is not mandatory) and, what is important is that the DB has already stored the images in blob format.
    Can anybody point me in the right direction please??? Is there any howtos on this subject???
    Thanks in advance.

    jfin wrote:
    but so far I have to say that I like the fact that I'll have to do very little
    System.out.println(<..../>....<>....</>).Assuming that you rather mean out.println() where out is the ServletOutputStream reference returned by HttpServletResponse#getOutputStream(), I can only agree with you. That's certainly not the way how JSP/Servlet code is to be written. The maintainability, extendability, reusability and testability would be far below the freezing point then. You need to write presentation logic in JSP files, not in Servlets and absolutely not in scriptlets inside a JSP.
    When you need to write presentation logic which may change per request, use JSTL and EL for that. Again, not scriptlets. For business and controlling logic, use Servlets. For transfer of data, use javabeans (DTO's, VO's). For data access logic, use DAO classes which are to be interacted by servlets.
    JSF removes the need for creating Servlets and using JSTL/EL in JSP files. You just have JSP pages with JSF tags for presentation and javabeans for the request values and backing beans for business logic.
    When would one use JSF over the other two? When Struts2? When Shale?And you ask that in a JSF forum? At least my opinion is predictable :)

  • JSF vs  Struts  And  Best O/R mapping  tech.

    I want to start working again after 3+ years gap from 2003 to 2007.Earlier for 4 years I have worked on web/enterprise applications and technical platform was JSP1.2,SERVLET 2.x,Oracle's xsql servlet,JDBC ,Struts1.0/1.1,statleless Session Bean ,Web Service generated by BEA WEBLogic server 8.1,jdk1.3.
    I've been looking through too many documents and forums, there are so many choices now .Could you please suggest which of the following should I learn to update my skills :
    1.JSF OR Struts 1.2,1.3 OR Struts2 ( There are no books for Struts 2)
    2.Hibernate OR EJB3 OR Torque OR TopLink
    3. jdk 1.4 OR java 5
    Can you help me to findout documentation and tutorials to learn these .
    Thanks

    You're wanting to get back into writing web applications?
    Web services?
    1 - If you worked with struts before, I'd probably continue with that line. Or at least start there.
    2 - I'd say Hibernate, but then I don't know that much about the others ;-)
    3 - Java1.5.
    I would also recommend you catch up with the changes between JSP1.2 and JSP2.0, particularly regarding JSTL and EL.
    For learning JSTL, you can't past go the JSTL spec. It is quite readable, and an excellent reference. http://java.sun.com/products/jsp/jstl/reference/api/index.html

  • Steps of Integrating JSF with struts

    Can anybody tell me the steps of intrgrate JSF with Struts
    Regds
    Amit Verma

    It's a better idea to upgrade your memory amount up to at least 1GB.

Maybe you are looking for

  • Unsure of proper configuration for SF300-24 & router

    Hello, Our company lost a switch and replaced it with a SF300-24.  The other components are a Westell modem and an Amped Wireless R10000G router. The current configuration has the Westell DLS modem going into the R10000G router, the router is the DHC

  • JAXB 2.1 w/JDK 6 Error. bootstrap classloader issue.

    When I run one of my JUnit tests, I get this error: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/usr/local/netbeans-6.0/java1/modules/ext/jaxws21/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.c

  • CIC-WEB CLIENT & WIN CLIENT

    Hi, Please tell me the 1.Difference between WEB CLIENT & WIN CLIENT 2.What are the advanatges/drawbacks of each. 3.If we have to implement what is the Prerequiste for both. Regards, Natasha P

  • Question on Calendar

    Hi Experts, I have created WD screen. It uses Calendar UI element and displays 4 months calendar (Current month and next three months). For example if I will run program today, it will display calendar of  Aug 2009, Sep 2009, Oct 2009 and Dec 2009. I

  • Js link for sharepoint xslt dataview :

    Hi, I am using js links for changing a field into anchor type in my list. This is working fine. But when i drop that list data view into a xslt data view to display my js link does not fire. Please let me know if i can also attach my js link with xsl