Modifying component tree after validation failures

I'm reworking a JSF web app to use JSF's validation capabilities. As it is now, the validation all occurs in various action methods, during the invoke application phase. I volunteered to do this update to separate the business processing code from the data validation code as well as take advantage of the fact that using JSF validation guarantees that the data in the model won't be updated unless the user data is valid.
So, I've run into one thing that I can't figure out how to accomplish using JSF's validation capabilities.
Here's the old form...
<!-- CITY -->
<h:inputText id="city" value="#{userDetailsBean.city}" rendered="#{userDetailsHandler.showCityInput}"/>
<h:selectOneMenu id="cityFromList" value="#{userDetailsBean.city}" rendered="#{userDetailsHandler.showCityList}">
    <f:selectItems value="#{userDetailsHandler.cityDropList}"/>
</h:selectOneMenu>
<!-- STATE -->
<h:selectOneMenu id="state" value="#{userDetailsBean.state}">
    <f:selectItem itemValue="#{null}" itemLabel=""/>
    <f:selectItems value="#{userDetailsHandler.statesList}"/>
</h:selectOneMenu>
<!-- ZIP -->
<h:inputText id="zipCode" value="#{userDetailsBean.zipCode}"/>Note that there are two components representing the city. When the form is first presented, the inputText is shown. Then, if the address doesn't validate, we present the selectOneMenu after filling userDetailsHandler.cityDropList with the appropriate city options (based on the zipcode).
So, can anybody think of a good way (from within a custom JSF validator) to set the appropriate properties in userDetailsHander in order to make the selectOneMenu render and show the proper options? Feel free to suggest a change in architecture as well. I'm not stuck on using this userDetailsHandler that was previously in use.
I figure I could always right a custom validator that takes in a bean as an attribute in the tag and the bean. On a validation error, the validator could then setup the appropriate properties in the bean. This just seams a little hacky.
By the way, the validator will probably be written to take in the names of the city, state, and zip components. I'm following the multi-component validator idea that is presented in Core Java ServerFaces, 2nd Edition. (The validator takes in the component names, which it uses to get the local values, then performs multi-component validation work.) I guess I could pass both the cityTextInput and cityListInput components into the validator, right?

