Facelets & JSP in JSF 2.0

Dear all
i migrated my ADF / JSF (*.jspx) Application using JDeveloper 11.1.2 , but when i am trying to create new page, i found two types *(Facelets & JSP Xml).*
and in oracle doc , future in using Facelets.
i have a project now with all screens in jspx, my question now : how to migrate my Jspx to to Facelets screens (Jsf) ?
thanks

There is possibly a two part solution to this:
1. Make facelets recognize jspx as a valid facelet extension. This is done by adding the following in web.xml
<context-param>
<param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
<param-value>*.jspx;*.jsf;*.xhtml</param-value>
</context-param>
2. Add the required facelets libraries. Jdeveloper ships with "JSF Core 2.0" and "JSF Compatibilty Tags for Facelets". These
facelets libraries need to be added to the project.
3. faces-config.xml version has to be 2.0.
If you are also using ADF, then the following should be added to web.xml as well:
<context-param>
<param-name>javax.faces.FACELETS_SKIP_XML_INSTRUCTIONS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_DECORATORS</param-name>
<param-value>oracle.adfinternal.view.faces.facelets.rich.AdfTagDecorator</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_RESOURCE_RESOLVER</param-name>
<param-value>oracle.adfinternal.view.faces.facelets.rich.AdfFaceletsResourceResolver</param-value>
</context-param>
You could give this a shot. Credits to Mark Romano for telling me this.

