Form included in JSF Fragments doesn't work

Hi there i have a simple form placed in JSF page fragment, the fragment is included in several pages. It renders , but the button action doesn't do what it is supposed to do.
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Document   : AddAdvertForm
    Created on : 09-May-2008, 12:14:50
    Author     : Mirza Asif
-->
<div style="height: 400px; width: 400px; -rave-layout: grid" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
    <f:subview id="AddAdvertForm">
        <h:selectOneMenu id="dropdown1" style="left: 100px; top: 40px; position: absolute; width: 125px" value="#{AddAdvertForm.cat}">
            <f:selectItems id="dropdown1SelectItems" value="#{AddAdvertForm.dd1data}"/>
        </h:selectOneMenu>
        <h:selectOneMenu id="dropdown2" style="left: 100px; top: 70px; position: absolute; width: 125px" value="#{AddAdvertForm.type}">
            <f:selectItems id="dropdown2SelectItems" value="#{AddAdvertForm.dd2data}"/>
        </h:selectOneMenu>
        <webuijsf:staticText id="staticText1" style="font-weight: bold; left: 10px; top: 10px; position: absolute" text="Step 1. Choose Advert.   "/>
        <webuijsf:staticText id="staticText2" style="left: 70px; top: 100px; position: absolute" text="Title:"/>
        <webuijsf:staticText id="staticText3" style="left: 35px; top: 130px; position: absolute" text="Description:"/>
        <webuijsf:staticText id="staticText4" style="left: 12px; top: 40px; position: absolute" text="Select Category:"/>
        <webuijsf:staticText id="staticText5" style="font-weight: bold; left: 10px; top: 220px; position: absolute" text="Step 2. Please give your personal details."/>
        <webuijsf:staticText id="staticText6" style="left: 63px; top: 250px; position: absolute" text="Name:"/>
        <webuijsf:staticText id="staticText7" style="left: 53px; top: 310px; position: absolute" text="* E-mail:"/>
        <webuijsf:staticText id="staticText8" style="left: 43px; top: 340px; position: absolute" text="Phone No:"/>
        <webuijsf:staticText id="staticText9" style="left: 65px; top: 70px; position: absolute" text="Type:"/>
        <webuijsf:staticText id="staticText10" style="left: 50px; top: 280px; position: absolute" text="Location:"/>
        <webuijsf:staticText id="staticText11" style="left: 230px; top: 310px; position: absolute" text="#{AddAdvertForm.emailMsg}"/>
        <webuijsf:textField id="textField1" style="left: 100px; top: 100px; position: absolute" text="#{AddAdvertForm.title}"/>
        <webuijsf:textField id="textField2" style="left: 100px; top: 250px; position: absolute" text="#{AddAdvertForm.name}"/>
        <webuijsf:textField id="textField3" style="left: 100px; top: 310px; position: absolute" text="#{AddAdvertForm.email}"/>
        <webuijsf:textField id="textField4" style="left: 100px; top: 340px; position: absolute" text="#{AddAdvertForm.phoneNo}"/>
        <webuijsf:textField id="textField5" style="position: absolute; left: 100px; top: 280px" text="#{AddAdvertForm.location}"/>
        <webuijsf:textArea columns="35" id="textArea1" rows="5" style="left: 100px; top: 130px; position: absolute" text="#{AddAdvertForm.description}"/>
        <webuijsf:button actionExpression="#{AddAdvertForm.button2_action}" id="button1" style="height: 20px; left: 99px; top: 370px; position: absolute; width: 128px" text="Add"/>
    </f:subview>
</div>The Fragment is included in the following page:
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Document   : AddAdvert
    Created on : 13.5.2008, 13:09:
    Author     : Ilija