Here's what I have so far for my validator's validate() method. Some stuff has been omitted to make this a smaller code chunk. I've attached this validator to the zip component.
public void validate(FacesContext facesCtx, UIComponent uiComponent, Object value)
               throws ValidatorException {
    // get a handle to the other components
    // city
    UIComponent cityTextComp = uiComponent.getParent().findComponent(cityTextComponent);
    EditableValueHolder cityValHolder = (EditableValueHolder) cityTextComp;
    // state
    UIComponent stateComp = uiComponent.getParent().findComponent(stateComponent);
    EditableValueHolder stateValHolder = (EditableValueHolder) stateComp;
    String city  = (String) cityValHolder.getLocalValue();
    String state = (String)stateValHolder.getLocalValue();
    String zip   = (String) value;
    System.out.println("Validating " + city + ", " + state + " " + zip);
    boolean isValid = GenericValidator.validateAddress(city, state, zip);
    if (isValid) return;
    // assume this is an invalid city for the zipcode given
    // I've removed the code for the other possibilities since it
    // doesn't pertain to my issue here
    // Setup the city list
    UIComponent cityListComp = uiComponent.getParent().findComponent(cityListComponent);
    UISelectOne cityListSelectOne = (UISelectOne) cityListComp;
    List<String> cities = GenericValidator.listCitiesForZip(zip);
    // add the appropriate items to the selectOneMenu
    for (String c: cities) {
    // WHAT DO I DO HERE?
    cityListComp.setRendered(true);
    cityTextComp.setRendered(false);
    // now signal a validation exception
    FacesMessage msg = <some faces message>;
    throw new ValidatorException(msg);
}If I can just figure out how to add the appropriate items to the h:selectOneMenu from within the validator code I presented, I'm home free, I think.

Similar Messages

  • Refresh of Master/Detail does not work after validation failure

    After page validation stops further page processing of a Master Detail page,  I get the following Oracle Error on display of the Detail portion :
    <code>
    ORA:01445: Cannot select ROWID from, or sample, a join view without a key preserved table.
    ORA-06510 - PL/SQL unhandled user-defined exception.
    </code>
    Any clues as to why this might occur?  The Master portion of the page displays fine along with the appropriate custom validation error message. It is just the detail portion (from a SQL based report) that is causing the problem.  I do not use a ROWID either! 
    Thanks!

    Just an FYI for everybody who may have this very same problem in the future.  I fixed the error and it had nothing to do with ROWID or views or anything like that.  Under the Page Rendering section where you define the region definition under the source section, I had included the 'order by' clause in my SQL statement.  This was the cause of my ORA-01445 error!  When I removed the clause from the source definition and instead included it within the Report Attributes by checking the Sort box for the appropriate column (thus allowing APEX to generate the sort for me), the error disappeared!  The Oracle error message would NEVER have given me a clue into what caused the error.  I just happened to think 'what if I take the order by clause out'!  How's that for a flukey fix! 

  • Clear Item Cache after validation failure

    Hi Guys,
    I have a page validation that fires when two items (P6_LOCATOR_ID & P6_NEW_LOCATION) are equal which is working OK.
    The field validation is on the P6_NEW_LOCATION field.
    When this validation is true, I want the validation message to appear as it is now, but I want the P6_NEW_LOCATION to be reset to null or the cache for that item cleared.
    I cant run it as a page process after computations and validations because it never gets passed the validations to initiate. I have also tried creating a clear item cache process after the button that initiates the validation is pressed, but again that doesnt work.
    Can anyone think of another way that it can be done?
    Thanks
    Chris

    VC wrote:
    Cashy wrote:
    Thanks for that VC,
    I am getting following error now when it is running
    Error ERR-1002 Unable to find item ID for item "2" in application "195".
    I have set :P6_LOCATOR_ID and :P6_NEW_LOCATION = 2 as the test. When I try to set them both to other numbers i.e. 1,3,4 etc the same error message is returned with the item in the quotes changing for each.
    when you are setting the value use assignment operator
    :P6_NEW_LOCATION := 2
    I am guessing that it might have something to do with the page branching back to itself after the validation is fired?
    Thanks
    HI VC,
    Thanks for that. I am not setting the value of :P6_NEW_LOCATION programatically, I am just putting the value 2 into the field item and pressing the 'submit' button behind which the validation is running.
    Thanks for your help

  • Help!  After validation failure, Detail region of Master Detail page does not refresh.

    Hello.
    I am running a validation to prevent deletion of a purchase order (PO) when invoices exist for the PO.
    When the condition is found (invoices exist), the deletion process is halted and a message is posted to the page.
    I would like for both Master and Detail data of the PO to be refreshed.  However, only the Master
    record is refreshed.  I get the following error for the detail data:  The detail is found through the Master Header primary Key (DetailRecord.PO_ID = :P230_PO_ID )
    ORA:01445: Cannot select ROWID from, or sample, a join view without a key preserved table.
    ORA-06510 - PL/SQL unhandled user-defined exception.
    I'm not sure why this message should come up.  I do not clear cache or reset the page or anything like that.
    Any hints?

    Just an FYI for everybody who may have this very same problem in the future.  I fixed the error and it had nothing to do with ROWID or views or anything like that.  Under the Page Rendering section where you define the region definition under the source section, I had included the 'order by' clause in my SQL statement.  This was the cause of my ORA-01445 error!  When I removed the clause from the source definition and instead included it within the Report Attributes by checking the Sort box for the appropriate column (thus allowing APEX to generate the sort for me), the error disappeared!  The Oracle error message would NEVER have given me a clue into what caused the error.  I just happened to think 'what if I take the order by clause out'!  How's that for a flukey fix! 

  • Bug with validation or rendering after validation failure (?)

    Can anyone confirm the behaviour on other J2EE containers that I will describe below ?
    h2. Environment:
    JBoss 7.1.1 (Brontes)
    JDK 1.7.0_06 32-bit
    Win7 64-bit
    17:40:44,365 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-13) Initializing Mojarra 2.1.7-jbossorg-1 (20120227-1401)Below is the very simple test case:
    h2. 1) A very simple request-scoped bean:
    package test;
    import java.io.Serializable;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.RequestScoped;
    import javax.validation.constraints.NotNull;
    @ManagedBean
    @RequestScoped
    public class RequestBean implements Serializable {
         private static final long serialVersionUID = 1L;
         @NotNull(message="Input 1 is required")
         private String input1;
         @NotNull(message="Input 2 is required")
         private String input2;
         public String getInput1() {
              return input1;
         public String getInput2() {
              return input2;
         public void setInput1(String input1) {
              this.input1 = input1;
         public void setInput2(String input2) {
              this.input2 = input2;
    }h2. 2) A very simple test.xhtml page:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head></h:head>
    <body>
    <h:form>
           <h:panelGrid columns="2">
               Input 1: <h:inputText value="#{requestBean.input1}" />
               Input 2: <h:inputText value="#{requestBean.input2}" />
               <h:commandButton id="submit" value="Submit"/><br/>
               <h:messages/><br/>
           </h:panelGrid>
    </h:form>
    </body>
    </html>h2. 3. web.xml contents:
    <?xml version="1.0"?>
    <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <display-name>test</display-name>
      <context-param>
      <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</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>
    <!--
      <welcome-file-list>
        <welcome-file>index.html</welcome-file>
      </welcome-file-list>
    -->
    <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>
    <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.faces</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    </web-app>h2. 4. faces-config.xml contents:
    <?xml version="1.0" encoding="UTF-8"?>
    <faces-config
        xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"
         version="2.1">
    </faces-config>h2. 5. Contents of WEB-INF/lib:
    salvojo@AAS-AUD20901BL /cygdrive/c/jboss-as-7.1.1.Final/standalone
    $ ls -alt deployments/test.war/WEB-INF/lib/
    total 1384
    drwx------+ 1 Administrators Domain Users      0 Nov  2 17:40 ..
    drwx------+ 1 Administrators Domain Users      0 Nov  2 16:56 .
    -rwx------+ 1 Administrators Domain Users 393259 Nov  2 16:56 standard.jar
    -rwx------+ 1 Administrators Domain Users  21029 Nov  2 16:56 jstl.jar
    -rwx------+ 1 Administrators Domain Users  38015 Nov  2 16:56 commons-logging.jar
    -rwx------+ 1 Administrators Domain Users 139966 Nov  2 16:56 commons-digester.jar
    -rwx------+ 1 Administrators Domain Users 559366 Nov  2 16:56 commons-collections.jar
    -rwx------+ 1 Administrators Domain Users 188671 Nov  2 16:56 commons-beanutils.jar
    -rwx------+ 1 Administrators Domain Users  48742 Nov  2 16:56 common-annotations.jarh2. 6. The test case
    h4. 6.1 Open the test.jsf page with your browser
    h4. 6.2 Click on Submit WITHOUT specifying any values for both Input1 and Input2.
    Expected behaviour: Messages displayed that both input fields are required.
    Actual: As expected
    h4. 6.3 Supply values for both Input1 and Input2, then click Submit
    Expected behaviour: No validation messages displayed. Entered values remain in the input field
    Actual: As expected
    h4. 6.4 Remove input value for Input1, then click Submit
    Expected behaviour:
    Validation message that Input1 is required.
    Current value for Input1 remain blank.
    Previous value for Input2 remain in the input field.
    Actual: As expected
    h4. 6.5 Remove input value for Input2, then click Submit ( both Input fields are now blank )
    Expected behaviour:
    Validation message both input fields are required.
    Input value for Input1 remain blank.
    Input value for Input2 remain blank.
    h3. Actual ( NOT AS EXPECTED, see below )
    Validation message both input fields are required.
    Input value for Input1 remain blank.
    Input value for Input2 remain NON-blank. The previous value before it was blanked out and submitted is rendered / displayed on the page*

    gimbal2 wrote:
    jmsjr wrote:
    I thought I was going crazy !Why? You created proper test cases and you proved something was off. At that point you get realistic, not crazy.
    Perhaps you simply need to get it into your system to look for an issue tracker to see if something is known about it :)Yup. It is described in:
    http://java.net/jira/browse/JAVASERVERFACES-2262
    http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-939
    However, as mentioned here, I have now found a different issue as described in that JBoss forums when using the same EL expression / same bean property:
    in 1 inputText and 1 disabled inputText and 1 outputText or
    in 1 inputText and 1 disabled inputText or
    in 1 inputText and 1 outputText

  • Retain all form field values after input text field validation failure

    Hi,
    I have a form with 1 input text field, one Command button and one h:selectManyListbox. when User enteres some values in input field and clicks on command button named Add, the value is validated. If input is invalid, then an error message appears next to the field. If input is valid, then the value is added into h:selectManyListbox. Adding to list box is done using Ajax4Jsf.
    Probelm:
    Let's assume user entered 3 valid values one after another and all are added into the list box. When he enters a wrong value, and error message appears. however, the entered values in list box goes away. Is there a way to retain the values even after validation failure.
    Code is given below;
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
    <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
    <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
    <h:panelGroup>
         <h:outputLabel for="inputEmailId1" value="Email Id: " />
         <t:inputText value="#{bean.newEmailId}" id="inputEmailId1" maxlength="100" size="40" immediate="true">
              <t:validateEmail message="Enter a valid Email Id." />
         </t:inputText>
         <t:message for="inputEmailId1" styleClass="errorStyleClass" />
    </h:panelGroup>
    <t:panelGroup style="text-align: left;" >
         <a4j:commandButton value="Add" styleClass="buttonsSub" action="#{bean.addSharedEmails}"
              reRender="inputEmailId1, selectedSharedEmails" />
    </t:panelGroup>
    <t:panelGroup style="text-align: left;">
         <h:selectManyListbox id="selectedSharedEmails" size="8" style="width:100%;" immediate="true">
              <f:selectItems value="#{bean.sharedEmails}" />
         </h:selectManyListbox>
    </t:panelGroup>
    Thanks in advance,

    Use the attribute "binding" instead of a "value". This will remember the value. You can also make sure that you dont have anything in your constructor or class level that initialises that value to "" or null. Because if JSF is remembering your value but your initialization that gets triggered before the page loading resets it to default values then you need to change that part of the code.

  • How to modify a tree component dinamically

    Hi to everybody. I'm a problem with RichTree component when I try to run my application in jdeveloper 11g.
    In jsp page I have a RichInputText and a button component. When you click on the button, it modifies one String type variable: it stores the same value of RichInputText component.
    After that the applicatiion should show a tree that use the modified variable before, but when I click on the button an exception occurs:
    javax.faces.el.EvaluationException: java.lang.NullPointerException
         at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
         at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:458)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:763)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:640)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:275)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:175)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adf.share.http.ServletADFFilter.doFilter(ServletADFFilter.java:61)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:279)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:239)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:196)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:139)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:149)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: java.lang.NullPointerException
         at view.Tree_1.search(Tree_1.java:55)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
         at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
         at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
         ... 34 more
    I show the code in the following lines:
    Sense represents the tree nodes.
    ----------------------------------Sense.java
    public class Sense {
    private String _name = null;
    private List<Sense> _kids = null;
    public Sense(String name){
    setName(name);
    public String getName(){ return _name;}
    public void setName(String name){this._name = name;}
    public List<Sense> getKids(){ return _kids;}
    public void setKids(List<Sense> kids){this._kids = kids;}
    -----------------------------------Tree_1.java
    public class Tree_1{
    private Object _instance = null;
    private transient TreeModel _model = null;
    private String _key;
    private RichInputText inputText1;
    public RichInputText getInputText1(){return this.inputText1;}
    public void setInputText1(RichInputText inputText){
    this.inputText1 = inputText;
    public Tree_1() {
    ArrayList<Sense> root = new ArrayList<Sense>();
    Sense senso = new Sense(_key);
    root.add(senso);
    ArrayList<Sense> firstSon = new ArrayList<Sense>();
    Sense senso2 = new Sense(_key+"2");
    firstSon.add(senso2);
    senso.setKids(firstSon);
    this.setListInstance(root);
    public TreeModel getModel() throws IntrospectionException {
    if (_model == null) {
    model = new ChildPropertyTreeModel(instance, "kids");
    return _model;
    public void setListInstance(List instance) {
    _instance = instance;
    _model = null;
    public String search() {
    _key = inputText1.getValue().toString();
    return null;
    -------------------------------------SenseView.jsp
    <af:form>
    <af:inputText label="Label 1" id="inputText1"/>
    <af:commandButton text="commandButton 1" action="#{Tree_1.search}"/>
    <af:tree var="node" value="#{Tree_1.model}"
    inlineStyle="width:100%; height:100%;">
    <f:facet name="nodeStamp">
    <af:outputText value="#{node.name}" />
    </f:facet>
    <f:facet name="pathStamp"/>
    </af:tree>
    </af:form>
    Any ideas? thank's a lot

    Hi,
    what is the scope of the bean ? the command button performs a page reload after which the key is empty again
    Frank

  • Call a Javascritp function after a validation failure

    Hi all,
    I have a javascript function that is executed on page load. (it works fine)
    Now I need to call it after a validation failure
    How I can implement this call ?
    I am using Apex 4.0.2 and the inline notification, so the page load event is not fired
    which "activation" event can i use ?
    regards
    saverio
    Edited by: tirone on 17-giu-2011 9.00
    Edited by: tirone on 17-giu-2011 9.04

    Thank You Tyson for your quick replay,
    and .. I apologize me for mine bad English.
    My problem is that after a validation failure (with in line notification) the page load event IS NOT fired (in some case): so my script is not executed.
    I would like to execute this script however and I don't know where and how to call it.
    I give You more detail ......
    I'm working on a page that contain a tabular form; in this form, using my script (called "disable_field"), Ii set to read-only some fields.
    I call my script in "Execute when page load" section of page definition.
    If the validation failure is produced by an update of some records in my tabular form all is OK : the inline notification is shown, the page is re-loaded and my script is executed.
    If I add a new record and, after the submit, a validation fail, the page IS NOT reloaded (I don't know the why) and my script is not executed (so all fields are modifiable and this is not how much I want)
    I will appreciate very any help
    regards
    saverio

  • Modifying the component tree in FacesListener

    Hi,
    I want to modify the component tree of every page that is accessed within my JSF application. For example, say I want to remove one component(id is known) from every page that is accessed. Obviously, I don't want to edit the page manually.
    I wrote and configured a FacesListener which will be executed during the RESTORE_VIEW phase. In the afterPhase() method, I get the view root from FacesContext. I traverse down to the component with the given Id and remove it from its parents child list. But it doesn't get removed. The component is rendered. Even trying to chage its value or adding a new component doesn't work. Basically any modification done to the tree after the RESTORE_VIEW phase in the FacesListener is not reflected in the rendered output.
    Is it the right phase to modify the view?
    Thanks,
    Siva

    There is a typo in my question. I mean PhaseListener not FacesListener.
    Siva

  • Validation error corrupts component tree?

    I've got a strange problem trying to use validation on input fields.
    The basic setup is as follows:
    I've got a page divided into two parts with separate h:form tags, the one holding a dataTable with some elements and the other showing the element details in inputFields once an item is selected in the dataTable via a commandLink. A commandButton on the detail side allows you to update the values of the selected item which is being reflected in the dataTable on reload. So far so good.
    Here comes the strange part:
    All the inputFields are marked required. Now once you leave a field empty and try to submit the form, you get a validation error as expected. BUT if you now select a different element from the dataTable, ONLY the field whose validation formerly failed is being updated, the other fields still show the same value as before. The backing bean method that belongs to the commandLink is being executed, and the underlying data object of the input fields is being set properly, only the values in the component tree aren't updated. This behaviour persists until you enter a valid value in the formerly invalid input field and submit. Debugging shows that as long as at least one field has had validation errors, only the getter of these backing beans properties are being invoked during render response phase, as opposed to the "normal" case where the getters of all the backing beans properties are being called.
    For some reason, the render response phase seems to ignore the other components in the component tree when there was some validation error on one or more fields.
    Another interesting observation:
    This is the behaviour if I don't specify an action attribute in the commandLink selecting an element from the dataTable, as I want to return to the same page again. But if I define a navigation case that brings me to the same page and put that into the action attribute, the problem doesn't occur. Unfortunately this is no option for me, as I'm aiming to do all this with ajax.
    I've created a simple example so you can try out yourself:
    test.jsp:
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <html>
    <head>
    <title>validator test</title>
    </head>
    <body>
    <f:view>
         <h:form id="form1">
              <h:dataTable id="table" value="#{bean.datas}" var="data" binding="#{bean.table}" border="1">
                   <h:column>
                        <h:commandLink actionListener="#{bean.selectData}" value="#{data.string1}" />
                   </h:column>
                   <h:column>
                        <h:outputText value="#{data.string2}" />
                   </h:column>
              </h:dataTable>
              </h:form>
         <hr />
         <h:form id="form2">
              <h:inputText value="#{bean.data.string1}" id="field1" required="true" />
              <h:inputText value="#{bean.data.string2}" id="field2" required="true"/>
              <h:commandButton value="submit" />
         </h:form>
    </f:view>
    </body>
    </html>Bean.java:
    needs to be defined in faces-config.xml as bean "bean" with session scope
    import java.util.ArrayList;
    import java.util.List;
    import javax.faces.component.html.HtmlDataTable;
    import javax.faces.event.ActionEvent;
    public class Bean {
         private Data data;
         private List<Data> datas;
         private HtmlDataTable table;
         public Bean() {
              datas = new ArrayList<Data>();
              datas.add(new Data("data1value1","data1value2"));
              datas.add(new Data("data2value1",""));
         public void selectData(ActionEvent event) {
              data = (Data)table.getRowData();
         public List<Data> getDatas() {
              return datas;
         public Data getData() {
              return data;
         public void setData(Data data) {
              this.data = data;
         public HtmlDataTable getTable() {
              return table;
         public void setTable(HtmlDataTable table) {
              this.table = table;
         public class Data {
              private String string1;
              private String string2;
              public Data(String string1, String string2) {
                   this.string1 = string1;
                   this.string2 = string2;
              public String getString1() {
                   return string1;
              public void setString1(String value) {
                   string1 = value;
              public String getString2() {
                   return string2;
              public void setString2(String value) {
                   string2 = value;
    }My system setup:
    WinXP Professional
    JDK 1.6.0-b105
    Tomcat 5.5.20 (also tried 6.0.7)
    JSF RI 1.1.02_b08 (also tried 1.2_04-b10-p01, different but anyway not expected behaviour with MyFaces 1.1.5)
    Thanks for any input,
    Harry.

    Is there noone here who can tell me if this is behavior like specified or if I miss some point?
    A possible solution seems to be telling JSF programmatically to rebuild the view root. Does anyone if this is possible?

  • I was directed to adobe to download CS4 on my new iMAC after hardware failure on PC.  The valid CS4 serial number for the PC is not recognized by Adobe, even though I downloaded all the software successfully.  They gave me a free 30 day trial.........Does

    I was directed to adobe to download CS4 on my new iMAC after hardware failure on PC.  The valid CS4 serial number for the PC is now not recognized by Adobe, even though I downloaded all the software successfully on the new iMac..  They gave me a free 30 day trial on the new iMAC.........Does this mean I have to spend a lot of money to update and activate the latest CS release on the new machine ??????

    Purple Lobster your Creative Suite 4 serial number is for Windows or Mac only.  If you were previously using it on Windows then it is likely you have a Windows license.  You can verify by checking your serial number at http://www.adobe.com/.  You can find more details at Find your serial number quickly - http://helpx.adobe.com/x-productkb/global/find-serial-number.html.
    If you wish to run Adobe Creative software on your new iMac then I would recommend a Creative Cloud complete or single application membership.  You can find more details at https://creative.adobe.com/plans.  There is also a 30 day trial available for the Creative Cloud if you wish to evaluate the newest versions of the Adobe Creative applications.

  • How to get the handle of the Validation Failure Message Popups.

    Hi,
    I'm using Jdev 11.1.2.0
    I have added validation rule(less than system date) and failuremessage("date should not after currentdate") on the date field in EO.
    when I enter greated than the sysdate in date field in page, I'm getting validation failure message in a popup with ok button. its working good.
    but when i click on the popup ok button, the focus should go the date field again and it is higlighted.
    So, how to get the handle of the popup's ok buton? and how to highlight the datefield after clicking the popup's ok button?
    Any suggestion would be appreciated.
    thank you.

    if i understood correclty means,
    i hope that, error popup is provided by framework.. how could be possible? to catch the error popup ok button.
    am not well aware of catching the error popup which is provide by framework..
    but i had answer for your part of the question,
    if the condition go off false means you force the cursor into date field. this is can be done using 'javascript'. unless using script you can't do that. ADF doesnt provide any force focusing feature.
    please google how to focus the field.
    https://blogs.oracle.com/jdevotnharvest/entry/how_to_programmatically_set_focus
    http://technology.amis.nl/2008/01/04/adf-11g-rich-faces-focus-on-field-after-button-press-or-ppr-including-javascript-in-ppr-response-and-clientlisteners-client-side-programming-in-adf-faces-rich-client-components-part-2/
    http://lspatil25.blogspot.in/2012/04/adf-default-cursorfocus-to-input-field.html
    http://donatas.nicequestion.com/2012/04/component-to-set-initial-focus-in-adf.html

  • [svn:fx-trunk] 10459: Change to ensure ScriptNodes are no longer part of the node tree after interface compilation stage in order to avoid the extra code that was necessary to avoid tripping over them during type checking , etc.

    Revision: 10459
    Author:   [email protected]
    Date:     2009-09-21 08:42:44 -0700 (Mon, 21 Sep 2009)
    Log Message:
    Change to ensure ScriptNodes are no longer part of the node tree after interface compilation stage in order to avoid the extra code that was necessary to avoid tripping over them during type checking, etc.
    Improving revision 10199 a bit, to allow for single line comments.
    QE notes: None
    Doc notes: None
    Bugs: SDK-22027
    Reviewer: Paul
    Tests run: Checking, Compiler cyclones
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22027
    Modified Paths:
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/AbstractSyntaxTreeUtil.java
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/InterfaceCompiler.java
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/builder/AbstractBuilder.java
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/builder/DocumentBuilder.java

    In general theory, one now has the Edit button for their posts, until someone/anyone Replies to it. I've had Edit available for weeks, as opposed to the old forum's ~ 30 mins.
    That, however, is in theory. I've posted, and immediately seen something that needed editing, only to find NO Replies, yet the Edit button is no longer available, only seconds later. Still, in that same thread, I'd have the Edit button from older posts, to which there had also been no Replies even after several days/weeks. Found one that had to be over a month old, and Edit was still there.
    Do not know the why/how of this behavior. At first, I thought that maybe there WAS a Reply, that "ate" my Edit button, but had not Refreshed on my screen. Refresh still showed no Replies, just no Edit either. In those cases, I just Reply and mention the [Edit].
    Also, it seems that the buttons get very scrambled at times, and Refresh does not always clear that up. I end up clicking where I "think" the right button should be and hope for the best. Seems that when the buttons do bunch up they can appear at random around the page, often three atop one another, and maybe one way the heck out in left-field.
    While I'm on a role, it would be nice to be able to switch between Flattened and Threaded Views on the fly. Each has a use, and having to go to Options and then come back down to the thread is a very slow process. Jive is probably incapable of this, but I can dream.
    Hunt

  • During an update of the applications on the BlackBerry smartphone an error message may be displayed "BlackBerry Desktop Software failed to validate your BlackBerry device update - Aborting install due to validation failure. Some packages contained unsatis

    I have reset both my torch and playbook back to original only thing that I kept was my contact. And still problems I am a few min away from leave my loved blackberry and going android !! Or heaven help us Phone
    Issues 1) playbook wont connect to desktop manager anymore 
    2) Play book has 2 calendar icons with two different settings on them ??? I have one that is currently working with my yahoo email and calendar account. 
    3) my Phone when connected to desk top software shows the calendar as read only
    4) Unable to update my phone says During an update of the applications on the BlackBerry® smartphone an error message may be displayed "BlackBerry Desktop Software failed to validate your BlackBerry device update - Aborting install due to validation failure. Some packages contained unsatisfactory dependencies." 
    I just want my email and Calendars to work I am tried of spending nights trying to get these deices working !!! 
    someone please help me. !! 
    I know you are going to ask I have updated everything last time and it is all as update as it can get. 
    As for now as I wait I am going to wipe my phone again and just set everything up again !! If I have to even my contacts AHHHH Help I am starting to think crazy thoughts 

    Did you try to eboot the your PC or laptop where your device is connected ?
    I experienced this with my windows laptop, after a failed to do an update, I restart the laptop and my Torch, then retried, and it's worked

  • Trying to understand a WS-I validation failure

    I'm trying to understand the following WS-I validation failure message. I'm sure I'm making a basic mistake but I can't find an example of the use case where an xsd is imported. Can someone point out my error?
    Thanks,
    Bret
    Validation failure:
    Result failed:
    Failure Message: A QName reference that is referring to a schema component, uses a namespace not defined in the targetNamespace attribute on the xs:schema element, or in the namespace attribute on an xs:import element within the xs:schema element.Failure Detail Message:
    {http://Messages.xsd}SigReplyMessage,
    {http://schemas.xmlsoap.org/wsdl/}string,
    {http://Messages.xsd}SigRequestMessage
    Element Location: lineNumber=8
    My wsdl looks like this:
    <definitions targetNamespace="urn:S3SignatureGenerator"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:tns="urn:S3SignatureGenerator"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:messages="http://Messages.xsd">
    <types>
    <xsd:schema>
    <xsd:import id="Messages.xsd"
    schemaLocation="../../XSDDocument/Messages.xsd"
    namespace="http://Messages.xsd"/>
    </xsd:schema>
    </types>
    <message name="ReturnSignature">
    <part name="SigAndExp" type="messages:SigReplyMessage"/>
    </message>
    <message name="RequestSignature">
    <part name="Keys" type="messages:SigRequestMessage"/>
    </message>
    <portType name="SigGenerator">
    <operation name="GetSignature">
    <input message="tns:RequestSignature"/>
    <output message="tns:ReturnSignature"/>
    <fault name="sigFault" message="tns:SigFault"/>
    </operation>
    </portType>
    <message name="SigFault">
    <part name="faultMessage" element="string"/>
    </message>
    <binding name="SigGenSoapHttp" type="tns:SigGenerator">
    <soap:binding style="document"
    transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="GetSignature">
    <soap:operation soapAction="urn:S3SignatureGenerator/GetSignature"/>
    <input>
    <soap:body use="literal" parts="SecretKey PublicKey"/>
    </input>
    <output>
    <soap:body use="literal" parts="Signature"/>
    </output>
    <fault name="sigFault">
    <soap:body use="literal" parts="SecretKey PublicKey"/>
    </fault>
    </operation>
    </binding>
    <service name="SignatureGenerationService">
    <port name="SigGenSoapHttpPort" binding="tns:SigGenSoapHttp">
    <soap:address location="tbd"/>
    </port>
    </service>
    </definitions>
    Messages.xsd looks like this:
    <?xml version="1.0" encoding="windows-1252" ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://www.bret.org/S3test/Messages"
    targetNamespace="http://www.bret.org/S3test/Messages"
    elementFormDefault="qualified">
    <xsd:complexType name="sigRequestMessage">
    <xsd:sequence>
    <xsd:element name="publicKey" type="xsd:string"/>
    <xsd:element name="privateKey" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="sigReplyMessage">
    <xsd:sequence>
    <xsd:element name="Signature" type="xsd:string"/>
    <xsd:element name="expiration" type="xsd:dateTime"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>

    Hi Bret,
    Sorry it's taken me a bit of time to respond, but please find below a run-down of the WS-I related problems I spotted in your WSDL document. The first few are related to the import error you saw, and there's a few others that I'll also discuss. Apologies in advance if you've already spotted and corrected those.
    I'll use line numbering based on the formatting of the WSDL and XSD that you supplied.
    BP2417 (the one you asked about)
    The line number in the error is a red herring. There are two problems here:
    - WSDL document, line 29: You're using the XSD type string unqualified - it should be xsd:string.
    - WSDL document, lines 8 and 13; schema, lines 3 and 4: The namespaces you're using don't match. Either change the namespaces in the schema to be http://Messages.xsd, or change the namespaces in the WSDL to http://www.bret.org/S3test/Messages.
    BP2202
    You should declare UTF-8 or UTF-16 encoding when creating WSDL or schema documents. The easiest way to do this is to go to Tools|Preferences, and set JDeveloper's default encoding to either UTF-8 or UTF-16.
    BP2032
    WSDL document, line 26 and 43: The name attribute of the fault should read SigFault, not sigFault, as WSDL is case-sensitive.
    WSDL document, line 44: You should use a soap:fault element, not a soap:body element, to bind a fault, thus:
    <soap:fault name="SigFault" use="literal"/>
    BP2012
    WSDL document, lines 17 and 20: Message parts in a document-bound service like this one should reference XSD elements and not complexTypes. What you need to do is define two elements in your messages schema whose types are SigReplyMessage and SigRequestMessage respectively, and then reference those elements from the WSDL.
    WSDL document, line 38: The value of the parts attribute should be Keys to match the name of the part child of the RequestSignature.
    WSDL document, line 41: The value of the parts attribute should be SigAndExp to match the name of the part child of the ReturnSignature.
    WSDL document, line 44: The value of the parts attribute should be faultMessage to match the name of the part child of the SigFault.
    BP2115
    WSDL document, lines 17 and 20: The names of the elements should be sigReplyMessage and sigRequestMessage and not SigReplyMessage and SigRequestMessage, again because WSDL is case-sensitive.
    WSDL document, line 30: The element attribute of the part references xsd:string, which is not an element but a complexType. You'll need to add an element declaration to your schema, which is of type xsd:string.
    I've included corrected versions of your WSDL and schema below, I hope this helps. I also note you've posted a few other messages related to WS-I and WSDL, I hope I've managed to cover those in this message too.
    Regards,
    Alan.
    WSDL:
    <?xml version="1.0" encoding="UTF-8" ?>
    <definitions targetNamespace="urn:S3SignatureGenerator"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:tns="urn:S3SignatureGenerator"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:messages="http://Messages.xsd">
    <types>
    <xsd:schema>
    <xsd:import id="Messages.xsd"
    schemaLocation="Messages.xsd"
    namespace="http://Messages.xsd"/>
    </xsd:schema>
    </types>
    <message name="ReturnSignature">
    <part name="SigAndExp" element="messages:sigReplyMessage"/>
    </message>
    <message name="RequestSignature">
    <part name="Keys" element="messages:sigRequestMessage"/>
    </message>
    <message name="SigFault">
    <part name="faultMessage" element="messages:faultMessage"/>
    </message>
    <portType name="SigGenerator">
    <operation name="GetSignature">
    <input message="tns:RequestSignature"/>
    <output message="tns:ReturnSignature"/>
    <fault name="SigFault" message="tns:SigFault"/>
    </operation>
    </portType>
    <binding name="SigGenSoapHttp" type="tns:SigGenerator">
    <soap:binding style="document"
    transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="GetSignature">
    <soap:operation soapAction="urn:S3SignatureGenerator/GetSignature"/>
    <input>
    <soap:body use="literal" parts="Keys"/>
    </input>
    <output>
    <soap:body use="literal" parts="SigAndExp"/>
    </output>
    <fault name="SigFault">
    <soap:fault name="SigFault" use="literal"/>
    </fault>
    </operation>
    </binding>
    <service name="SignatureGenerationService">
    <port name="SigGenSoapHttpPort" binding="tns:SigGenSoapHttp">
    <soap:address location="tbd"/>
    </port>
    </service>
    </definitions>
    Schema:
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://Messages.xsd"
    targetNamespace="http://Messages.xsd"
    elementFormDefault="qualified">
    <xsd:element name="sigRequestMessage">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="publicKey" type="xsd:string"/>
    <xsd:element name="privateKey" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="sigReplyMessage">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="Signature" type="xsd:string"/>
    <xsd:element name="expiration" type="xsd:dateTime"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="faultMessage" type="xsd:string"/>
    </xsd:schema>

Maybe you are looking for

  • SPOOL_INTERNAL_ERROR spool overflow when submitting the same program

    I am submitting the same program via job with different seletion screen values after JOB_OPEN, and then SUBMIT statement and JOB_CLOSE FM. But this job get cancelled with message "ABAP/4 processor: SPOOL_INTERNAL_ERROR" . The submit is as follows: SU

  • Error message "ImporterProcessServer.exe has stopped working"

    I imported DVD files into CS4 as MPEG2s as when I converted the DVD footage received from a client as avi files they totaled almost 300 Gigs! and that was only for 5 short DVDs of horse show footage. Anyway, imported one of the mpgs and cut out foota

  • Unable to Export columnGroupHeaders from AdvancedTable.

    Unable to fetch the columnGroup Header Labels when trying to export the data from the AdvancedTable. Able to view all the data with their respective column headers but unable to get the columnGroupHeader. Can anybody suggest me how to proceed further

  • How to Create an InterfacePtr from UIDRef??

    Hi.. i have an UIDRef of an object. I want to create an Interface from that UIDRef. Someone please demonstrate me with a snippet.. thanks.

  • Changing a portal user's password programatically

    Hi, I'm attempting to reset a user's password, and so far i got it to work once using: update wwsec_person$ set password = wwsso_utl.hash_pwd('PASSWORD') where user_name='USER' after running that statement and committing, the password seemed to chang