Including jsf pages

Hi,
I am trying to write a small jsf app. I am tyring to modularize it and having problems with <jsp:include..>. When I include a page with a jsf fragment it fails to render anything. Am I doing something wrong?
Thanks
BJ

The sample applications at
http://www.crossbar.info/
contain working examples of the use of
<%@ include file="whatever.jsf" %>
to build modularized pages that avoid duplicationof
code. Right, it may work fine for some simple cases. All I
meant was that the behavior is not really specified,
and there are therefore a number of cases where it
doesn't work at all. It's on the list of things the EG
will look into.Doh! You're using static includes. I read it as if you were saying that you got dynamic includes to work.

Similar Messages

  • How to include taglib in a JSF page?

    Hi,
    How can I include a taglib in a JSF page? I tried the following:
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>but I get an error as:
    Invalid character used in text string ( <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> ).
    Please help!!
    Thanks.

    Hello Prasant,
    I think page fragments is what your after, one of the Sun guys did a good blog on page layout with jspf but i can't access the weblogs, but you could try this tutorial in the meantime:
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/pagefragments.html
    Then search the weblogs when its available. i hope this helps
    Cheers
    Gaz

  • HTML result gets truncated after including of the JSF page

    Hi there,
    I'm trying to create a page that will include dynamically content of JSF pages from another web application.
    Thus, there is a web application (Pages) that is deployed under web context: /test-pages and another web application (Faces) that is deployed under web context: /test-faces.
    The source code of /test-pages/IndexPage.jsp
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
    <title>
    IndexPage
    </title>
    </head>
    <body>
    <h3>Page Start</h3>
    <jsp:include page="header.jsp"/>
    <br>
    <h1>Index Page of the test-pages application</h1>
    <br>
    <jsp:include page="footer.jsp"/>
    </body>
    </html>
    The source code of /test-pages/header.jsp
    <%
    ServletContext servletContext = request.getSession().getServletContext().getContext("/test-faces");
    RequestDispatcher reqDispatcher = servletContext.getRequestDispatcher("/faces/header.jsp");
    reqDispatcher.include(request, response);
    %>
    The source code of /test-pages/footer.jsp
    <h2>Simple Footer</h2>
    The source code of /test-faces/header.jsp
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <f:subview id="myID">
         <f:verbatim>
              <h2>Faces Header</h2>
         </f:verbatim>
    </f:subview>
    The HTML execution result (http://localhost:7001/test-pages/IndexPage.jsp):
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
    <title>
    IndexPage
    </title>
    </head>
    <body>
    <h3>Page Start</h3>
         <h2>Faces Header</h2>
    Could you help me understand, why the result gets truncated after including of the JSF page.
    Thanks,
    Sasha

    Thanks you for reply!
    Unfortunately, still no luck!
    Any other ideas will be highly appreciated!

  • Including a JSP page into a JSF page

    Hi !!
    I have read some posts here about <f:subwview>. There says to use:
    <f:subview>
       <jsp:include page="somepage.jsp"/>
    </f:subview>But it does not work.
    How can i include a jsp page into a JSF page?
    Thanks !!!

    Hi,
    Replace <jsp:include page="somepage.jsp">
    with <%@ include file="datasetView.jspf" %>
    See thread: http://forum.java.sun.com/thread.jspa?messageID=3413354&#3413354

  • How to include jsp page in jsf ???

    Hi,
    I use JDeveloper 11g and the framework ADF. I want to include a jsp page in another page ( jsf page).
    In fact, I do this :
    <f:view>
    *<jsp:include page="/Menu/MenuGlobalDynamique.jsp"/>*
    </f:view>
    when i run my jsf page nothing is displayed and i have this error :
    javax.servlet.ServletException: Erreur OracleJSP :
    oracle.jsp.parse.JavaCodeException: Ligne n° 19, oracle.jsp.parse.JspParseTagDeclaration@cf767d <br>Erreur : Java code in jsp source files is not allowed in ojsp.next mode.
         at oracle.jsp.runtimev2.JspReportUtil.reportException(JspReportUtil.java:180)
         at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:692)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:722)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:646)
    Have you an idea to help me and resolve my problem.
    Thank you.

    Hi,
    Can you post the source of the MenuGlobalDynamique.jsp page?
    if MenuGlobalDynamique.jsp is a JSF page and you want to include it into other JSF page you must mark out (or delete) this parts from the MenuGlobalDynamique.jsp like here:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:af="http://xmlns.oracle.com/adf/faces"
              xmlns:afh="http://xmlns.oracle.com/adf/faces/html">
      <jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
                  doctype-system="http://www.w3.org/TR/html4/loose.dtd"
                  doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <!--
      <f:view>
        <afh:html>
          <afh:head title="impForm">
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
          </afh:head>
          <afh:body>
            <af:messages/>
            <af:form>
    -->
    <!--
            </af:form>
          </afh:body>
        </afh:html>
      </f:view>
    -->
    </jsp:root>regards,
    Branislav

  • Include jsp/jsf code in a jsf page at runtime

    Hello,
    I have a problem. I must get data from a Firebird db. The data is posted in jsp/jsf
    code. I've tried to get them through a servlet. The problem is that when I include
    result in my jsf page, the code doesn't get compiled.
    If I include code with a <h:outputText> or a jsp action <jsp:include> or a <c:import
    url> the code doesn't get compiled. If I include code with directive <%include> it is
    translated correctly, but include directive accepts only physical files.
    Any suggestion?
    Thanks

    Hello,
    I have a problem. I must get data from a Firebird db. The data is posted in jsp/jsf
    code. I've tried to get them through a servlet. The problem is that when I include
    result in my jsf page, the code doesn't get compiled.
    If I include code with a <h:outputText> or a jsp action <jsp:include> or a <c:import
    url> the code doesn't get compiled. If I include code with directive <%include> it is
    translated correctly, but include directive accepts only physical files.
    Any suggestion?
    Thanks

  • 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.

  • How to add fragment in jsf page using include tag in jdeveloper

    Hi all
    Can you tell me wat is syntax of using include tag .or how to add fragment in jsf page ..
    Edited by: 947228 on Jul 18, 2012 5:01 AM

    Hi,
    Why do you want to do that?
    Check [url https://blogs.oracle.com/jheadstart/entry/avoid_use_of_jspinclude_where]this out before proceeding further.
    Btw, always mention your JDev version, clear usecase to get help.
    -Arun

  • How to Use another JSF page that I load by XMLHttpRequest?

    Hi everyone, I'm a newbie of JSF and curisous about how to load page content seperately by AJAX.
    I saw example of Java Blue Print. It's load some data to use in page. What I want is to load another JSF page when click a link or button, (Like include another page). And work with functions privoided by loaded JSF Page.
    My example is, In a main page. I request a JSF page and set it into a div layer.
    var requestURL = "/admin/customer/customer-list-body.faces";
    var content = postDataWithoutContent(requestURL);     divContent.innerHTML = content;     
    All JSF components are required under <f:view>, thus action of form is set as "action='"/admin/customer/customer-list-body.faces'"
    But my page is main.jsp. Each time I click command button in customer-list-body.faces, the url will change to customer-list-body.faces, I want to request and hold in main.jsp.
    What can I do then? Any advices?

    Hi,
    the list doesn't seem to be your problem. You need to track down the illegal argument exception. Once you have that sorted out, expose the method on the AM so it gets shown as a method binding. The return values then could be picked up in a managed bean to create the select Item list
    Frank

  • Problem in using MySQL in JSF Pages

    Hi,
    I am facing a problem regarding use of MySQL in JSF.
    I am using IBM RAD 6.0 for application developement.
    Previously creating a normal java application which is used of retrieval of the data from the database was working fine. by including j/connector jar file in java build path.
    But when same program is converted to web service and accessed through a JSF page using a managed bean it is not working. It throws classNotFoundException
    Please reply at your earliest.
    Thanks in advance.
    Regards,
    Amit
    code :-
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class BeanClass
         public String display()
              Connection conn = null;
              Statement stmt = null;
              ResultSet rs = null;
              String returnDate = "";
              try
                   Class.forName("com.mysql.jdbc.Driver").newInstance();
                   System.out.println("Sucess");
                   conn=DriverManager.getConnection("jdbc:mysql://localhost/switching","root","pspl");
                   System.out.println("Sucess******");
                   stmt = conn.createStatement();
                   System.out.println("Sucess^^^^^^^^^");
                   rs = stmt.executeQuery("SELECT * FROM log1 where senderId = '008' ");
                   System.out.println("Sucess#########");
                   while(rs.next())
                        System.out.println("Date : " + rs.getString("expDate"));
                        returnDate = rs.getString("expDate");
                   System.out.println("Final success");     
                   System.out.println("Sucess@@@@@@@@@@@@@@@@");
              }catch(ClassNotFoundException cnfe)
                   System.err.println("Drivers not found " + cnfe.toString());
                   cnfe.printStackTrace();
              catch(IllegalAccessException iae)
                   System.err.println("Access Exception");
              catch(InstantiationException ie)
                   System.err.println("Instatiation Exception");
              catch(SQLException se)
                   System.err.println("SQL EXCEPTION");
                   se.printStackTrace();
              System.out.println("Date is = " + returnDate);
              return returnDate;
    Errors are :-
    [5/3/06 10:47:33:358 IST] 00000061 SystemErr R java.lang.ClassNotFoundException: com.mysql.jdbc.Driver     at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java(Compiled Code))
         at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java(Compiled Code))
         at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
         at java.lang.Class.forName1(Native Method)
         at java.lang.Class.forName(Class.java(Compiled Code))
         at packBean.BeanClass.display(BeanClass.java:29)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
         at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
         at com.ibm.ws.webservices.engine.dispatchers.java.JavaDispatcher.invokeMethod(JavaDispatcher.java:178)
         at com.ibm.ws.webservices.engine.dispatchers.java.JavaDispatcher.invokeOperation(JavaDispatcher.java:141)
         at com.ibm.ws.webservices.engine.dispatchers.SoapRPCProcessor.processRequestResponse(SoapRPCProcessor.java:423)
         at com.ibm.ws.webservices.engine.dispatchers.SoapRPCProcessor.processMessage(SoapRPCProcessor.java:388)
         at com.ibm.ws.webservices.engine.dispatchers.BasicDispatcher.processMessage(BasicDispatcher.java:134)
         at com.ibm.ws.webservices.engine.dispatchers.java.SessionDispatcher.invoke(SessionDispatcher.java:203)
         at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:225)
         at com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXRPCHandler.invoke(JAXRPCHandler.java:151)
         at com.ibm.ws.webservices.engine.handlers.WrappedHandler.invoke(WrappedHandler.java:64)
         at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:225)
         at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:225)
         at com.ibm.ws.webservices.engine.WebServicesEngine.invoke(WebServicesEngine.java:279)
         at com.ibm.ws.webservices.engine.transport.http.WebServicesServlet.doPost(WebServicesServlet.java:717)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
         at com.ibm.ws.webservices.engine.transport.http.WebServicesServletBase.service(WebServicesServletBase.java:341)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282)
         at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:673)
         at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:80)
         at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1802)
         at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
         at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:469)
         at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:408)
         at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:286)
         at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:201)
         at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:103)
         at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java(Compiled Code))
         at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java(Compiled Code))
         at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java(Compiled Code))
         at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java(Compiled Code))
         at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))

    You have to put myfaces jar on the web-inf/lib

  • How do I create a printer friendly page in a popup window for a JSF page

    I have a JSF page that displays a table that shows the inventory level of a particular garment style. The table is like a matrix with each row representing a color of the style and each column representing a size of the garment. So the data in the table cell is for the inventory level of a particular color/size combination (e.g. navy blue of medium size ) for the particular style. The page also allows you to dynamically select a warehouse from a dropdown to see the inventory matrix of that warehouse.
    Now everything has been working fine except that the matrix table is not printer-friendly. So we need to have a Print button or link on the page that will generate a popup window that displays the same matrix table in a printer-friendly format (with different style sheet etc.). What is the best way to populate the matrix table in the popup? The data in the matrx table is stored in a hashmap in a InventoryManageBean of session scope.
    Also, shoud I use window.open to get the new window and if so what do I pass in the URL parameter?
    Any advice is appreciated. It would be great if you can include a code sample as I would think someone else must have had this done before.

    Any one please? This is urgent. Thanks a ton!

  • Catching an exception in an JSF page

    Hi,
    I have made the following example:
    In my jsf page I have:
    <a4j:commandButton id="save" action="#{settings.save}"
    reRender="attributes" />
    <h:outputLabel value="Save" for="save" />
    <table width="100%" cellpadding="0" cellspacing="0">
    <!--
    <tr>
    <td> If exception occurs add extra buttons here for more actions
    </td>
    </tr>
    -->
    <tr>
    <td><ui:include src="/attributes.xhtml">
    <ui:param name="parent" value="#{settings}" />
    </ui:include></td>
    </tr>
    </table>
    In SettingsBean.java
    public void save() throws exception
    try
    doSomething();
    catch(Exception e)
    // catch the exception here and send it back to the jsf page????
    I want to be able to catch the exception when it occurs in my jsf page. If the exception arrises I want to add some extra buttons.
    Any ideas how to resolve this?
    Thanks in advance

    JSF does not work like JSP, even when using JSP with JSF, in that the execution is decoupled from the page being processed. So you cannot catch exceptions in JSF views.
    Assuming I have sufficiently confused you now, let me give you some ideas as to how to handle your situation. The usual way this is handled is to register a message when an exception occurs which are then displayed by <h:messages> or <h:message> components.
    However, this does not appear to be suitable for your purpose as you require specialized output when the exception occurs. So you could store a flag (or even the exception itself) in a backing bean and use the rendered property of all components to conditionally display your buttons. BUT you will need to take care that the dynamic value of the rendered property will be the same on the subsequent request or the actions for the buttons will not be queued.

  • JSF pages to display content from external URLs

    Hi,
    Is it possible for a JSF page that uses ADF controls, and the PanelPage component to provide menuing, etc. to actually allow a HTML page (accessed via a URL to an external site/application) to be displayed in an area within the JSF page?
    For example, clicking a menu item to an external HTML page results in the page being displayed in a Frame or similar within the JSF page?
    I've tried the FrameBorderLayout control and Frame control to try to embed a Frame to display such a page via the target setting for a menu item, but that doesn't seem to work. At least not when within a PanelPage. It works within a basic JSP page.
    I would have thought it would be possible for a JSF application to incorporate HTML content from other sites/servers as if part of the application. Even if this meant defining "wrapper" pages of some sort to effectively link these into the JSF application as part of it's navigation rules.
    Or am I missing something?
    Gene

    Thanks,
    Yes, using an iFrame tag within a verbatim tag worked, allowing me to specify an external URL to a page which is then displayed at the location where I placed the verbatim tag. I need to investigate sizing/border settings, but at least I now seem to be able to embed such pages.
    This works.
    I tried jsp:include as well, but that only seems to allow relative URLs to pages that a part of the application. And using the c:import JSTL tag would import a page at an external URL, but didn't seem to position it where I wanted it.
    Gene

  • JSF pages too large to compile

    I have a page that contains a large number of textbox controls and message components. When I try to run the page on my test server I get a compile error that the code is too large within a try statement. Is there any server settings that you can change that would up the memory size limit ? The server that I'm deploying to is the test WS server in WSAD5.12.
    I know that there is an upper bounds on the absolute memeory that a piece of code must be below, are there any moves to increase this size if jsf pages are requiring too much memory , or is it a limit that we have to live with.
    Thanks for any help

    the following is my code.
              <f:view>
    <h:form id="mixMatchPromoDetailForm">
    <c:import url="./promo/mixMatchPromoLayoutControl.jsp"/>
    <div id="div1" style="display:block;">
                   <%@include file="./promo/mixMatchPromoHeader.jsp"%>
                   </div>
    <div id="div2" style="display:block;">
              <%@include file="./promo/testmixMatchPromoGetRule.jsp"%>
                   </div>
    </h:form>
    </f:view>

  • Using Business Components in JSF pages

    I have several questions about using BCs in JavaServer Faces pages. I'm new to the JSF-BC development world.
    Here's what I'm trying to accomplish: a salesperson gets a call from a customer requesting a quote. The salesperson selects the URL for my RFQ form and begins filling it out. If there is an existing customer record in the company's database, the salesperson wants to be able to load customer info into the form from the database, rather than typing it all in. Reasonable enough, and probably simply enough.
    But it's kickin' my butt. I've created the domain objects (including one for the customer database, call it "CU") and the model objects (a View Object that filters out all fields but those needed on the form, an Application Module with a View Object Instance). Initially I am routing from the main form window to a dialog window where I am hosting the customer selection components, intending to return to the main window with the selection. On the dialog window I've dropped the VO and configured it to be an ADF Navigation List (which gets implemented as an af:selectOneChoice component). So far so good. The navigation to and from is working fine. The selectOneChoice list is being populated with the first range of returned records. Here's where I'm stuck.
    First of all I can't figure out how to kick the iterator into sending additional records after it's first range. You can scroll down to the end of the list in the selectOneChoice component but nothing happens after that. I know I can set the iterator's range to 0 to get all of the records dumped in at once, but that takes way too long. Any ideas?
    Secondly, when a selection is made, how do I access the selected data? I have set up a ValueChangeListener method in my dialog's backing bean that gets the NewValue() from the event object, but that value turns out to be the index into the collection of selectItems. How do I get the value of the data that shows in the list? Is that the label of the selectItem? If so, how do I access it? What I really want is to get the entire row of data represented by the returned index, but I'm lost as to how to do that. Any help would be much appreciated.
    At some point I want to let the salesperson type in a partial customer name and then retrieve only records matching the query's where clause. I see where I can create a bind variable on the view object, but am not sure how to pass the partial name value from the main form to the dialog. Currently I use an EL expression in the Action attribute of an af:selectInputText component to navigate to the dialog and I don't think I can pass parameters with that. I guess I would have to switch to using a method binding to a backing bean, eh? But even if I can get the partial name value to the dialog, how do I bind that value to the bind variable of the VO? (the VO that is already bound to the af:selectOneChoice component in the dialog.)
    And I am totally open to alternative suggestions for how to accomplish the original intention of all of this. Thanks for any guidance.
    Johnny Lee

    Thanks, Shay. That has gotten me a few steps further along. I modified my VO by creating a bind variable and modified the SQL to use this variable in it's where clause. I generated Java for my AppMod (which I hadn't done before, preferring to keep things simple) and created a method to supply a value to my VO's new bind variable. I need a little more hand-holding, though, to wire an input text field & button (or af:selectInputText?) to both the AppMod's new method AND the data component that will display the query results.
    "...drag the exposed method as a button onto a JSF page." That's easy enough, but I haven't yet figured out from the examples how to associate the value of an input component with the parameter of the AppMod's new method. It's getting late, I'm starting to see cross-eyed so I will sleep on this and take another look in the morning. Thanks for your help.
    Johnny Lee

Maybe you are looking for