Similar Messages

  • Difference between JSP and JSF

    What is the difference between JSP and JSF?
    Is it necessary to learn JSP before starting with JSF?

    JSP is a view technology providing a template to write plain HTML/CSS/JS in. JSP supports Java based taglibs to generate output and/or control the page flow dynamically. A well known example is JSTL. JSP also supports access to backend data with help of EL (Expression Language).
    JSF is a component based MVC framework which provides taglibs for use in JSP, the JSF core tags in <f:xxx> and the JSF HTML tags in <h:xxx>. Those tags generate HTML output and are tied to JSF component tree in the server memory so that the FacesServlet can work on them to gather request parameters, validate/convert them, update the model values (javabean properties), invoke some actions (javabean action methods) and render the response.
    You can use JSF on top of either JSP or Facelets. Facelets is another view technology. JSP is ancient and has its shortcomings when JSF comes into picture. Facelets is designed with JSF in mind and much more well-suited for it and provides great templating/composition capabilities to reuse specific groups of components without the need to wrap them in another custom component (so that you don't duplicate the same code over and over, e.g. label+input+message.

  • What's the difference between jsp and jsf?

    who can tell me what's the difference between jsp and jsf?
    I'm puzzled when I found some of the technology in jsp is so similar to the ones in jsp( javaserver page)

    Hi,
    Find the difference between JSP and JSF
    1. A developer has more control with JSP, but (should) get easier development with JSF
    2. Event handling is done differently in JSP (HTTP) and JSF (Java)
    3. The UI is designed differently (or should be at least) with JSP (markup) and JSF (components).
    4. The end product should also be defined differently - JSP page versus a JSF application.
    Is this the only thing that is need to make a decision for either or? Probably not. There are other pieces that need to be taken in account when deciding which technology to use - tools support, enough components, type of application etc.... At this point there are not enough JSF components (although there are some interesting projects underway - Ajaxfaces, Myfaces, ADF Faces, and WebChart 3d) and enterprise tools support is still limited to a few tools vendor. Looking at our ADF Faces components they are currently available as early access (not production) and demands for these components are stacking up, literally, outside my office doorstep. Although I would love to make them production - now! - it is not a viable solution since we are still checking features and fixing critical bugs.
    All this combined - not enough enterprise level components in production, lacking tools support etc... - leave customers in a vacuum where the decision is either to continue with JSP, since it is mature and has a wide developer base, or move forward with JSF not sure if the support, or the developers will be there. This is particularly sensitive to customers that need to get started now and be production by summer.
    If you are in this vacuum here are some key points promoting JSF:
    1. Fundamental unit is the Component
    2. Built in event and state management
    3. Component sets can be provided by any vendor
    4. Closer to ASP.Net or Swing development
    5. Choice of UI technology
    6. Scale up (rich clients)
    7. Scale down (mobile devices)
    8. Built into J2EE containers in J2EE 5.0 (tentative)

  • How to use javafx in web page written in jsp or jsf

    Hello
    How can we include our demo of javafx, that come with netbeans IDE , into my web page in JSP or JSF.
    Regards
    Rajnish Chauhan

    You just have to add it like and applet , including this line in your JSP or JSF
    <script src="http://dl.javafx.com/dtfx.js"></script>Then add the applet
    <script>
        javafx(
                  archive: "./resources/jar/Draw.jar",
                  width: 400,
                  height: 200,
                  code: "Draw",
                  name: "Draw"
    </script>./resources/jar/Draw.jar - is the path and the name of the jar

  • Jsf 1s phase of life cycle how knows ths components of the jsp with jsf tag

    i wish to know how faces servlet knows the jsp s view components while creaTI NG component tree at first request to input jsp which may have jsf tags.in the first phase faces servlet doesnot know input jsp with jsf tags what componnets it has. it is actually atthe response send or forward time which is the final phase when the tag ge executed and output is sent to client.i did understandin jsf life cycle in 1 st phase component tree is created at first request in 1 st phase .

    Hi,
    though a FacesContext holds the values used by a request, it doesn't mean it lives for as long as the request. The best explanation I found is from the JavaDocs
    release
    public abstract void release()
    +Release any resources associated with this FacesContext instance. Faces implementations may choose to pool instances in the associated FacesContextFactory to avoid repeated object creation and garbage collection. After release() is called on a FacesContext instance (until the FacesContext instance has been recycled by the implementation for re-use), calling any other methods will cause an IllegalStateException to be thrown.+
    The implementation must call setCurrentInstance(javax.faces.context.FacesContext) passing null to remove the association between this thread and this dead FacesContext instance.
    Throws:
    java.lang.IllegalStateException - if this method is called after this instance has been released
    Frank

  • Converting JSP to JSF

    Hi,
    I am new to JSF.
    Could someone suggest how to convert existing JSP project to JSF and Tiles ?
    TIA,
    Oleg.

    Yes, we do have to convert.
    We wrote a pilot of project using JSP [with some YUI and JQuery widgets]
    and then learned that client wants JSF (have a bunch of other JSF projects),
    so now I have a week or so to convert it. [I personally would use Flex for the GUI] ;-)
    Is there a way to wrap up JSP into JSF ?
    I guess, we also need to move some HTML/JSP widgets into JSF components.
    Please advise,
    Oleg.

  • Converting Applet to JSP or JSF

    Hello All,
    I have a web application with Applet and Corba. It is rather old so I
    want to migrate my Applets to a modern web application, with JSP or
    JSF.
    However number of applets is very huge. So I am looking a way to
    convert my Applet to JSF/JSP etc. automatically.
    Is there anyway to do that?
    Thanks,
    aduran

    Hello cotton.m,
    Thanks for the answer. You are right. But at least, is there any way to convert GUI (awt to JSP/JSF etc.) from applet to HTML look, without business logic or any other stuff.

  • Jsp to jsf

    I have a login page tht is straight jsp (not jsf) because we are using j_security_check, which won't work with jsf. Once the user logs in, if they have a special parameter , they should go to a jsf page, that when displayed invokes some logic to check this special parameter and possibly update a database, or forward to a profile page. How do I invoke logic when the page renders, without having to press a submit button on this jsf page?
    Thanks

    Ok, I have this on my jsp page:
    <f:subview id="show" rendered="#{Coupons.showCoupons}">And this in my backing bean:
    public String showCoupons() {
              String returnValue = null;
         //       check the parameter set in the session by the pure JSP
         //       j_security_check page. Do something if it's set.
              System.out.println("inside showCoupons");
              if (!Customer.getOptStatus().equals("DBLO")) {
                   returnValue = "success";               
              } else {
                   returnValue = "profile";
              return returnValue;
    [.code]
    When I load the page, I am not getting the "inside showCoupons" printed in my logs, so this is not getting invoked on page load.   How can I get this invoked on page load?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Using facelets in existing JSF 1.2/JSP project?

    Our current project consists of a lost of JSPs, some of which serve as place holders for other jsps which have been designed as subviews to be dropped into the holding jsps as required. In a lot of cases several JSPs differ in only one of the subview jsps which they display. So I see us having lots of Facelet templates. My question is, will every JSP need to be reworked in order to be able to work with Facelets? ie, an existing JSP which is just a subview and must be included in a holding JSP to be displayed, will this need to be modified much?

    To be more exact, the problem could be custom and spring specific tag libraries instead of static includes. Even weblogic.appc is able to do the job, it would be useful when somebody could explain exact differences  (validations for example) between weblogic.appc and appc goal of weblogic 12.1.2 maven plugin. We would like to use maven plugin.
    -mvk

  • Problem with index.jsp and JSF

    hi all
    I have an index page "index.jsp" in the root directory of deployed project and in that page there is just a <jsp:forward> tag:
    <jsp:forward page="pages/mainPage.jsf" />I am using facelets and I have a template.xhtml
    when I run the browser nothing will be desplayed. by looking at Tomcat console, it seems that it renders the template.xml. if I place the path of the page directly in the address bar of browser, everything is OK
    http://localhost:8080/myproject/pages/mainPage.jsf
    but if I put following, it doesnt work.
    http://localhost:8080/myproject/
    I set the welcome-page to index.jsp in web.xml, and my pages are located in a directory namely "pages"
    any help will be appreciated.
    regards
    Mohammad

    I'm not sure what the problem is exactly. This topic might help though:
    http://forum.java.sun.com/thread.jspa?threadID=696586
    Be sure to read right to the bottom. You may be able to try a couple other things.
    Hope this helps,
    CowKing

  • Can a Servlet be used for Storing Objects with both JSP and JSF used on it?

    Hi,
    Pages I have:
    SearchEmployee.jsp
    This page has a search engine that search out the Employee. This Employee Object will be stored inside a Servlet(controller) for future references by other pages. I used JSP, html tags for forms, and request.getParameter() to built this search engine.
    Problem:
    I have a JSF Form that wants to DISPLAY the employee which I have found in my Search Engine. How can I get the JSF's value="#{Controller.employeeObj.name}" to get the value from the object?
    This seems logical as my JSF form is just retrieving the stored object in the Controller. I currently cant seem to output it

    The servlet shouldn't be used to store ANY data, let alone data to be accessed by other sevlets. Put the object into the Session object.

  • What is the role of JSP in jsf

    hi..i am learning jsf now..ofteni use jsp files to dipslay out put or process the tags..really want to know what is the role of jsp here

    http://www.javaworld.com/javaworld/jw-12-2004/jw-1213-jsf.html

  • Comparing JSP and JSF, which 1 better?

    Currently i need to run a new project. Now i need to choosing 1 of the language to coding my project. Which 1 is better to use?
    In this project i have to include the web page that using JSP scriptlet to code because this project is create a dynamic menu to link up all web application. Is the JSF can link to JSP and JSP can link back to JSF?

    Welcome to SCN.
    Please read forum rules (you'll see that you must search the forum first (your question is already answered))

  • JSp or JSF Unrecognized Content Type.

    I have a simple JSF application that simply creates a panelGrid dynamically based on an input field I supply stating how many grids to render. The initial page loads up fine but when I click on either of the buttons to exit or submit the request to render the grid I get the following exception::
    javax.faces.FacesException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Unrecognized Content Type.
         at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:327)
         at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
         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:110)
    Here is a copy of my faces-config.xml
    <?xml version="1.0"?>
    <!DOCTYPE faces-config PUBLIC
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
    "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
    <faces-config>
    <managed-bean>
    <description>The one and only HelloBean.</description>
    <managed-bean-name>helloBean</managed-bean-name>
    <managed-bean-class>com.cvs.corp.demoapp.presentation.bean.HelloBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    <navigation-rule>
    <description>Navigation from the hello page.</description>
    <from-view-id>/faces/hello.jsp</from-view-id>
    <navigation-case>
    <from-outcome>success</from-outcome>
    <to-view-id>/faces/goodbye.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    </faces-config>
    The interesting thing is that when I click the back button and refresh the page it properly displays the panel with the render fields! This seem like it may be a stupid mistake but any info would be much appreciated... I am going crazy...
    Here are the JSPs and the managed bean as well...
    * Created on Jul 7, 2005
    * TODO To change the template for this generated file go to
    * Window - Preferences - Java - Code Style - Code Templates
    package com.cvs.corp.demoapp.presentation.bean;
    import java.util.List;
    import javax.faces.application.Application;
    import javax.faces.component.html.HtmlOutputText;
    import javax.faces.component.html.HtmlPanelGrid;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ActionEvent;
    * @author ksbober
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    public class HelloBean {
    private int numControls;
    private HtmlPanelGrid controlPanel;
    public HtmlPanelGrid getControlPanel() {
    return controlPanel;
    public void setControlPanel(HtmlPanelGrid controlPanel) {
    this.controlPanel = controlPanel;
    public int getNumControls() {
    return numControls;
    public void setNumControls(int numControls) {
    this.numControls = numControls;
    public void addControls(ActionEvent actionEvent) {
    System.out.println("Am I in here??");
    Application application = FacesContext.getCurrentInstance().getApplication();
    List children = controlPanel.getChildren();
    children.clear();
    for(int count = 0; count < numControls; count++) {
    HtmlOutputText output = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
    output.setValue(" "+count+" ");
    output.setStyle("color: blue");
    children.add(output);
    public String goodbye() {
    System.out.println("How about here??");
    return "success";
    JSPs
    hello.jsp
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD/ HTML 4.01 Transitional//EN">
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" isELIgnored="false" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <f:view>
    <html>
    <head>
         <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
    <title>JSF in Action - Hello World!</title>
    </head>
    <body>
         <h:form id="welcomeForm">
         <h:outputText id="welcomeOutput"
                        value="Welcome to Java Server Faces! You da' man Kyle!!!"
                        style="font-family:Arial,san-serif; font-size:24; color:green;" />
              <p>
              <h:message id="errors" for="helloInput" style="color:red;" />
              </p>
              <p>
              <h:outputLabel for="helloInput">
                   <h:outputText id="helloInputLabel"
                                  value="Enter number of controls to display:" />
              </h:outputLabel>
              <h:inputText id="helloInput"
                             value="#{helloBean.numControls}"
                             required="true">
                   <f:validateLongRange minimum="1" maximum="500" />
              </h:inputText>
              </p>
              <p>
              <h:panelGrid id="controlPanel"
                             binding="#{helloBean.controlPanel}"
                             columns="20"
                             border="1"
                             cellspacing="0" />
              </p>
              <h:commandButton id="redisplayCommand"
                                  type="submit"
                                  value="Redisplay"
                                  actionListener="#{helloBean.addControls}" />
              <h:commandButton id="goodbyeCommand"
                                  type="submit"
                                  value="Goodbye"
                                  action="#{helloBean.goodbye}"
                                  immediate="true" />
    </h:form>
    </body>
    </html>
    </f:view>
    goodbye.jsp
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD/ HTML 4.01 Transitional//EN">
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" isELIgnored="false" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
    <title>JSF in Action - Hello World!</title>
    </head>
    <body>
    sdhfjsdhf
         <f:view><%--
         <h:form id="goodbyeForm">
              <p>
              <h:outputText id="welcomeOutput"
                                  value="GoodBye!"
                                  style="font-family:Arial,sans-serif; font-size:24; font-style:bold; color:green;" />
              </p>
              <p>
              <h:outputText id="helloBeanOutputLabel"
                                  value="Number of controls displayed:" />
              <h:outputText id="helloBeanOutput"
                                  value="#{helloBean.numControls}" />
              </p>
         </h:form>
         --%>
         </f:view>
         </body>
    </html>

    Agreed. JSPX is a well-formed version of a JSP file (i.e. an XML version of JSP). Thus, it is easy to produce pages that adhere to strict XHTML standards. A couple of things that you will need to do in JSPX files is escape ampersands and close script tags with a complete tag closure rather than the customary shortcut.
    --RiC                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to populate data before displaying jsp in JSF ?

    I have the following situation :
    In my app, i have a couple of left-navigation menus, when i click on one of them, i need to show some history data. So, i first need to call a managed bean on click of the link, fetch data and forward to history jsp page.
    How do call the managed bean directly (like struts action page) before going to JSP first ? Whenever i give a link to "something.faces", it goes to the jsp directly ?

    There are two solutions on my mind. The first is to use the Shale ViewController where you got prerender() method and in it you could fetch the data. The second solution is to fetch the data in the getter method of your property but remember that the getter method could be invoked more than once per request so putting expencive code in it could be dangerous. Use singleton instance of the fetched property, something like:
    getMyProperty() {
    if (myProperty == null) {
    .... fetch the data
    return myProperty;
    }

Maybe you are looking for

  • Adding data to array from an empty query

    I am trying to add data to an array from a database query, however some queries will return no data (empty set). In that case I would like to add fake data so that the index size matches my other array (assetsid). Thank you for your time.      int f2

  • Page break in Matrix report

    Hello Experts, I am trying to create a custom purchase order that shows shipping distributions. I have been successful so far in creating a matrix report that shows this. However, the client's requirement is that I limit the items to at least 10 item

  • HP Enterprise - Use Cloud-based HP Online Help to Troubleshoot Printing

    HP LaserJet Enterprise printers and HP Officejet Enterprise printers have cloud-based Online Help available to troubleshoot printing issues. HP Online Help users can scan a QR code on the printer display using a mobile phone or tablet, or click an er

  • Adding New Map ID

    I've noticed that since I've upgraded from robohelp 5x to version 7. The "Add New Map ID" button isn't available. It's visible but grayed out. Is this a bug? Has anyone else experienced this problem? I can't find anything on it in the adobe knowledge

  • Avoid using folders in Edge Animate when creating a banner

    Hi there, I have a problem. I have made a banner in Edge Animate that I wan't to send to a newspaper for them to put on their site with them as the host. (Don't think my little private site would be prepared for that kind of traffic if they took it i