-->
<jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
    <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
    <f:view>
        <webuijsf:page id="page1">
            <webuijsf:html id="html1">
                <webuijsf:head id="head1">
                    <webuijsf:link id="link1" url="/resources/stylesheet.css"/>
                    <webuijsf:link id="link2" url="/resources/global.css"/>
                    <webuijsf:script id="script1" url="/resources/Scripts/global.js"/>
                </webuijsf:head>
                <webuijsf:body id="body1" style="-rave-layout: grid; text-align: center; background: url(./resources/images/back_ptr.png) repeat-x">
                    <webuijsf:form id="form1">
                        <div align="center">
                            <jsp:directive.include file="Header.jspf"/>
                        </div>
                        <div align="center" style="padding-top:3px; padding-bottom:3px">
                            <jsp:directive.include file="MainMenu.jspf"/>
                        </div>
                        <div align="center">
                            <h:panelGrid border="0" cellpadding="0" cellspacing="0" columnClasses="Column1,Column2,Column3,Column4" columns="4" id="gridPanel1"
                                rules="cols" style="height: 96px; left: 0px; position: relative" width="955">
                                <webuijsf:panelGroup>
                                    <webuijsf:panelGroup rendered="#{Permissions.admin}">
                                        <div style="padding-top:5px; padding-bottom:5px">
                                            <jsp:directive.include file="AdminTool.jspf"/>
                                        </div>
                                    </webuijsf:panelGroup>
                                    <div style="height: 22px">
                                        <h:graphicImage url="./resources/images/cat_header.png"/>
                                    </div>
                                    <h:outputText escape="false" value="#{MenuGenerator.menuHtml}"/>
                                    <h:graphicImage url="./resources/images/cat_footer.png"/>
                                    <h:outputText escape="false" value="#{BannerUnit.rightHTML}"/>
                                </webuijsf:panelGroup>
                                <webuijsf:panelGroup>
                                            <div style="position: relative; border-bottom:solid thin green">
                                                <jsp:directive.include file="AddAdvertForm.jspf"/>
                                            </div>
                                </webuijsf:panelGroup>
                                <webuijsf:panelGroup>
                                    <div style="width: 185px; top: 5px; position: relative; float: left">
                                        <h:outputText escape="false" value="#{ArticleUnit.articleHTML}"/>
                                    </div>
                                </webuijsf:panelGroup>
                                <webuijsf:panelGroup>
                                    <div style="padding-top:5px; padding-bottom:px">
                                        <jsp:directive.include file="LoginTool.jspf"/>
                                    </div>
                                    <h:outputText escape="false" value="#{BannerUnit.rightHTML}"/>
                                </webuijsf:panelGroup>
                                <f:facet name="footer">
                                    <h:panelGroup style="display:block; text-align:center">
                                        <jsp:directive.include file="Footer.jspf"/>
                                    </h:panelGroup>
                                </f:facet>
                            </h:panelGrid>
                        </div>
                    </webuijsf:form>
                </webuijsf:body>
            </webuijsf:html>
        </webuijsf:page>
    </f:view>
</jsp:root>I can press the button of the form, the page reloads, but nothings happen in the Database. Method ok() is responsible to add some stuff in the DB (i tested this method and work separately).
public String button2_action() {
        AdvertQueries a = new AdvertQueries();
        a.ok();
    return null;
  }Please HELP !!! I am struggling with his for 3 days.

