Dynamic  -  JSF

Hi
I'm trying to make a JSF dynamic page with a DataTable
I'm trying to simplify data access activities to dynamic pages implementing this type of architecture :
http://www.jsfcentral.com/articles/dynamic_jsf-2.html
I have found a great tutorial with this architecture approach in Oracle site :
http://www.oracle.com/technology/oramag/oracle/06-jan/o16jsf.html
But I can't make it work, I don't know how to integrate this with a Managed Bean for UI actions
I mean
imagine a inputbox where I enter some text, and a button that will populate dynamically a DataTable making a query to my Model architecture
Can someone help me, or give me some tutorial ?
Thank you very much for any help

Well...finally...I was able to make it work
following the tutorial I said in the above post :
http://www.oracle.com/technology/oramag/oracle/06-jan/o16jsf.html
I was able to generate a static datatable, but I can't do the "Part 2: Creating a Data Table, Using the JSF API"
I'm interested in making a dynamic query, the problem is with commandButton_action method - Code Listing 6
I get a lot of errors :
Type or variable 'column1' not found
Type or variable 'column2' not found
Type or variable 'column3' not found
Type or variable 'column4' not found
Type or variable 'column5' not found
Type or variable 'column6' not found
I included this declaration lines :
UIColumn column1 = new UIColumn();
UIColumn column2 = new UIColumn();
UIColumn column3 = new UIColumn();
UIColumn column4 = new UIColumn();
UIColumn column5 = new UIColumn();
UIColumn column6 = new UIColumn();
And made a new import statement
import javax.faces.component.UIColumn;
but I can't populate my dataTable...the result is just like a very small "icon" empty datatable, I tried to change the dataTable width but without success
What's wrong ?