You might try asking this question on the [JavaServer Faces forum|http://forums.sun.com/forum.jspa?forumID=427].

Similar Messages

  • .jar includes jdbc driver but doesn't work

    Hi
    I'm quite new with Java. I've just created my first app in java, it's some kind of CMS. I have to give to my friend who can only install JVM and I can't set up his computer, because he lives in other city. What's the problem then:
    I tried to compile (build) complete file with jdbc driver. And actually I've done it (when I open jar with winrar I see that mysql-connector.jar is there) but it's not working. I still have error:
    SQLException: com.mysql.jdbc.Driver
    No suitable driver
    08001
    It works fine when I'm running it with NetBeans, but built jar doesn't work at all.
    Please help me with this problem. I was searching in many forums for the same problem, but no one had it (I mean EXACTLY the same). I have had many problems already with adding connector to NetBeans project at the beginning, but finally I've done it after 2 days - reinstallation of NB solved the problem. Is it possible that's NB fault again?
    Thx for any clues
    Michael

    Hello,
    Try to include a Class-Path option in the Manifest of your jar and see if that works.
    Hope this helps

  • Partial submit in a jsf fragment is not working

    Hi,
    i have a jsf page that is hosting a jsf fragment (using workflow), inside the jsf fragment i have a button that has partial submit = true, and an output text that has partial triggers pointing to the button.
    the button on the fragment page has a "set action listener" that update a variable in a managed bean.
    the output text on the fragment page is displaying the content of that variable (which the button is updating).
    the problem is that partial submit is not working and whenever the button is clicked and the value of the variable inside the managed bean is changed , it is not reflected in the output text.
    note that if you try to use this example in a normal JSF page it will work, so does anybody knows what is wrong.
    i'm using Jdeveloper 11.1.1.2
    ************************** source code of the jsf fragment page *********************************
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    xmlns:f="http://java.sun.com/jsf/core">
    <af:commandButton text="commandButton 1" id="cb1" partialSubmit="true">
    <af:setActionListener from="#{not DepartmentInquiryBean.getterCriteriaPanelDisplayInd}"
    to="#{DepartmentInquiryBean.setterCriteriaPanelDisplayInd}"/>
    </af:commandButton>
    <af:outputText value="#{DepartmentInquiryBean.getterCriteriaPanelDisplayInd}" id="ot1"
    partialTriggers="cb1"/>
    </jsp:root>
    ************************** source code of the managed bean ************************************
    package Merch.Model;
    public class DepartmentInquiry {
    private boolean CriteriaPanelDisplayInd = true;
    public DepartmentInquiry() {
    public void setSetterCriteriaPanelDisplayInd(boolean p_CriteriaPanelDisplayInd) { 
    CriteriaPanelDisplayInd = p_CriteriaPanelDisplayInd;
    public boolean getGetterCriteriaPanelDisplayInd() {
    return CriteriaPanelDisplayInd;
    ********************************************************************************************

    Yes, try appending the region's id to the component inside that region.
    i.e.
    <af:outputText value="#{DepartmentInquiryBean.getterCriteriaPanelDisplayInd}" id="ot1"
    partialTriggers="r1:cb1"/>^ assuming 'r1' is your region's id.
    If your fragment is not inside a region...maybe try doing so.
    Also, see here:
    Referencing a component on a page fragment inside an <af:region>.
    Best of luck.
    Matthew.
    Edited by: Matthew Carrigy on 27/11/2009 10:42

  • Form on a SQL Query - doesn't work with SELECT * - bug or feature ?

    When I do this,
    Create Page -> Page with Component -> Form -> Form on a SQL Query -> SELECT * FROM EMP
    I do not get any items displayed and it creates a simple HTML region / page. Do we have to necessarily specify the column names ?
    Iam looking at a way to see if any addition of columns in the table does not involve IT intervention in recreating the form.
    When we try to create with Form on a SQL Query, then shouldn't it be similar to the Report where the same thing works, if I give SELECT function_returning_columns() from DUAL even then the same thing happens where it creates an ITEM called functions_returning_columns() it creates HTML region
    I asked a related question with no answer :-( in
    Dynamic Creation of Items in Runtime through Application UI

    Hi Marc,
    Thanks. I just tried something like this. Taking the EMP table example, (it doesn't matter which table), I created a region based on a Pl/Sql function returning SQL query
    ( I selected the vertical report template including nulls to display it like a form ) :
    DECLARE
    v_sql VARCHAR2(3000) ;
    mn_idx NUMBER := 1 ;
    BEGIN
    v_sql := 'SELECT ' ;
    FOR recs IN (SELECT * FROM ALL_TAB_COLUMNS WHERE TABLE_NAME = 'EMP' ORDER BY COLUMN_ID)
    LOOP
    v_sql := v_sql || 'HTMLDB_ITEM.TEXT(' || mn_idx || ',' ||
    recs.column_name || ') ' || recs.column_name || ', ' ;
    mn_idx := mn_idx + 1 ;
    END LOOP ;
    v_sql := SUBSTR(v_sql, 1, LENGTH(v_sql) -2) ;
    v_sql := v_sql || ' FROM EMP WHERE EMPNO = 7369 ORDER BY 1 ' ;
    RETURN v_sql ;
    END ;
    This allowed me to do my updates etc.., Then I created a button called 'Apply' and a process called 'update_changes' on button click and defined this:
    DECLARE
    v_sql varchar2(1000) ;
    mn_ctr NUMBER := 1 ;
    BEGIN
    v_sql := 'BEGIN UPDATE EMP SET ' ;
    FOR recs IN (select COLUMN_ID, COLUMN_NAME, DATA_TYPE
    from all_tab_columns where table_name = 'EMP'
    ORDER BY COLUMN_ID) loop
    -- Make changes here if required- this is assuming 9 columns --
    v_sql := v_sql || recs.column_name || ' = HTMLDB_APPLICATION.G_F0' || mn_ctr || '(1),' ;
    mn_ctr := mn_ctr + 1;
    end loop ;
    v_sql := substr(v_sql, 1, length(v_sql) - 1) ;
    v_sql := v_sql || ' WHERE EMPNO = 7369; END ;' ;
    execute immediate (v_sql) ;
    END ;
    Since this is for example, I didn't include code for Checksum and hardcoded empno = condition and have provision for 9 columns. I made some changes and tried saving it and I was able to do it.
    I altered the table to add a column / drop a column and when I relogin, Iam able to see the changes.
    Can you tell me if there could be any drawbacks in this approach ?.

  • Tiles:put with beanName and JSF object doesn't work

    I got some recent (good) advice for using tiles:put and in the inserted tile getting access to the string in a JSF tag, as long as it is a static string. For example, if I do this in the page including the tile:
    <tiles:insert page="includedPage.jsp">
    <tiles:put name="somevar" value="something" />
    </tiles:insert>
    Then in includedPage.jsp:
    <tiles:importAttribute name="somevar" scope="request"/>
    <h:outputText value="#{requestScope.somevar}"
    That works fine. But now I'm trying to use this:
    <tiles:insert page="includedPage.jsp">
    <tiles:put name="somevar" beanName="varFromDataTable" />
    </tiles:insert>
    I can't get it in the includedPage.jsp - I think because the tiles tag can't find the JSF variable (created using the var= attribute of dataTable).
    Does anyone know how I would do this? I need the whole object, not just a string from the object, since the includedPage.jsp will be using many attributes from the bean.

    Hi Greg,
    What kind of error/issue you are facing.
    Thanks,
    Rohit

  • I created a contact form in dreamweaver but it doesn't work

    <form id="form1" name="form1" method="post" action="mailto:myemailaddress">
      <table width="518" border="0">
        <tr>
          <td width="88"><div align="left">name</div></td>
          <td width="216"><input name="textfield" type="text" id="textfield" size="30" /></td>
          <td width="200"><label for="textfield"></label>
            <div align="left"></td>
        </tr>
        <tr>
          <td><div align="left">email</div></td>
          <td><input name="textfield2" type="text" id="textfield2" size="30" /></td>
          <td><p align="right">
            <label for="textfield2"></label>
            </td>
        </tr>
        <tr>
          <td height="30"><div align="left">subject</div></td>
          <td><input name="textfield3" type="text" id="textfield3" size="30" /></td>
          <td><label for="textfield3"></label>
            </td>
        </tr>
        <tr>
          <td height="59"><div align="left">comments</div></td>
          <td><textarea name="textarea" id="textarea" cols="30" rows="5"></textarea>
            <div align="left"></div></td>
          <td><div align="right"></div></td>
        </tr>
    </table>
      <p>
        <input type="submit" value="send" />
        <input type="reset" name="Reset" id="button" value="clear" />
      </p>
    </form>

    Using email addresses in forms is a) not very reliable, b) a good way to get spammed.
    You need a form-to-email processing script. Preferably one which conceals your e-mail address from harvesters and has built-in spam prevention.
    Contact your web host and ask them if they have one you can use.  Often hosts load scripts on their servers which you can activate through your Admin Panel or by referencing the script in your form's action attribute.
         <form action="path-to-script-on-server/form-to-email-script.php">
    If your host doesn't provide scripts, ask them which server-side languages you can use (php, asp, asp.net, perl, coldfusion, etc...).
    Related Links:
        Formm@ailer PHP from DB Masters
        http://dbmasters.net/index.php?id=4
        FormToEmail.com (free & pro versions available)
        http://formtoemail.com/formtoemail_pro_version.php    
        Tectite
        http://www.tectite.com/formmailpage.php
        Forms to Go from Bebosoft (script generating software)
        http://www.bebosoft.com/products/formstogo/overview/
        Wufoo.com (on-line form service)
        http://wufoo.com/
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/

  • "Request Product Service" form on apple's website doesn't work

    I'm trying to get Apple to repair my broken IPod. I go to the Request Product Service online form (http://depot.info.apple.com/ipod/), fill in all my info, and when I get to the page that asks "Describe Your Issue," I get stuck on the first part: "Select an issue which describes the reason for service," it says, and provides a drop-down menu - for which there are no options. Try continuing, and it won't let you. I'm so frustrated - is this Apple's way of getting out of servicing IPod's? It's such an obvious technical glitch in the form (I've tried using a different web browser, same thing happens), it's amazing.
    What are my options? Take it to a store?

    You can call apple at 1-800-275-2273 if your still stuck they will help you sort it out. By the way if you are canadian make sure you are filling out the canadian code, and same for u.s. good luck

  • Forms 10g  get_item_property('item',justification) doesn't work ?

    Hi all,
    This is driving me mad ... I just want the justification (alignment) of the data in an item ... the prompt_text_alignment works but not the , seemingly simple , get_item_property('item',justification); - even though it's there in the help text.
    Is it there ? mis-spelt or called something else ?
    TIA
    Steve

    It was a case of a supported item type - the procedure wouldn't even compile correctlt it didn't recognise the keyword. However, it liked alignment - guess I must have forgotten to try that :) Thanks Andreas!

  • Dynamic menu doesn't work with f:verbatim and jsp:directive.include

    Is it not possible to include fragment part in a panel page containing some dynamic menus ?
    This work fine:
    <af:panelPage title="Application home">
    <f:facet name="menu1">
    <af:menuTabs var="menuTab" value="#{menuModel.model}">
    <f:facet name="nodeStamp">
    <af:commandMenuItem text="#{menuTab.label}"
    action="#{menuTab.getOutcome}"/>
    </f:facet>
    </af:menuTabs>
    </f:facet>
    But replacing these entry by a fragment doesn't work, as this:
    <af:panelPage title="Application home">
    <f:facet name="menu1">
    <f:verbatim>
    <jsp:directive.include file="/menuTab.jspf"/>
    </f:verbatim>
    </f:facet>
    the fragment code:
    <f:subview id="menuTab">
    <af:menuTabs var="menuTab" value="#{menuModel.model}">
    <f:facet name="nodeStamp">
    <af:commandMenuItem text="#{menuTab.label}"
    action="#{menuTab.getOutcome}"/>
    </f:facet>
    </af:menuTabs>
    </f:subview>

    Oh, God, why not tell me earlier!!!!!! I do use tomcat 3.1 and it just support servlet. I have no way out but modify all my jsp:include to encoding into a servlet page. I almost re-do all my work. But anyway, thank you! Next time I will know.

  • Form doesn't work in IE, need help...

    If you visit my site
    http://www.firetree.us and click
    on the quote navigation element (it's at the bottom on the left)
    and attempt to fill out the form you'll find it doesn't work. But
    only in IE. I can't figure out why I'm using PHP to send it.
    PHP is located /php/emailer.php
    HTML is located /content/quote.php
    Can anyone help? Thanks!

    Anyhow, the reason your form is not working is this -
    <p
    align="right"><button>Send!</button></p>
    You do not submit the form with this button. It should be -
    <p align="right"><button
    type="submit">Send!</button></p>
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Murray *ACE*" <[email protected]> wrote
    in message
    news:[email protected]...
    > Why are you doing your pages this way? They are
    completely
    > non-accessable, and not-so-functional when js is
    disabled.
    >
    > Also, your loading scheme defeats usability by not
    changing the URL - you
    > cannot bookmark pages....
    >
    > Finally, I feel like you have just put moving things on
    the page without
    > regard for functionality or visual appeal - it's a bit
    distracting to have
    > that continuous up/down motion right in front of my
    eyes....
    >
    > --
    > Murray --- ICQ 71997575
    > Adobe Community Expert
    > (If you *MUST* email me, don't LAUGH when you do so!)
    > ==================
    >
    http://www.dreamweavermx-templates.com
    - Template Triage!
    >
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    >
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    >
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    > ==================
    >
    >
    > "Spencer Hill" <[email protected]>
    wrote in message
    > news:[email protected]...
    >> If you visit my site
    http://www.firetree.us and click
    on the quote
    >> navigation
    >> element (it's at the bottom on the left) and attempt
    to fill out the form
    >> you'll find it doesn't work. But only in IE. I can't
    figure out why I'm
    >> using
    >> PHP to send it.
    >>
    >> PHP is located /php/emailer.php
    >> HTML is located /content/quote.php
    >>
    >> Can anyone help? Thanks!
    >>
    >
    >

  • Keyboard Tabs doesn't work in PDF

    Hi,
    I'm working on Accessibility in pdf forms, the PDF forms generated from LiveCycle Designer doesn't work for the
    TAB keystrokes, is there a way to do it in order to use tabs in keyboard when viewing pdf in Adobe reader.
    -Sri

    hello ,
       I am sure tabbing does works for adobe forms when viewed through adobe reader .
    Can you specify which version of adobe lifecycle designer you have installed.
        the default tabbing sequesnce is from left to right , top to bottom , starting from the upper left corner.
    go to view -> tab order to set the tabbing order  in adobe life cycle designer
    hope this helps,
    thanks,
    sahiba

  • Paypal button doesn't work on Safari. but works on Firefox

    I have over 100 pairs of "Add to Cart" buttons on my website. One of each is on the individual item page and the other is on my Order Form.
    I have one button that works on the order form, but the identical button doesn't work on the individual page when using SAFARI, but works when I use FIREFOX!
    I have recreated the button several times and put it in the proper place several times, saved the changes and republished. Still it doesn't work in Safari!
    This must be a Safari issue not a PayPal issue
    Any suggestions?

    If that's checked, see: How to perform a "clean install" of Flash Player in Mac OS X

  • Inserting of transitions & text doesn't work !!

    I made my first iMovie film, reading very carefully the Help and Manual files.
    Up to now two things won't work !!! Inserting transitions or text in between the fragments doesn't work. I can select the transitions and text icons but when I draw them to paste, they won't fit or drop in the space between the fragments. Also the automatic insert of transitions doesn't work. The icon which should appear between the fragments doesn't work.
    Please Help !

    Up to now two things won't work Inserting transitions or text in between the fragments doesn't work.
    When you say "fragments" here, how long of a clip are you referring to as a fragment? Since most effects, transitions, and titles normally create an overlap of the preceding and succeeding segments, these segments or "fragments" do have a minimum length limitation for the insertion to take effect.

  • CommandButton doesn't work in JSF fragment?

    Hi all,
    Why commandButton doesn't work in JSF fragment? while I set partialSubmit as true!
    As following:
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    xmlns:h="http://java.sun.com/jsf/html">
    <af:inputText label="Your Name" id="it1"/>
    <af:inputDate label="BirthDate" id="id1"/>
    <af:commandButton partialSubmit="true" text="Calculate Age" id="cb1"/>
    <af:outputText id="ot1"/>
    </jsp:root>
    Thanks in advance :)))

    The full jsff code is:
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    xmlns:h="http://java.sun.com/jsf/html">
    <af:inputText label="Your Name" id="it1" binding="#{fragment_bean.it1}"/>
    <af:inputDate label="BirthDate" id="id1" binding="#{fragment_bean.id1}"/>
    <af:commandButton partialSubmit="true" text="Calculate Age" id="cb1"
    binding="#{fragment_bean.cb1}"
    action="#{fragment_bean.cb1_action}"/>
    <af:outputText id="ot1" partialTriggers="cb1" value="test"
    binding="#{fragment_bean.ot1}"/>
    <!--oracle-jdev-comment:auto-binding-backing-bean-name:fragment_bean-->
    </jsp:root>
    Java Bean is generated using "Auto Bind" feature in Jdeveloper 11.1.1.3.0:
    public class fragment_bean {
    private RichOutputText ot1;
    private RichCommandButton cb1;
    private RichInputDate id1;
    private RichInputText it1;
    public fragment_bean() {
    public void setOt1(RichOutputText ot1) {
    this.ot1 = ot1;
    public RichOutputText getOt1() {
    return ot1;
    public void setCb1(RichCommandButton cb1) {
    this.cb1 = cb1;
    public RichCommandButton getCb1() {
    return cb1;
    public void setId1(RichInputDate id1) {
    this.id1 = id1;
    public RichInputDate getId1() {
    return id1;
    public void setIt1(RichInputText it1) {
    this.it1 = it1;
    public RichInputText getIt1() {
    return it1;
    public String cb1_action() {
    // Add event code here...
    System.out.println("Hi test !!!");
    return null;
    }

  • Changing form components by selectOneMenu - so easy, but doesn't work

    Hi,
    I have silly problem that makes me crazy: I have a little form and I want to change content of all components dependent on my choice made in selectOneMenu. But it doesn't work like it's supposed to in logical way. For instance I have a selectOneRadio component in which I want to display a proper radio marked dependent on my choice in selectOneMenu. So I am setting Radio's 'rodzaj' bean property (Integer) in the valueChangeListener (idZmWart) of Select element to the chosen value. Bean is updated, but no effect on the page at all, no matter of Select's choice. Am I completely misunderstanding JSF lifecycle (studied many times) or it's just a very stupid mistake?
    Code is below:
    code fragment in jsp page:
    <f:view>
      <h:form>
         <h:selectOneMenu id="wyborId" value="#{Backingbean.id}"
                       valueChangeListener="#{Backingbean.idZmWart}"
                       onchange="submit()">                                  
             <f:selectItems value="#{Backingbean.listaId}" />              
         </h:selectOneMenu>
        <h:selectOneRadio id="wyborRodzaj" value="#{Backingbean.rodzaj}"
                      valueChangeListener="#{Backingbean.rodzajZmWart}"
                      onchange="submit()">
             <f:selectItems value="#{Backingbean.listaRodzaj}"/> 
        </h:selectOneRadio>                              
       <h:commandButton value="button" action="#{Backingbean.button_action}" />                               
    </h:form>
    </f:view>Backingbean code:
    package com.jsf;
    import java.util.ArrayList;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ValueChangeEvent;
    import javax.faces.model.SelectItem;
    public class Backingbean {
       public Backingbean() {
       public String button_action()
          setRodzaj(getId());                
          return "success";
       private Integer id = new Integer(1);
       public Integer getId() {
          return id;
       public void setId(Integer id) {
          this.id = id;
       public void idZmWart(ValueChangeEvent ev) {
          if (ev.getNewValue() != null){
             Integer i = (Integer) ev.getNewValue();
             setRodzaj(i);          
       private ArrayList listaId = new ArrayList();
       public ArrayList getListaId() {     
          ArrayList tmpLista = new ArrayList();
          for (int j=1; j<5; j++) {
             Integer i = new Integer(j);           
             SelectItem si = new SelectItem(i, i.toString());           
             tmpLista.add(si);                    
          listaId = tmpLista;
          return listaId;
       public void setListaId(ArrayList listaId) {
          this.listaId = listaId;
       private Integer rodzaj = new Integer(1);
       public Integer getRodzaj() {
          return rodzaj;
       public void setRodzaj(Integer rodzaj) {
          this.rodzaj = rodzaj;
       private SelectItem[] listaRodzaj = {
          new SelectItem(new Integer(1), "przedmiot"), //value, label
          new SelectItem(new Integer(2), "pracownik"),     
          new SelectItem(new Integer(3), "strona"),     
          new SelectItem(new Integer(4), "menu"),     
       public SelectItem[] getListaRodzaj() {
          return listaRodzaj;     
       public void setListaRodzaj(SelectItem[] listaRodzaj) {
          this.listaRodzaj = listaRodzaj;
       public void rodzajZmWart(ValueChangeEvent ev) {
          if (ev.getNewValue() != null) {
             String sRodzaj = ev.getNewValue().toString();        
    }And fragment of faces-config.xml - in one of the many shapes I've tried
    <managed-bean>
       <managed-bean-name>Backingbean</managed-bean-name>
       <managed-bean-class>com.jsf.Backingbean</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
       <managed-property>listaId</managed-property>
    </managed-bean>
    <managed-bean>
       <managed-bean-name>listaId</managed-bean-name>
       <managed-bean-class>java.util.ArrayList</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>  
    </managed-bean>Thanks for any reply. Regards,
    savage82

    Yeh sorry the points are not linked so you either can do 1 or 2 or 3
    With 3)
    You would have to bind all the components that get updated by your value changed listeners to your backing bean (using the binding attribute)
    And in your value changed listeners you would call the .setValue() on the components whose variable values changed during the value changed code. When your finished you would call the .renderResponse(). The reason this works is that a straight call to .renderResposne() it seems JSF does something funny, it should call the getters() of your variables then use these values and call the .setValue() on your components. But it doesn�t so instead you call the .setValue() yourself. The problem is you have to update every component potentially allot of work
    point 2 is an easy solution
    from my blog
    public void changeMethod(ValueChangeEvent event)
    PhaseId phaseId = event.getPhaseId();
    String oldValue = (String) event.getOldValue();
    String newValue = (String) event.getNewValue();
    if (phaseId.equals(PhaseId.ANY_PHASE))
    event.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
    event.queue();
    else if (phaseId.equals(PhaseId.UPDATE_MODEL_VALUES))
    // do you method here
    }what this does the changeMethod will get called twice. First off it gets called when it is meant to during validation phase. So we catch this call in our if statment then we queue the value changed event until the update model phase. So then when the update model phase is called your value changed event will be fired again. Basically this just moves the value changed code after the setters are called. That way any changes you make to your component values in your value change code will not be overwritten by the setters.
    point 1)
    Sorry forgot to add you may need renderResponse() after navigation rule (should test this)
    using the navigation rule well i dont exactly understand why this works. But my educated guess is using a navigation rule forces jsf to recreate the view i.e. the component tree is lost so the values you change in your value changed listeners will be reflected in your components as the components get recreated with the changed variables values.
    So take the above code
    and replace // do you method here
    with whatever your value changed code would be
    This is possibly a bad solution not exactly sure the performance hit you would take on this one i have never noticed any problems with my system but never benched marked it either.

Maybe you are looking for