Similar Messages

  • JSF with in another dynamic JSF - Urgent Help Needed

    Hi,
    When i have JSF with in another dynamic JSF it worked fine in weblogic 9.2. But in weblogic 10.3.2 it is thwoing illegal state exception. Ho w can i add another JSP?
    <h:form id="frmAssignImpersonate">
         <h:inputHidden id="hiddenSoxEditPrivilege" value="#{assignImpersonate.soxEditPrivilege}"/>
         <h:inputHidden id="donotdelete" value="#{assignImpersonate.donotDelete}"/>
         <table class="TableContentWhite" style="TABLE-LAYOUT: fixed" cellSpacing="0" cellPadding="0" width="400">
              <tr>
                   <td>
                   <jsp:include page="/jsf/common/a.jsp"flush="false"/>
                   </td>
              </tr>
         </table>
         <table cellpadding="0" cellspacing="0" border="0" align="left" width="500">
              <TR class="ColorModuleHeader" height="20">
                   <TD class="rowHdr" align="left">Assign Impersonation Rights</TD>
              </TR>
              <tr>
                   <td valign="top" Class="TableContentwhite" align="left">
                   <jsp:include page="/jsf/common/b.jsp"flush="false"/>
                   </td>
              </tr>
         </table>
    </h:form>
    <%@ include file="/jsf/common/bdeFooter.jsp" %>
    Exception:
    java.lang.IllegalStateException
         at com.sun.faces.taglib.jsf_core.ViewTag.getComponentType(ViewTag.java:258)
         at javax.faces.webapp.UIComponentELTag.createComponent(UIComponentELTag.java:215)
         at javax.faces.webapp.UIComponentClassicTagBase.createChild(UIComponentClassicTagBase.java:466)
         at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:651)
         at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1097)
         Truncated. see log file for complete stacktrace

    wrong forum, you will not get answer here

  • Dynamic JSF GUI and associated backingbeans

    I'm designing a web application using JSF. One of the main requirements is that our GUI needs to be pluggable. I have tried to understand how pluggability can be achieved in JSF but haven't found a clear solution.
    I would like the application to be packaged as a war file. Adding customer specific pages/bean classes to the war file and repackaging of the war is not an option. The customer specific pages/classes must reside outside this war. At runtime, based on configured rules, I need to load the customer pages and render them. If the pages are JSP based JSF pages, then they will also have their associated backing beans.
    Given that the backing beans must be preconfigured as managed beans in the faces-config.xml file and all JSP pages must be part of the packaged web application, I don't know how to go about doing this.
    A solution (non-ideal) that I have thought of is to have the customers design their forms as HTML pages and have them put these forms in the document root directory on the app server. The customer code that manipulates the data on the form will be packaged in a jar file. The HTML form 'action' will be set to a URL that will take them to one of my servlets. The interaction will be such:
    1. A user visits my JSF/JSP page. He clicks on a button. In the action event listener, I decide on the correct html form to forward the request to. I put the instance of the backingbean class in the HttpSession and forward the request to the HTML page.
    2. The browser displays the HTML form. The user enters data on the form and submits it. The request arrives at my servlet.
    3. My servlet instantiates the appropriate customer class (using the ClassLoader) and calls a method on it passing it all postdata; the method returns some String value. The servlet pulls out the backingbean class instance from the HttpSession and calls a setProperty(String value) on it. The servlet then gets a handle to the RequestDispatcher and forwards the request to my original JSF/JSP page.
    4. The JSF page is rendered in the browser with then new value (property set by the servlet) displayed in the right view component.
    The above approach is very messy and with many customer forms and backend classes this approach can get very ugly. I am looking for the correct solution that is recommended by JSF to achieve this kind of pluggability.
    Any thoughts, advice or feedback will be very appreciated.
    thanks,
    tsc

    I have researched my issue online for quite some time and have found nothing that jumps out except one post to this forum.
    Adam.Winer replied to a similar post on this forum over a year ago where he suggests replacing the ViewHandler, NavigationHandler and VariableResolver to be able to plugin JSP pages at runtime (See below).
    After doing some reading, I understand the function of the NavigationHandler and VariableResolver a bit better. do not understand how to replace the ViewHandler and what the new handler should do to render different JSP pages at runtime.
    Has anyone tried this approach. If yes, examples would be nice.
    I'm sure what I'm attempting has been done before many times. How have people gone about to achieve this kinda of pluggability in JSF.
    Anyone?
    From: http://forum.java.sun.com/thread.jspa?forumID=427&threadID=524937
    Re: dynamic configuration for the application
    adam.winer Registered: Dec 23, 2003 12:00 AM      May 24, 2004 9:30 PM
    A lot of what you're seeing are genuine limitations, but happily, JSF is so pluggable that you can overcome them.
    JSPs are problematic in exactly the way you describe - unless your app server has support for pulling JSPs out of a database, etc., you're SOL. JSF, however, lets you use something other than JSPs by replacing the ViewHandler. That's a fair bit of work, but it is doable.
    For navigation logic, you'd replace the NavigationHandler. As long as you're willing to write the code that can pull navigation rules from an external source, life is good.
    For managed beans, all you need to replace is the VariableResolver - again, if you can pull the rules from an external source, you have full control.
    This is all far from easy - and it's a huge amount of work for one person - but I'd imagine these pieces will become available from various sources. A core goal of JSF 1.0 was making the framework as a whole pluggable so that others can innovate on top of the framework.
    -- Adam Winer (EG member)

  • Need HOW-TO on dynamic JSF pages

    How can we change a page dynamically? For example, I want to create an image tag but I do not know the name of the image until runtime. In fact it is a temporary file name that is geneated by a servlet .
    If this was a standard JSP page I would create a JSP tag with a "name" property . Can JSP tags be used on JSP pages and if so where do they show up in the Creator IDE?

    A technique that I have achieved in my app is to set the image url dynamically through the image url like this...
    THIS ONLY WORKS IF YOU HAVE USERNAME OR SIMILIAR FOR CLIENT SET IN SESSIONBEAN1 (JDBC/LDAP, Login, etc...)
    1. Close Creator locate an example jpeg that you want to bind dynamically.
    2. Open your Projects directory (outside of Creator is how I did) navigate to web/resources make an images directory inside of resources.
    3.Rename your example image something like...
    template1username.jpg
    (Hope I don't have to say that above username will correspond to whatever username you would like to bind the url to so when they are logged into your app they will have dynamic image just for them)
    4. Paste the renamed jpeg into the newly created images directory.
    5. Go back into Creator open your app and drop an image component onto the page.
    6. Make sure it is selected and go to properties pane -- url -- click the ellipses.
    7. NOTE I tried to use property binding and Creator wouldn't retain my url.
    8. Go to Use Value and then navigate to the images directory to the example renamed jpeg and select it so the url displays on top.
    9. Now all you have to do is manually add the binding in the url this way Creator doesn't seem to complain and the JSF Tag remains in the url
    10. To add the binding manually just replace username with the necessary binding expression for me it was...
    /resources/images/template1#{SessionBean1.loginBean.username}.jpg
    now run the project once logged in navigate to page with bound image and voila! It should be there and now all you have to do is add the images properly renamed to the images folder and anybody with a username and corresponding image in the directory gets a personalized image when they are logged in. This is probably not the best way to do this, but for what I was trying to achieve coupled with the fact that I am a NOOB it works pretty darn good.

  • Dynamic JSF GUI

    Hi
    I have a problem with creating dynamic GUIs. I have tried it the way it is described in Hans Bergstens book chapter 15, but it does not work. This may be because I am using WebSphere Application Developer 5.1.2 with a Tomcat 4.0.6.2 plugin. I do always get an "java.lang.IllegalStateException" when performing the second code line:
    ServletResponse response = (ServletResponse)context.getExternalContext().getResponse();
    OutputStream os = response.getOutputStream();" //Error is generated
    BUT there seems to be a slightly different way to generate dynamic user GUIs. This looks like this:
    //begin
    HtmlPanelGrid grid = new HtmlPanelGrid();
    HtmlOutputText title = new HtmlOutputText();
    title.setValue("This is my component!");grid.getChildren().add(title);
    //end
    I have just seen that code in this forum and I have no idea what I should make with it. How does it work to make a GUI this way? How and where is it rendered?
    Thanks

    What I need is a JSP that has a tag which should look like this:
    <pre>
    <f:view>
    <hx:scriptCollector id="scriptCollector1">
    <h:form styleClass="form" id="form1">
    <myTag: generateGUI />
    </h:form>
    </hx:scriptCollector>
    </f:view>
    </pre>
    Alternatively it would be possible to use something else than a tag.
    The Tag should then be able to generate the GUI.
    <pre>
    public class GUITag extends TagSupport
    public int doStartTag()
    HtmlCommandButton button = new HtmlCommandButton();
    button.setId("myButton1");
    button.setValue("button");
    MethodBinding mbButton = application.createMethodBinding("#{InputValueChanged.print}", null);
    button.setAction(mbButton);
    component.getAttributes().put("action", mbButton);
    //try
    button.encodeBegin(facesContext);
    button.encodeChildren(facesContext);
    button.encodeEnd(facesContext);
    //catch block
    </pre>
    So for example here a button should be generated in the GUI. This button should work. This means when pressing the button the print method of the InputValueChangedBean should be performed. And this does not work at the moment.
    The important thing is that the JSP must not contain any JSF code like:
    <pre>
    <h:outputText ....
    </h:outputText>
    </pre>
    This is because at the beginning of the JSP rendering process I have no idea which components are going to be displayed on it. What will be displayed on the JSP stands in an XML file. This XML file does not only contain the GUI information for one page, it does contain all the GUI information for the entire WebApplication. Depending on which button the user clicks on the dynamically generated GUI a different part of that XML file will be rendered (made to a GUI). So the user sees something different.
    I have also thought about using a custom presentation layer as described in chapter 15 of your book. But as far as I have understood that I have to create a ViewHandler. As a result of that the entire GUI of the WebApplication is then rendered using that ViewHandler. And this means I am not longer able to use normal JSPs (I would need to use the ViewHandler and normal JSPs together. So one part of the WebApplication should be rendered using the ViewHandler and the other part of the WebApplication should consist of normal JSPs).
    Is there any possibility having one part of the WebApplication rendered by the information of an XML file and a different part of the same WebApplication to be rendered the normal way by using JSPs with JSF tags?

  • Is there any Dynamic JSF tab component support?

    It seems that there're some JSF implementation support tab instead of JSF RI. but the way they work are wirte the static tags in the jsp.but my situation is -----
    dynamicly create tabs according to data, where means if there is 3 options, then make to tabs. if 3, then 3 -----
    if there any support out there somewhere? thanks!!

    The Scales and Tomahawk libraries provides a tabbed panel.
    But basically tabs are nothing less or more than a bunch of block elements layered over each other with the same amount of buttons or links at the top. If a tab click doesn't require a trip to the server, then you can just load all tab blocks at once and use Javascript+DOM to switch between tab blocks, e.g. one block should be displayed using element.style.display='block' and all other blocks should be hidden using element.style.display='none'. If a tab click require a trip to the server (to preinitialize stuff or so), then you can use the 'rendered' property of the tab block element (which can be <h:panelGroup style="display:block;" rendered="#{myBean.showTab == 1}" /> or so).
    For styling of the tab blocks and tab buttons/links just use CSS.

  • Dynamic JSF Content

    i need to write an html output stream to a JSF page and then include that page in another JSF page which will be the root page. Is this possible, and if so what can I attach links to these pages so that they can be viewed independently from the main/root page?
    Thanks, any help appreciated.

    well i came up with another idea but for some reason it doesn't work. The alternative idea that I came up with was to load the other page in an iframe and just put the iframe on the main page. Now I do not know if the fact that the page loading in the iframe submits to itself and writes the output to itself would keep it from being loaded in an iframe or not. Any ideas?
    Thanks.

  • Creating dynamic jsf page from xml

    I have an xml file with repeating content and from this xml file I have to build a screen with what is in the XML file
    The following is a sample of what I am talking about .I would have two RequestItem sections on the screen with a field ItemId ,RequestAction,
    Level,TelephoneNumber etc.
    The problem I face is knowing how many RequestItemes are in the XML .
    Any Ideas what is the best way to approach this .
    <RequestItem>
    <ItemId>3</ItemId>
    <RequestAction>ADD</RequestAction>
    <Level>LINE</Level>
    <TelephoneNumber>
    <TN>3035552224</TN>
    <CompressionType>729</CompressionType>
    </TelephoneNumber>
    <TenantLocationRecord>
    <Id>tlr1234567891
    </Id>
    </TenantLocationRecord>
    </RequestItem>
    <RequestItem>
    <ItemId>1</ItemId>
    <RequestAction>DELETE</RequestAction>
    <Level>LINE</Level>
    <TelephoneNumber>
    <TN>3035542224</TN>
    <CompressionType>730</CompressionType>
    </TelephoneNumber>
    <TenantLocationRecord>
    <Id>tlr1234567891
    </Id>
    </TenantLocationRecord>
    </RequestItem>

    Use Jaxb to read the XML and then programatically add components to the page.

  • Building the site structure for a dynamic website with JSF

    Hi,
    I am still a JSF-beginner.
    I try to build a fully-functional base-demo-application with a fix and a dynamic part.
    Fix part for menu, dynamic part for site-content.
    At the moment, the JSF-hyperlinks of the main menu work, but any JSF-parts in the included documents of the dynamic part are not shown. I guess, this is dued to inclusion of subviews, but I cannot find any similar examples in the web to come one step further.
    Here my complete demo:
    faces-config.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!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 xmlns="http://java.sun.com/JSF/Configuration">
    <navigation-rule>
    <from-view-id>*</from-view-id>
    <navigation-case>
    <from-outcome>site1</from-outcome>
    <to-view-id>/site1.jsp</to-view-id>
    <redirect>
    </redirect>
    </navigation-case>
    </navigation-rule>
    <navigation-rule>
    <from-view-id>*</from-view-id>
    <navigation-case>
    <from-outcome>site2</from-outcome>
    <to-view-id>/site2.jsp</to-view-id>
    <redirect>
    </redirect>
    </navigation-case>
    </navigation-rule>
    </faces-config>
    web.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <context-param>
    <param-name>com.sun.faces.verifyObjects</param-name>
    <param-value>false</param-value>
    </context-param>
    <context-param>
    <param-name>com.sun.faces.validateXml</param-name>
    <param-value>true</param-value>
    </context-param>
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
    </context-param>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>
    30
    </session-timeout>
    </session-config>
    <welcome-file-list>
         <welcome-file>
    index.jsp
    </welcome-file>
    </welcome-file-list>
    </web-app>
    index.jsp:
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <% response.sendRedirect("/jsfportal/site1.jsf"); %>
    site1.jsp:
    <?xml version="1.0" encoding="UTF-8" ?>
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <% String site = "1"; %>
    <%@ include file="base.jsp" %>
    dynamic_site1.jsp:
    <h1>Welcome to site 1</h1>
    Have fun visiting our portal
    site2.jsp:
    <?xml version="1.0" encoding="UTF-8" ?>
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <% String site = "2"; %>
    <%@ include file="base.jsp" %>
    dynamic_site2.jsp:
    <h1>Welcome to site 2</h2>
    Go to site 1: *<!-- And this is the JSF-link that is NOT shown: -->*
    <f:view>
    <h:form>
    <h:panelGrid border="0" columns="0">
    <h:commandLink id="p1" action="site1" value="Site 1" />
    </h:panelGrid>
    </h:form>
    </f:view>
    base.jsp:
    <%@ page language="java" %>
    <%@ page import = "java.io.*" %>
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%
    String title = "";
    int siteInteger = 0;
    String dynamic_site = "";
    if ( site != null )
    if (
    ( site.length ( ) > 0 )
    ( site.length ( ) <= 30 )
    if ( isNumeric ( site ) )
    siteInteger = Integer.valueOf ( site ).intValue ( );
    switch ( siteInteger )
    case 2: title = "Site 2";
    dynamic_site = "dynamic_site2.jsp";
    break;
    default:
    title = "Site 1";
    dynamic_site = "dynamic_site1.jsp"; // Start page
    %>
    <html xmlns="http://www.w3.org/1999/xhtml"
    lang="de" xml:lang="de">
    <head>
    <title>
    <%= title %>
    </title>
    <meta name="description" content="test site" />
    <meta name="keywords" content="test site" />
    </head>
    <body>
    <div width="100%" style="text-align:left">
    <table width="970" border="0" cellspacing="0" cellpadding="0" style="background-color:#ffffaa;margin-top:25px;">
    *<!-- this is not good style putting CSS directly into HTML but it is a demo now ;) -->*
    <colgroup>
    <col width="970" />
    </colgroup>
    <tr>
    <td valign="top" align="left" style="padding:25px;">
    +<h1>+
    JSF portal
    +</h1>+
    </td>
    </tr>
    </table>
    <table width="970" border="2" cellspacing="0" cellpadding="0" style="background-color:#f5f5f0">
    <colgroup>
    <col width="270" />
    <col width="700" />
    </colgroup>
    <tr>
    <td valign="top" align="left" style="padding:25px; padding-left:40px;padding-bottom:320px;">
    <f:view>
    <h:form>
    <h:panelGrid border="0" columns="0">
    <h:commandLink id="p1" action="site1" value="Site 1" />
    <h:commandLink id="p2" action="site2" value="Site 2" />
    </h:panelGrid>
    </h:form>
    </f:view>
    </td>
    <td valign="top" align="justify" class="haupttext" style="padding:24px;">
    <p align="justify">
    <f:subview id="subview1">
    <jsp:include page="<%= dynamic_site %>" flush="true">
    <jsp:param name="" value="" />
    </jsp:include>
    </f:subview>
    </p>
    </td>
    </tr>
    </table>
    </div>
    </body>
    </html>
    <%!
    public boolean isNumeric ( String myInput )
    if (myInput == null || myInput.length() < 1)
    return false;
    int start = 0;
    if (myInput.charAt(0) == '-')
    start = 1;
    for(int i = start; i < myInput.length(); i++)
    if (!Character.isDigit(myInput.charAt(i)))
    return false;
    return true;
    %>
    Who can name me that code positions responsible for that the JSF link in the dynamic part is not shown?
    It is not that it does not work it is not shown. The JSF tree seems to be cut because of wrong use of view and subview etc.
    (To put view tags in site1.jsp and site2.jsp does not help.)
    (Once having afforded an example it should go... (*Then* with JSTL, external CSS, etc. ;) )
    Dynamical site structure with include files is the big problem at the moment.)
    bye, Maik

    I found your following suggestions for such cases (seems you are the only profound JSF freak in the world...? :-) )
    Switch between subviews in one main page
    http://balusc.blogspot.com/2007/01/dynamic-jsf-subviews.html
    But the main problem for me is that I never find complete examples, but always fragments and it would be important for a beginner to have at least once a complete JSF example over a few subviews, especially here where it is very easy to corrupt the internal tree.
    (Some examples use the subview tags in the calling JSP, some in the called e.g.... Does not matter where to put it? Some use verbatim tags for HTML code outside JSF, some don't... and so on)
    Can anyone give me an URL for a complete example of a JSF site (with all files as possible, I am not very patient, too, but in this case it makes sense to have it entire ;-) ) with dynamic switches of subviews as preferentially used for bigger portal sites?

  • How to dynamically include jsp files using jsf el in include tag ?

    Hi,
    I'm trying to get the jsp file name from my backing bean to use it in an include tag but I can't make it work
    When using this piece of code I can get the generated path
             <h:outputText value="/_partial/#{myBean.jspName}.jsp"/>whereas in this code the jsf el is not replaced by this value.
            <%@ include file="/_partial/#{myBean.jspName}.jsp" %> Have you any idea of how to solve this ? I'm currently developing for J2EE 1.4 platform.     
    Thanks for your help,
    Regards.

    If you're using JSF 1.2 and JSTL 1.2 at a JSP 2.1 environment, then you can just use <jsp:include> with unified EL.
    If you're using JSF 1.1, then you may find this article useful [http://balusc.blogspot.com/2007/01/dynamic-jsf-subviews.html]

  • Dynamic Menu Creation Problem

    Hi,
    I am trying to implement a dynamic JSF menu, by coding for it in a request bean, and have hit a stumbling block with regards to adding a panelMenu to another panelMenu. I understand how to add outputLink and outputText to the menu and even how to add another panelMenu to the menu.
    Here is the code:
    HtmlPanelMenu panelMenu = new HtmlPanelMenu();
    panelMenu.setId("menuMain");
    panelMenu.setStyleClass("panelMenu");
    HtmlPanelMenu subMenu = new HtmlPanelMenu();
    subMenu.setId("subMenu");
    HtmlOutputText text1 = new HtmlOutputText();
    text1.setValue("Enquiry Menu");
    text1.setId("text1");
    subMenu.getChildren().add(text1);
    HtmlOutputLinkEx outputLink1 = new HtmlOutputLinkEx();
    outputLink1.setId("link1");
    outputLink1.setValue("enquiry.faces");
    HtmlOutputText text2 = new HtmlOutputText();
    text2.setId("authoritiesLinkText");
    text2.setValue("Branch Enquiry");
    outputLink1.getChildren().add(text2);
    subMenu.getChildren().add(outputLink1);
    panelMenu.getChildren().add(subMenu);When I try to run the page I get the following error:
    javax.servlet.ServletException: nested menu's require a menu owner - some item that is contained in a f:facet with name = "header"
    This is running on Websphere v7. I can see from the specification that the outputText for the submenu (text1) should have a surrounding facet, but I cannot find such an object anywhere. I have tried using FacetTag but this doesn't work as it hasn't got a children property to attach the outputText to it.
    Am I missing something or is it that this is the wrong way?
    Any help would be appreciated!
    Steve
    Edited by: Steve-Waterfall on Oct 22, 2009 1:37 PM
    Edited by: Steve-Waterfall on Oct 22, 2009 1:38 PM

    Ahhh you were nearly there
    try
    HtmlPanelMenu panelMenu = new HtmlPanelMenu();
    panelMenu.setId("menuMain");
    panelMenu.setStyleClass("panelMenu");
    HtmlPanelMenu subMenu = new HtmlPanelMenu();
    subMenu.setId("subMenu");
    HtmlOutputText text1 = new HtmlOutputText();
    text1.setValue("Enquiry Menu");
    text1.setId("text1");
    here is the key
    subMenu.getFacets().put("header",text1);
    HtmlOutputLinkEx outputLink1 = new HtmlOutputLinkEx();
    outputLink1.setId("link1");
    outputLink1.setValue("enquiry.faces");
    HtmlOutputText text2 = new HtmlOutputText();
    text2.setId("authoritiesLinkText");
    text2.setValue("Branch Enquiry");
    outputLink1.getChildren().add(text2);
    subMenu.getChildren().add(outputLink1);
    panelMenu.getChildren().add(subMenu);

  • Scripting in JSF pages

    Hey,
    I have 2 JSF pages: container.jsp and sub.jsp,
    container.jsp loads sub.jsp in a dynamic call like this:
    <jsp:include page='<%= pageToLoad %>' />Inside sub.jsp, I have a parameter defined for a commandLink tag:
    <h:commandLink ...>
      <f:param name="param1" value="<%= value %>" />
    </h:commandLink>Problem:
    - container.jsp fails to load and returns an error because it seems that the JSF tags within sub.jsp have execution priority over the script code (which is read literally and not executed).
    - if I remove the script and hardcode the value, it works fine
    - if I write the same code inside container.jsp, it works fine as well
    Question:
    How can I overcome this problem? Is there any alternative way for reaching the same outcome?
    Thanks,
    Mobal

    I ever wrote an article about that: http://balusc.blogspot.com/2007/01/dynamic-jsf-subviews.html

  • Creating new JSF2 pages from a running Servlet (3.0) or JSF2 page?

    I'm new to JEE6 web apps with JSF 2.x frontends (GlassFish 3), and I still wasn't able to find a solution for this dynamic JSF 2.x problem:
    *From inside a running JSF 2.x web app (Servlet 3.0), which possibilities (if any) do I have to dynamically add generated JSF pages (whole new .xhtml files) to specific folders of the (exploded) document root, so that these pages can be dispatched to the client like any traditional, statically-deployed one?*
    Background: An app for "promoting" authors/editors (content providers) which has these few main requirements:
    <ol>
    <li>New providers will register under <tt>www.acme.com/app/register.xhtml</tt>.</li>
    <li>The system will grant each provider "sub-domain" associated with web space under
    <tt>www.acme.com/app/<b>providerX</b></tt> where providerX is an arbitrary sub-domain name chosen by the provider during the registration.</li>
    <li>Each provider will initially have some pre-defined pages in their document context root, e.g.
    <tt>www.acme.com/app/providerX/index.xhtml</tt>, <tt>about-me.xhtml</tt>, <tt>contact.xhtml</tt>, etc.</li>
    <li>Each provider will have an administration console for managing 2 tasks:
    <ul>
    <li type="a"><tt>www.acme.com/app/providerX/admin/page-manager.xhtml</tt> </li>
    <li type="a"><tt>www.acme.com/app/providerX/admin/customer-manager.xhtml</tt></li>
    </ul>
    to specify new pages with offers, publish these pages in their document context root, e.g. <tt>www.acme.com/app/<b>providerX</b>/<b>my-services</b>.xhtml</tt> (customized page name), and
    to manage their readers/customers, respectively.
    </li>
    <li>Thus, each providerX will also have a pre-deployed customer registration page running, which creates standard customer accounts. E.g.:
    <ul>
    <li type="disc"><tt>www.acme.com/app/providerX/customers/registration.xhtml</tt></li>
    <li type="disc"><tt>www.acme.com/app/providerX/customers/login.xhtml</tt></li>
    <li type="disc"><tt>www.acme.com/app/providerX/customers/customer-account-dashboard.xhtml</tt></li>
    </ul>
    </li></ol>
    Please note: I know that for such kind of systems a CMS would be more suitable, but is such a system -- here aiming at only basic functionality -- also realizable in pure JEE 6 technologies, i.e. w/o CMS???
    <b>The unclear main aspect is stated in my initial question above. Basically, I hope to get these clarifications:</b>
    <ol>
    <li><b>Which app architecture designs can I use to deploy new generated JSF pages or servlets from within a running JSF page or servlet???</b></li>
    <li><b>Supposing that all relevant page description data provided by a provider is stored in a db:
    Where can I "cache" the new .xhtml pages generated from these data on-the-fly when (a) an exploded WAR, and (b) a packaged WAR is running???</b>
    The pages shall be "hooked" to the scope (doc root) of the respective provider and dispatches by the <tt>FacesServlet</tt> as such.</li>
    </ol>
    Due to the crucial importance in a current project, I'd really appreciate any constructive help very much.
    Natalia.

    Natalia F. wrote:
    Determining you as one of the experts in this forum, please, could I ask you how you'd solve this kind of web apps in JSF2 (one of the requirements stated at the beginning of this thread):I'm certainly an expert at having an opinion about everything.
    >
    Having a "page-manager.xhtml" JSF2 UI at "/page-manager" context that lets registered member X define a website (=a set of .jsf/.xhtml pages) in a new context "/websiteX" (where "websiteX" is freely chosen and associated with dedicated webspace to store the pages in the filesystem):
    How to store these dynamically created website pages from within the PageManagerServlet?
    <ol><li type="a">Could I create a new exploded WAR structure in the filesystem (or elsewhere) when a new context is defined, and then store new .jsf/.xhtml files therein when a new page is defined, all this with usual file operations? -- Would this be enough, or...</li>
    <li type="a">...after storing a new page, would I need to explicitly tell the container to deploy the page (or re-deploy the WAR(?)) so that I can instantly test/run the page when it is new/modified, or will it be compiled automatically when pointing a browser to it???
    I guess both is possible, but for performance reasons, a pre-compile would be better. How can I achieve this?</li>
    </ol>
    Thank you a million for your help, Natalia.I only see mention of xhtml files - that is the easy part. But XHTML files don't actually do anything at all. What about classes like JSF managed beans? jar libraries? database connections and ORM/JPA support which also adds the complexity of having to deal with all the configuration descriptor files? Even if you can automatically deploy all that, replacing existing classes and reloading them is a whole different matter.
    My "expert" opinion: this cannot be done with JSF. In fact the only Java web framework which I can think of that has any chance of making something like this possible is Play framework. I'd really take the road that EJP took: make the content dynamic, not the webapp.

  • How to call a bean method through javascript?

    Hi,
    i want to call a bean method using the javascript.
    thansk in advance.

    hi
    i want to call a backing bean method thought javscript on the button click.
    i am inplementing addition of textbox at runtime.i wrote method and i am calling that on the button click.but the textbox is not created.
    the code is bleow
    public String doAction() {
         tryStuff1();
    return "samplejsf";
    public void tryStuff1()
    System.out.println("Enter the trystuff method");
         FacesContext facesContext = FacesContext.getCurrentInstance();
    UIViewRoot uIViewRoot = facesContext.getViewRoot();
    Application application = facesContext.getApplication();
    UIComponent formComp=uIViewRoot.findComponent("subbody:form1");
    HtmlPanelGrid grid= new HtmlPanelGrid();
    grid.setId("panelgrid2");
    grid.setColumns(2);
    grid.setBorder(2);
    //UIComponent panelGridComp=formComp.findComponent("subbody:panelgrid1");
    //UIComponent panelGroupComp=panelGridComp.findComponent("panelgroup2");
         HtmlOutputText output = new HtmlOutputText();
    output.setValue("dynamic jsf text2");
    System.out.println("hello output text2");
    output.setRendered(true);
    grid.getChildren().add(output);
    HtmlInputText input = new HtmlInputText();
    input.setSize(40);
    input.setValueBinding("value", (ValueBinding) application.createValueBinding("#{sample.text2}"));
    input.setRendered(true);
    grid.getChildren().add(input);
    System.out.println("hello output text1");
    grid.setRendered(true);
    formComp.getChildren().add(grid);
    System.out.println("hello output text3:");
    formComp.getRendersChildren();
    formComp.setRendered(true);
    public boolean getRendersChildren() {
         return true;
    jsp code is
    <h:form id="form1">
    <h:panelGrid columns="2" binding="#{sample.formElements}">
    </h:panelGrid>
    <h:panelGrid id="panelgrid1" columns="1">
    <h:panelGroup id="panelgroup1">
    <h:outputText value="hardcoded jsf text1"/>
    <h:inputText value="#{sample.text1}"/>
    </h:panelGroup>
    </h:panelGrid>
    <h:commandButton id="add" action="#{sample.doAction}" value="add" type="SUBMIT"/>
    </h:form>
    when i click on the button its going into the method and diaplying s.o.p but the text box is not updated to the page.
    why is it so.
    i thought there may be a problem in calling the method directly thru button. i want to try thru javascript calling the bean method.
    why is the page not updated.
    can u help me out
    thanks in advance
    sree

  • Parameter Instantiation error

    Hopefully an easy one and it's just the fact that I've not had enough sleep for about 5 years now...
    <c:import url="/protected/${appName}.jsp" />How can I instantiate ${appName} so my app doesn't choke with the error...
    <Included resource or file "/protected/.jsp" not found from requested resource "/protected/index.jsp".>

    I would use jsp:include for that.
    Main jsp:<f:view>
        <jsp:include page="#{myBean.includePage}" />
    </f:view>MyBean:public String getIncludePage() {
        return includePage; // Can be e.g. "include.jsp", "relative/path/include.jsp", etc.
    }where the include.jsp look like:<f:subview id="include">
    </f:subview>Works in JSF 1.2 only. For older versions, read this article: http://balusc.blogspot.com/2007/01/dynamic-jsf-subviews.html

Maybe you are looking for

  • How to create event trigger to kick off another report

    Hi i am having two reports, first report runs for 10 minutes , i want the second report to run automatically after first report is completed. how to do that?

  • HD to DV in Final Cut Pro 3

    I have HD footage but Final Cut Pro 3 and am unable to open the footage. How may I down convert the HD footage so I may edit? Does the G5 come with software I may use for this?

  • Edit Dashboard option is not visible in 11G

    Hi Experts, I have migrated Repository and Catalog from OBIEE 10g to OBIEE 11g. Reports are coming but the Edit Dashboard option is not available and New reports cannot be created. Please help me to come out from this issue. Thanks, Balaa...

  • ABUMN code error

    Hi, I am posting a transfer using ABUMN code, within the same company code, but when i use the exisiting asset to be posted into, i  get an error msg which says the asset value date is earlier than capitlisation date.but the asset has already been ca

  • File size with JPEG Image files

    I recently had to re-load all of my photos from an external hard drive due to the fact that my hard drive crashed. When I did, I noticed that the files are JPEG Image files. As a result, the file size is considerably smaller than the original file an