Catching validation errors

I want to put validation logic inside a setter method of an entity object. Where can I catch exceptions raised inside setter methods? I would like to have something like this:
public class MyEntityImpl extends EntityImpl
public static final int EMAIL = 0;
public void setEmail(String value) throws oracle.jbo.JboException
     boolean isValid =true;
          validation logic
if(isValid) setAttributeInternal(EMAIL, value);
else{
     throw new oracle.jbo.JboException(″An email address must be ...″);
Where do I catch oracle.jbo.JboException?
Where can I catch oracle.jbo.AttrValException: JBO-27014: Attribute ... is required ?
Is there another way to include validation?

Hi,
look at entity object wizard.
There you will find a section for validation.
You can set validation for a whole entity object or for one attribute (either set validation in declarative or in a programmatic way).
Have a look at the brilliant BC4JToyStore example by Steven Muench as well, how EO validation is handled.
Hope, that helps.
Stefan

Similar Messages

  • Catch validation error in proxy

    Hi Expert,
    I have a proxy to file scenario. I chose "Validation by Integration Engine" in my sender agreement to validate the data. I know I can check the error detail in SXMB_MONI. But how I can catch the error in my ABAP program which calls the outbound proxy?I see this blog:  SAP XI/PI: Alerts for Queue Errors  said I can set alert and catch it in ABAP program. I tried to use ALRTCATDEF in ECC side in which proxy exists. But I am told I don't have authorization. I tried it in PI. I see I can do it. Does this Alert Configuration can be done in ECC side as well? I want to make sure before I ask for authorization. Once I set up Alert configuration in ECC side, how I can catch the validation error in my ABAP program after calling the proxy?
    Thanks a lot!
    Charles

    Hi Greg,
    Thanks for response. However I did "Commit work"(see below coding).
    TRY.
          CREATE OBJECT lo_proxy.
          lo_async_messaging ?=
          lo_proxy->get_protocol( if_wsprotocol=>async_messaging ).
          lo_async_messaging->set_serialization_context('TS0000731_ORDER').
          l_ack_request =  if_wsprotocol_async_messaging=>co_transport_acknowledgment.
         lo_async_messaging->set_acknowledgment_requested( l_ack_request ).
          CALL METHOD lo_proxy->si_ob_dmplanningsalesorder(
            output = ls_msgtype
         lo_msg_id_protocol ?= lo_proxy->get_protocol( if_wsprotocol=>message_id ).
          l_msg_id = lo_msg_id_protocol->get_message_id( ).
          COMMIT WORK.
    * read ack
          lo_ack = cl_proxy_access=>get_acknowledgment( l_msg_id ).
         l_ack_status_simple = lo_ack->get_status( ).
        CATCH cx_ai_system_fault INTO lo_fault.
          CALL METHOD lo_fault->if_message~get_text
            RECEIVING
              result = lv_error.
          IF lv_error IS NOT INITIAL.
            MOVE lv_error TO e_error_message.
          ENDIF.
      ENDTRY.
    I don't know if that is because I set_serialization_context. The message was not sent out automatically. It was waiting in the queue. Then I registered the QUEUE. But still can't sent automatically. It even stopped all my queue even registered ones. Now everything stopped sending out automatically, no matter registered or not.
    Do you know what caused this issue?
    Thanks a lot!
    Charles

  • Catch all error information while validating xml content with xsd schema

    Hi experts,
    I created a java mapping to validating the input xml content with xsd schema (schema validation). What I want is to catch all error message to the xml not just the first error. I used SAXParser in sapxmltoolkit.jar to do the schema validation. The below is a part of my java mapping.
    XMLReader parser = XMLReaderFactory.createXMLReader("com.sap.engine.lib.xml.parser.SAXParser");
    parser.setFeature( "http://xml.org/sax/features/validation" ,  true);
    parser.setFeature( "http://apache.org/xml/features/validation/schema" , true);
    parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");          parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",this.getClass().getClassLoader().getResourceAsStream(schema)); // schema is my schema name
    parser.setErrorHandler(new ParseErrorHandler()); // ParseErrorHandler is my own ErrorHandler which extends DefaultHandler
    parser.parse(new InputSource(new ByteArrayInputStream(sinput.getBytes())));
    // In error handler, I comment all code so as not to throw any exception
    public class ParseErrorHandler extends DefaultHandler
         public void error(SAXParseException e) throws SAXException
              // sSystem.out.println("Error" + e.getMessage());
              // throw e;
         public void fatalError(SAXParseException e)
              // throw e;
              // System.out.println("SAP Fatal Error" + e.getMessage());
    Unfortunately the program always stopped while catching the first error. Check the below log.
    com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException:
    ERRORS :
    cvc-simple-type : information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' is not valid, because it's value does not satisfy the constraints of facet 'minLength' with value '1'.
    cvc-data : information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' is is not valid with respoct to the corresponding simple type definition.
    cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' is associated with invalid data.
    cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]' is not valid with respect to it's complex type definition..
    cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]' is not valid with respect to it's complex type definition..
    cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]' is not valid with respect to it's complex type definition..
    cvc-element : element information item '/:ShipNotice[1]/:Header[1]' is not valid with respect to it's complex type definition..
    cvc-element : element information item '/:ShipNotice[1]' is not valid with respect to it's complex type definition..
    -> com.sap.engine.lib.xml.parser.ParserException:
    I tried using Xerces and JAXP to do validation, the same error happened. I have no idea on this. Does xi has its own error handler logic? Is there any body can make me get out of this?
    Thanks.

    <h6>Hi experts,
    <h6>
    <h6>I created a java mapping to validating the input xml content with xsd schema (schema validation). What I want is to catch all <h6>error message to the xml not just the first error. I used SAXParser in sapxmltoolkit.jar to do the schema validation. The below <h6>is a part of my java mapping.
    <h6>XMLReader parser = XMLReaderFactory.createXMLReader("com.sap.engine.lib.xml.parser.SAXParser");
    <h6>parser.setFeature( "http://xml.org/sax/features/validation" ,  true);
    <h6>parser.setFeature( "http://apache.org/xml/features/validation/schema" , true);
    <h6>parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");          <h6>parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",this.getClass().getClassLoader().getResourceAsStream(schema)); <h6>// schema is my schema name
    <h6>parser.setErrorHandler(new ParseErrorHandler()); // ParseErrorHandler is my own ErrorHandler which extends Default Handler
    <h6>parser.parse(new InputSource(new ByteArrayInputStream(sinput.getBytes())));
    <h6>
    <h6>// In error handler, I comment all code so as not to throw any exception
    <h6>public class ParseErrorHandler extends DefaultHandler
    <h6>{
    <h6>     public void error(SAXParseException e) throws SAXException
    <h6>     {
    <h6>          // sSystem.out.println("Error" + e.getMessage());
    <h6>          // throw e;
    <h6>     }
    <h6>
    <h6>     public void fatalError(SAXParseException e)
    <h6>     {
    <h6>          // throw e;
    <h6>          // System.out.println("SAP Fatal Error" + e.getMessage());
    <h6>
    <h6>     }
    <h6>
    <h6>}
    <h6>
    <h6>Unfortunately the program always stopped while catching the first error. Check the below log.
    <h6>
    <h6>com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException:
    <h6>ERRORS :
    <h6>cvc-simple-type : information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' <h6>is not valid, because it's value does not satisfy the constraints of facet 'minLength' with value '1'.
    <h6>cvc-data : information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' <h6>is is not valid with respoct to the corresponding simple type definition.
    <h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' <h6>is associated with invalid data.
    <h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]' <h6>is not valid with respect to it's complex type definition..
    <h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]' <h6>is not valid with respect to it's complex type definition..
    <h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]' <h6>is not valid with respect to it's complex type definition..
    <h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]' <h6>is not valid with respect to it's complex type definition..
    <h6>cvc-element : element information item '/:ShipNotice[1]' is not valid with <h6>respect to it's complex type definition..
    <h6> -> com.sap.engine.lib.xml.parser.ParserException:
    <h6>
    <h6>
    <h6>I tried using Xerces and JAXP to do validation, the same error happened. I have no idea on this. Does xi has its own error <h6>handler logic? Is there any body can make me get out of this?
    <h6>Thanks.

  • Popup closing even with validation errors in IE - works correctly in FF

    Hi,
    Using JDeveloper 11.1.1.4.
    We have a page where the user can upload files via a popup. After selecting the file to upload and submitting, the file type and size are validated against application parameters. If the validation fails, the inputFile component is set invalid and a ValidationException is thrown. In Firefox, the functionality is as expected: the popup stays open and the validation error message is displayed next to the inputFile component. In Internet Explorer, however, the popup closes without any error being displayed.
    Popup:
    <af:popup id="pt_fileUploadPopUp" contentDelivery="lazyUncached"
                            binding="#{FileUploadOperations.uploadFormPopup}">
    <af:inputFile label="#{UC1315ResourceBundle['L1336']} "
                                      id="pt_i3f1"
                                      value="#{FileUploadOperations.uploadedFile}"
                                      requiredMessageDetail="#{UC1315ResourceBundle['REQ_MSG_FILE_UPLOAD']}"
                                      validator="#{FileUploadOperations.validateFile}"
                                      required="true"/>
    <af:commandButton id="pt_CB_2001"
                                                text="#{UC1315ResourceBundle['BUTTON_2007']}"
                                                actionListener="#{FileUploadOperations.uploadFile}"
                                                partialSubmit="true"
                                                disabled="#{pageFlowScope.pApplicationMode == 'PREVIEW'}"/>
    </af:popup>Validator method:
        public void validateFile(FacesContext facesContext,
                                 UIComponent uIComponent, Object object) {
                try {
                    // validation logic
                } catch (CustomFileUploadException exp) {
                    inputFileComponent.resetValue();
                    inputFileComponent.setValid(false);
                    FacesMessage facesErrorMessage = new FacesMessage();
                    facesErrorMessage.setSeverity(FacesMessage.SEVERITY_ERROR);
                    facesErrorMessage.setDetail(exp.getMessage());
                    facesErrorMessage.setSummary(exp.getMessage());
                    throw new ValidatorException(facesErrorMessage);
        }Any ideas what might be the problem here?
    Thanks,
    Joonas

    @Srinivas, I changed the component inside the popup to af:dialog (was af:panelWindow before) but this didn't solve the problem - the behavior is the same. Thanks for the suggestion though.
    @Frank, seems this problem is implementation-specific. I created a simple test case and the validation error was displayed correctly in IE.

  • How to deal with validation errors from DAO layer.

    I have been pondering on how to deal with validation errors from DAO layer.
    Lets say you have a DAO that can save a car object. A car has a year, make, model, vin and so on. During the save operation of this DAO, it validates the car attributes to see if they pass some business rules. If it does not it throws some validation exception that contains all the validation errors. These validation errors know nothing about jsf or my components it just knows what attributes on the object are invalid and why.
    If I just want to show those errors at the top of the page that would be no problem I could just create some FacesMessage objects and add them to the FacesContext messages. But if the DAO layer is telling me that the make attribute is invalid it would be nice to map it to the make field on the screen. I am wondering if any of you have tackled this problem or have some ideas on how to tackle it?
    Brian

    Let it throw an exception with a self explaining message, then catch it and embed that message in a FacesMessage.
    Or let it throw more specific exception types (InvalidCarMakeException extends CarDAOException and so on) and let JSF handle it with own FacesMessage message.

  • Can SOA 11g fault policy handle XSD Validation errors from the Mediator?

    I would like all errors in my SOA process to go through the fault-policies.xml. But I don't seem to be able to catch any mediator error caused by an XSD validation failure. A sample of the sort of error I am trying to 'catch' is:
    Nonrecoverable System Fault          oracle.tip.mediator.infra.exception.MediatorException: ORAMED-01303:[Payload default schema validation error]XSD schema validation fails with error Invalid text 'A' in element: 'TermCode'Possible Fix:Fix payload and resubmit.
    My fault-policies.xml file is as follows:
    <?xml version="1.0" encoding="UTF-8" ?>
    <faultPolicies xmlns="http://schemas.oracle.com/bpel/faultpolicy">
    <faultPolicy version="2.0.1"
         id="NewStudentRegistrationFaults"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns="http://schemas.oracle.com/bpel/faultpolicy"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Conditions>
    <faultName xmlns:medns="http://schemas.oracle.com/mediator/faults" name="medns:1303">
    <condition>
    <action ref="java-fault-handler"/>
    </condition>
    </faultName>
    <faultName xmlns:rjm="http://schemas.oracle.com/sca/rejectedmessages" name="rjm:GetNewStudentRegistrationFile">
    <condition>
    <action ref="java-fault-handler"/>
    </condition>
    </faultName>
    <faultName xmlns:medns="http://schemas.oracle.com/mediator/faults" name="medns:TYPE_ALL">
    <condition>
    <action ref="java-fault-handler"/>
    </condition>
    </faultName>
    <faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension" name="bpelx:mediatorException">
    <condition>
    <action ref="java-fault-handler"/>
    </condition>
    </faultName>
    <faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension" name="bpelx:bindingFault">
    <condition>
    <action ref="java-fault-handler"/>
    </condition>
    </faultName>
    <faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension" name="bpelx:remoteFault">
    <condition>
    <action ref="java-fault-handler"/>
    </condition>
    </faultName>
    </Conditions>
    <Actions>
    <Action id="java-fault-handler">
    <javaAction className="edu.villanova.soa.handlers.FaultNotificationHandler"
    defaultAction="ora-human-intervention" propertySet="faultNotificationProps">
    <returnValue value="OK" ref="ora-human-intervention"/>
    </javaAction>
    </Action>
    <!-- Human Intervention -->
    <Action id="ora-human-intervention">
    <humanIntervention/>
    </Action>
    <!-- Terminate -->
    <Action id="ora-terminate">
    <abort/>
    </Action>
    </Actions>
    <!-- Property sets used by custom Java actions -->
    <Properties>
    <!-- Property set for FaultNotificationHandler customer java action -->
    <propertySet name="faultNotificationProps">
    <property name="from">[email protected]</property>
    <property name="to">[email protected]</property>
    <property name="subject">Reporting a SOA fault</property>
    </propertySet>
    </Properties>
    </faultPolicy>
    <faultPolicy version="2.0.1"
         id="MediatorFaults"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns="http://schemas.oracle.com/bpel/faultpolicy"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Conditions>
    <faultName xmlns:medns="http://schemas.oracle.com/mediator/faults" name="medns:1303">
    <condition>
    <action ref="java-fault-handler"/>
    </condition>
    </faultName>
    </Conditions>
    <Actions>
    <Action id="java-fault-handler">
    <javaAction className="edu.villanova.soa.handlers.FaultNotificationHandler"
    defaultAction="ora-human-intervention" propertySet="faultNotificationProps">
    <returnValue value="OK" ref="ora-human-intervention"/>
    </javaAction>
    </Action>
    <!-- Human Intervention -->
    <Action id="ora-human-intervention">
    <humanIntervention/>
    </Action>
    <!-- Terminate -->
    <Action id="ora-terminate">
    <abort/>
    </Action>
    </Actions>
    <!-- Property sets used by custom Java actions -->
    <Properties>
    <!-- Property set for FaultNotificationHandler customer java action -->
    <propertySet name="faultNotificationProps">
    <property name="from">[email protected]</property>
    <property name="to">[email protected]</property>
    <property name="subject">Reporting a SOA rejected msg. fault</property>
    </propertySet>
    </Properties>
    </faultPolicy>
    </faultPolicies>
    My fault-bindings.xml file is as follows:
    <?xml version="1.0" encoding="UTF-8" ?>
    <faultPolicyBindings version="2.0.1"
    xmlns="http://schemas.oracle.com/bpel/faultpolicy"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <composite faultPolicy="NewStudentRegistrationFaults"/>
    <component faultPolicy="MediatorFaults">
    <name>NewStudentRegistrationMediator</name>
    </component>
    <service faultPolicy="NewStudentRegistrationFaults">
    <name>GetNewStudentRegistrationFile</name>
    </service>
    </faultPolicyBindings>
    You'll notice that I've tried a number of ways (and various other combinations) to try to steer the error above into my Java fault handler but nothing has meet with success. The mplan is as follows:
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <!--Generated by Oracle SOA Modeler version 1.0 at [2/3/10 1:21 PM].-->
    <Mediator name="NewStudentRegistationMediator" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.oracle.com/sca/1.0/mediator"
    wsdlTargetNamespace="http://xmlns.oracle.com/pcbpel/adapter/ftp/Experiments/NewStudentRegistration/GetNewStudentRegistrationFile%2F">
    <operation name="Get" deliveryPolicy="AllOrNothing" priority="4"
    validateSchema="true">
    <switch>
    <case executionType="queued" name="RegToBanner.insert_2">
    <action>
    <transform>
    <part name="$out.NewstudentregistrationCollection"
    function="xslt(xsl/NewStudentRegistration_To_NewstudentregistrationCollection.xsl, $in.body)"/>
    </transform>
    <invoke reference="RegToBanner" operation="insert"/>
    </action>
    </case>
    </switch>
    </operation>
    </Mediator>
    I'm a newbie to Oracle SOA. So perhaps I am missing the obvious. But I haven't read much in the documentation specifically about using the XSD validation option on the mediator and have seen nothing specifically about catching this sort of exception in the fault policy (apart from the faults I already have in my policy). Can anyone suggest what I am doing incorrectly here or perhaps whether what I am attempting to do is not possible? Thanks.
    - Cris

    Has anyone got it working yet?
    In my case, I have the following sequence:
    FileAdapter -> Mediator1 -> Mediator2->DB Adapter
    I am deliberately introducing validation error in File. Isn't it correct to assume Fault framework would get triggered at Mediator1 level since we are invoking FileAdapter service?
    I am getting a strange behaviour. If I enable XSD validation at Mediator1 level, process is Faulted with no re-try option. However, if I enable XSD validation ONLY at Mediator2 level, I get Recoverable fault. There seems to be some disconnect between documentation and reality. I am using JDeveloper 11.1.1.3.0 version and SOA Suite 11g.
    Thanks,
    Amjad.

  • Validating error with JAXP

    i wrote a small app that read a COLLADA instance document and convert it to a html document. First I wrote some xsl stylesheets and now I'm using a JAXP DOM parser to parse the instance document and a JAXP xslt transformer to perform the transformation.
    When I use a non-validating parser it seems all work well but when i try to use a validating parser i get this message error:
    org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'xml:base' to a(n) 'attribute declaration' component.
    What does it mean?
    When I'm at my home pc,I get the error above but when I'm at university lab pc I don't get any error. WHY!? I'm using the same files.
    Thx for your help

    i'm using jdk 1.5.0_11 and here is my java code.
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import org.w3c.dom.Document;
    import org.w3c.dom.DOMException;
    // For JFileChooser
    import javax.swing.*;
    // For write operation
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    import java.io.*;
    public class StylizerMio2 {
        // Global value so it can be ref'd by the tree-adapter
        static Document document;
        // Constants you'll use when configuring the factory
        static final String JAXP_SCHEMA_LANGUAGE="http://java.sun.com/xml/jaxp/properties/schemaLanguage";
        static final String W3C_XML_SCHEMA="http://www.w3.org/2001/XMLSchema";
         //Constants used to specify the schema in the application
         static final String schemaSource="COLLADASchema_141.xsd";
         static final String JAXP_SCHEMA_SOURCE="http://java.sun.com/xml/jaxp/properties/schemaSource";
        public static void main(String[] argv) {
            /*if (argv.length != 2) {
                System.err.println("Usage: java StylizerMio stylesheet xmlfile");
                System.exit(1);
            // Generating a parser
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
             //Configure the factory to generate a namespace-aware,validating parser
            factory.setValidating(true);  
            factory.setNamespaceAware(true);
             try{
                  factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
              // Associate a document with a schema
              factory.setAttribute(JAXP_SCHEMA_SOURCE, new File(schemaSource));
             catch (IllegalArgumentException x) {
                  // Happens if the parser does not support JAXP 1.2
                  x.printStackTrace();
            // Associating the document with the schema
            try {
              JFileChooser chooser = new JFileChooser();
            ExampleFileFilter daeFilter = new ExampleFileFilter();
            daeFilter.addExtension("dae");
            daeFilter.setDescription("documenti istanza COLLADA");
            chooser.setFileFilter(daeFilter);
            chooser.setCurrentDirectory(new File("."));
              int returnVal = chooser.showOpenDialog(null);
              if(returnVal == JFileChooser.APPROVE_OPTION) {
              System.out.println("You chose to open this file: " +
                   chooser.getSelectedFile().getName());
                File stylesheet = new File("trasformazione.xsl");
              //"Moon Buggy/lunar_vehicle_tris.dae"
                File datafile = chooser.getSelectedFile();
                DocumentBuilder builder = factory.newDocumentBuilder();
              //Handling validation errors
              builder.setErrorHandler(
              new org.xml.sax.ErrorHandler(){
                   // ignore fatal errors (an exception is garaunteed)
                   public void fatalError(SAXParseException exception)
                        throws SAXException{}
                             //treat validation errors as fatal
                             public void error(SAXParseException e)
                                  throws SAXParseException
                                  throw e;
                             // dump warnigs too
                             public void warning(SAXParseException err)
                                  throws SAXParseException
                                  System.out.println("** Warning"
                                  + ", line " + err.getLineNumber()
                                  + ", uri " + err.getSystemId());
                                  System.out.println("   " + err.getMessage());
                document = builder.parse(datafile);
                // Use a Transformer for output
                TransformerFactory tFactory = TransformerFactory.newInstance();
                StreamSource stylesource = new StreamSource(stylesheet);
                Transformer transformer = tFactory.newTransformer(stylesource);
                DOMSource source = new DOMSource(document);
                // SaveDialogue JFileChooser
                ExampleFileFilter htmlFilter = new ExampleFileFilter();
                htmlFilter.addExtension("html");
                htmlFilter.setDescription("documento html");
                chooser.setFileFilter(htmlFilter);
                 chooser.showSaveDialog(null);
                  //"Moon Buggy/lunar_vehicle_tris.html"
                File htmlFile= chooser.getSelectedFile();
                StreamResult result = new StreamResult(htmlFile);
                transformer.transform(source, result);
            } catch (TransformerConfigurationException tce) {
                // Error generated by the parser
                System.out.println("\n** Transformer Factory error");
                System.out.println("   " + tce.getMessage());
                // Use the contained exception, if any
                Throwable x = tce;
                if (tce.getException() != null) {
                    x = tce.getException();
                x.printStackTrace();
            } catch (TransformerException te) {
                // Error generated by the parser
                System.out.println("\n** Transformation error");
                System.out.println("   " + te.getMessage());
                // Use the contained exception, if any
                Throwable x = te;
                if (te.getException() != null) {
                    x = te.getException();
                x.printStackTrace();
            } catch (SAXException sxe) {
                // Error generated by this application
                // (or a parser-initialization error)
                Exception x = sxe;
                if (sxe.getException() != null) {
                    x = sxe.getException();
                x.printStackTrace();
            } catch (ParserConfigurationException pce) {
                // Parser with specified options can't be built
                pce.printStackTrace();
            } catch (IOException ioe) {
                // I/O error
                ioe.printStackTrace();
        } // main
    }

  • Detecting validation error on client side

    If there is some error in validation on the field of ViewObject which is binded with a page, that component shows error message. I want to set some javascript fields on client side when a component gets error. How i can do that?

    Hi,
    for this you will need to catch the error in a custom error handler and call JavaScript from a managed bean (see chapter 5 of the Web Developer guide in the OTN documentation for JDeveloper and ADF).
    Frank

  • Updating InputText after a validation error

    Hi everyone,
    I am having problems updating InputText after a validation error.
    Im using jdeveloper 11.1.1.1.0
    Steps without error validation works correctly
    1.-I put 3 in the component "value" (second InputText)
    2 .- validation begins, and rightly
    3 .- I put the value 1 component "optional" (first imputtext)
    4 .- Click the button "move"
    5 .- The componte "value" modify its contents appearing 1
    Steps with error validation not working properly
    1.-I put 4 in the component "value" (second InputText)
    2 .- validation begins, and it is wrong. Errror message appears
    3 .- I put the value 1 component "optional" (first imputtext)
    4 .- Click the button "move"
    5 .- The componte "value" does not alter its contents.
    Why not change its value after validation error?
    I included an example with two and a button InputText
    <af:inputText label="Optional" id="it1" autoSubmit="true" />
    <af:commandButton text="commandButton 1" id="cb1" immediate="true" actionListener="#{inputExample.move}"/>
    <af:inputText label="Value" id="it2" immediate="true" autoSubmit="true" validator="#{inputExample.validatorExample}" value="#{inputExample.targetValue}"/>
    public void validatorExample(FacesContext facesContext, UIComponent uIComponent, Object object) {
    Number number = null;
    try {
    number = new Number(object);
    } catch (SQLException e) {
    if ((number.longValue() % 2) == 0) {
    FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "ES PAR", "ES PAR");
    ((RichInputText)uIComponent).setValid(false);
    throw new ValidatorException(message);
    public void move(ActionEvent actionEvent) {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    UIComponent x = facesContext.getViewRoot().findComponent("it1");
    RichInputText input1 = (RichInputText)x;
    String value = (String)input1.getValue();
    UIComponent x2 = facesContext.getViewRoot().findComponent("it2");
    RichInputText input2 = (RichInputText)x2;
    input2.setValue(value);
    RequestContext.getCurrentInstance().addPartialTarget(input2);
    }

    Yes but the action will be executed with invalid data.
    After validation fails the new (invalid) value is not set so when you get the value you get the previous (valid) one.
    If you want the validation just to warn the user but allow him to continue with executing actions with the new values then you should not use a validator.
    You could instead use a valueChangeListener were you can display a message to the user allowing the value to be set normaly.
    Gabriel.

  • Catching DateValidator errors

    I am trhying to use a DateValidator in ActionScript to
    validate fields before going to a new screen. I need to catch any
    errors from the validator and not display them. Has anyone came
    across a way to catch errors from validators? Here is the code I am
    working with:

    Hi,
    There is a section in the doc on handling validator errors
    here:
    http://livedocs.macromedia.com/flex/2/docs/00001068.html
    You can see the entire chapter on validators here:
    http://livedocs.macromedia.com/flex/2/docs/00001054.html
    Stephen
    "dzlmbq" <[email protected]> wrote in
    message
    news:e90b31$k5l$[email protected]..
    >I am trhying to use a DateValidator in ActionScript to
    validate fields
    >before
    > going to a new screen. I need to catch any errors from
    the validator and
    > not
    > display them. Has anyone came across a way to catch
    errors from
    > validators?
    > Here is the code I am working with:
    >
    >
    >
    > <?xml version="1.0" encoding="utf-8"?>
    > <mx:Application xmlns:mx="
    http://www.macromedia.com/2003/mxml"
    > xmlns:local="*"
    > backgroundColor="#FFFFFF">
    >
    > <mx:Script>
    > <![CDATA[
    > import mx.controls.Alert;
    >
    > var localDateField:String = "";
    >
    > private function validateDate():Void {
    > try {
    > localDateField = taMain.text;
    >
    > mx.validators.DateValidator.isValid(this,
    'localDateField');
    > } catch (e) {
    > Alert.show(e);
    > }
    > }
    > ]]>
    > </mx:Script>
    >
    > <mx:DateValidator field="localDateField"
    allowedFormatChars="/" />
    >
    > <mx:VBox id="main" >
    > <mx:TextArea id="taMain" height="20" />
    > <mx:Button label="Validate Date"
    click="validateDate()" />
    > </mx:VBox>
    > </mx:Application>
    >

  • Unable to catch the error pls help

    Hi all am trying from last two hours but strangely unable to catch the error inthe below procedure..
    Ignore what the functionality is but look at these steps in the procedure ;Look at these two steps below in the procedure....
    It goes wrong at this point......
    v_acct_nb := in_acct_gp_array(i).gp_dtl_array(j).account_id;
    SELECT DISTINCT account_id INTO v_acct_dim_nb FROM ats_ACCOUNT WHERE account_id = v_acct_nb ; ----> this throws exception that no rows found
    I can see that values are passed into v_acct_nb variable.... but the second statements returns exception saying no data found .
    But
    when i hard code the value returned in the variable in the second statement like below it works ....
    v_acct_nb := in_acct_gp_array(i).gp_dtl_array(j).account_id; /* say i received the value v_acct_nb =20 */
    SELECT DISTINCT account_id INTO v_acct_dim_nb FROM ats_ACCOUNT WHERE account_id = '20'; -----> this works
    whats the issue here ?
    CREATE OR REPLACE PROCEDURE add_appl_dummy2( in_usr_id VARCHAR2,in_acct_gp_array appl_acct_gp_array,v_status_message OUT VARCHAR2)
    IS
    v_usr_dim_nb INTEGER;
    v_acct_dim_nb  VARCHAR2(35);
    v_user_exception     EXCEPTION;
    v_account_exception     EXCEPTION;
    v_acct_in_othr_group_exception  EXCEPTION;
    v_grp_already_exist_exception  EXCEPTION;
    v_acct_nb  VARCHAR2(35);
    v_error_code         VARCHAR2(50);
    v_error_msg          VARCHAR2(50);
    v_dflt_appl_acct_gp_nm VARCHAR2(50);
    v_dflt_appl_acct_gp_id INTEGER;
    v_count NUMBER;
    BEGIN
            /* verify if the user is valid */
            BEGIN
                SELECT usr_id INTO v_usr_dim_nb FROM TSS_USR WHERE access_id =in_usr_id ;
                EXCEPTION WHEN NO_DATA_FOUND THEN
                  v_error_code := SQLCODE;
                  v_error_msg  := SQLERRM;
                RAISE v_user_exception; 
            END;
    DBMS_OUTPUT.PUT_LINE('1');
            FOR i IN in_acct_gp_array.FIRST.. in_acct_gp_array.LAST
            LOOP
                /* Verify if the user has already created an account group with the same name */
                BEGIN
                  SELECT COUNT(1) INTO v_count FROM RPT_ACCT_GP WHERE usr_id=v_usr_dim_nb AND appl_acct_gp_nm=in_acct_gp_array(i).appl_acct_gp_nm;
                  IF v_count >0 THEN
    DBMS_OUTPUT.PUT_LINE('2');
                      RAISE v_grp_already_exist_exception;
                  ELSE
    DBMS_OUTPUT.PUT_LINE('3');
                      NULL;
                  END IF;
                END;
    DBMS_OUTPUT.PUT_LINE('4');
                FOR j IN in_acct_gp_array(i).gp_dtl_array.FIRST..in_acct_gp_array(i).gp_dtl_array.LAST
                LOOP
                      *v_acct_nb := in_acct_gp_array(i).gp_dtl_array(j).account_id;*    
       *SELECT DISTINCT account_id INTO v_acct_dim_nb FROM ats_ACCOUNT WHERE account_id = v_acct_nb ;*
       IF v_acct_dim_nb IS NULL THEN
        DBMS_OUTPUT.PUT_LINE('is null');
       ELSE
                     DBMS_OUTPUT.PUT_LINE(v_acct_dim_nb); /* verify if the account number is valid */
                         DBMS_OUTPUT.PUT_LINE(v_acct_nb);
                         END IF;
             END LOOP;
        END LOOP;
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('9');
    v_status_message:='SUCCESS';
    EXCEPTION
        WHEN v_user_exception THEN
             v_status_message:= 'Invalid user id :'||in_usr_id ||' '||v_error_code||' '||v_error_msg;
        WHEN v_grp_already_exist_exception THEN
             v_status_message:= 'Group with the same name already exists ';
        WHEN OTHERS THEN
             v_status_message:= SQLCODE||' '||SQLERRM;
    END;
    SELECT DISTINCT account_id  FROM ats_ACCOUNT WHERE account_id='000000400127032'

    Please remove this bug anyway:
        WHEN OTHERS THEN
             v_status_message:= SQLCODE||' '||SQLERRM;

  • Form validation error when the Table is empty.

    Hello Gurus,
    I am getting form validation error as soon as the popup is rendered to submit new row.
    I am using the this popup to add new row in the table and this is happening only when there no data in the table but it works fine when there is some data in the table.
    Screen shot: [http://picpaste.com/adf_error-BAdP8Thv.JPG]
    Is there any way can I defer this error till I submit the form. ( which works fine when there is some data in table )
    Thanks
    Abhijeet

    here i tested not happend for me.
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document id="d1" binding="#{backingBeanScope.backing_untitled8.d1}">
          <af:form binding="#{backingBeanScope.backing_untitled8.f2}" id="f2">
            <af:messages binding="#{backingBeanScope.backing_untitled8.m1}"
                         id="m1"/>
            <af:popup binding="#{backingBeanScope.backing_untitled8.p1}" id="p1">
              <af:dialog binding="#{backingBeanScope.backing_untitled8.d3}" id="d3">
                <af:panelFormLayout binding="#{backingBeanScope.backing_untitled8.pfl1}"
                                    id="pfl1">
                  <af:inputText value="#{bindings.AunitctrlBe.inputValue}"
                                label="#{bindings.AunitctrlBe.hints.label}"
                                required="#{bindings.AunitctrlBe.hints.mandatory}"
                                columns="#{bindings.AunitctrlBe.hints.displayWidth}"
                                maximumLength="#{bindings.AunitctrlBe.hints.precision}"
                                shortDesc="#{bindings.AunitctrlBe.hints.tooltip}"
                                binding="#{backingBeanScope.backing_untitled8.it10}"
                                id="it10">
                    <f:validator binding="#{bindings.AunitctrlBe.validator}"/>
                  </af:inputText>
                  <af:inputText value="#{bindings.AunitctrlUnit.inputValue}"
                                label="#{bindings.AunitctrlUnit.hints.label}"
                                required="#{bindings.AunitctrlUnit.hints.mandatory}"
                                columns="#{bindings.AunitctrlUnit.hints.displayWidth}"
                                maximumLength="#{bindings.AunitctrlUnit.hints.precision}"
                                shortDesc="#{bindings.AunitctrlUnit.hints.tooltip}"
                                binding="#{backingBeanScope.backing_untitled8.it11}"
                                id="it11">
                    <f:validator binding="#{bindings.AunitctrlUnit.validator}"/>
                  </af:inputText>
                  <af:inputText value="#{bindings.AunitctrlCostMethod.inputValue}"
                                label="#{bindings.AunitctrlCostMethod.hints.label}"
                                required="#{bindings.AunitctrlCostMethod.hints.mandatory}"
                                columns="#{bindings.AunitctrlCostMethod.hints.displayWidth}"
                                maximumLength="#{bindings.AunitctrlCostMethod.hints.precision}"
                                shortDesc="#{bindings.AunitctrlCostMethod.hints.tooltip}"
                                binding="#{backingBeanScope.backing_untitled8.it12}"
                                id="it12">
                    <f:validator binding="#{bindings.AunitctrlCostMethod.validator}"/>
                  </af:inputText>
                  <af:inputText value="#{bindings.AunitctrlCostMgmtOpt.inputValue}"
                                label="#{bindings.AunitctrlCostMgmtOpt.hints.label}"
                                required="#{bindings.AunitctrlCostMgmtOpt.hints.mandatory}"
                                columns="#{bindings.AunitctrlCostMgmtOpt.hints.displayWidth}"
                                maximumLength="#{bindings.AunitctrlCostMgmtOpt.hints.precision}"
                                shortDesc="#{bindings.AunitctrlCostMgmtOpt.hints.tooltip}"
                                binding="#{backingBeanScope.backing_untitled8.it13}"
                                id="it13">
                    <f:validator binding="#{bindings.AunitctrlCostMgmtOpt.validator}"/>
                  </af:inputText>
                  <af:inputText value="#{bindings.AunitctrlCostApprMtd.inputValue}"
                                label="#{bindings.AunitctrlCostApprMtd.hints.label}"
                                required="#{bindings.AunitctrlCostApprMtd.hints.mandatory}"
                                columns="#{bindings.AunitctrlCostApprMtd.hints.displayWidth}"
                                maximumLength="#{bindings.AunitctrlCostApprMtd.hints.precision}"
                                shortDesc="#{bindings.AunitctrlCostApprMtd.hints.tooltip}"
                                binding="#{backingBeanScope.backing_untitled8.it14}"
                                id="it14">
                    <f:validator binding="#{bindings.AunitctrlCostApprMtd.validator}"/>
                  </af:inputText>
                  <af:inputText value="#{bindings.AunitctrlJocApprMtd.inputValue}"
                                label="#{bindings.AunitctrlJocApprMtd.hints.label}"
                                required="#{bindings.AunitctrlJocApprMtd.hints.mandatory}"
                                columns="#{bindings.AunitctrlJocApprMtd.hints.displayWidth}"
                                maximumLength="#{bindings.AunitctrlJocApprMtd.hints.precision}"
                                shortDesc="#{bindings.AunitctrlJocApprMtd.hints.tooltip}"
                                binding="#{backingBeanScope.backing_untitled8.it15}"
                                id="it15">
                    <f:validator binding="#{bindings.AunitctrlJocApprMtd.validator}"/>
                  </af:inputText>
                  <af:inputText value="#{bindings.AunitctrlCreBy.inputValue}"
                                label="#{bindings.AunitctrlCreBy.hints.label}"
                                required="#{bindings.AunitctrlCreBy.hints.mandatory}"
                                columns="#{bindings.AunitctrlCreBy.hints.displayWidth}"
                                maximumLength="#{bindings.AunitctrlCreBy.hints.precision}"
                                shortDesc="#{bindings.AunitctrlCreBy.hints.tooltip}"
                                binding="#{backingBeanScope.backing_untitled8.it16}"
                                id="it16">
                    <f:validator binding="#{bindings.AunitctrlCreBy.validator}"/>
                  </af:inputText>
                  <af:inputDate value="#{bindings.AunitctrlCreDate.inputValue}"
                                label="#{bindings.AunitctrlCreDate.hints.label}"
                                required="#{bindings.AunitctrlCreDate.hints.mandatory}"
                                shortDesc="#{bindings.AunitctrlCreDate.hints.tooltip}"
                                binding="#{backingBeanScope.backing_untitled8.id1}"
                                id="id1">
                    <f:validator binding="#{bindings.AunitctrlCreDate.validator}"/>
                    <af:convertDateTime pattern="#{bindings.AunitctrlCreDate.format}"/>
                  </af:inputDate>
                  <af:inputText value="#{bindings.AunitctrlUpdBy.inputValue}"
                                label="#{bindings.AunitctrlUpdBy.hints.label}"
                                required="#{bindings.AunitctrlUpdBy.hints.mandatory}"
                                columns="#{bindings.AunitctrlUpdBy.hints.displayWidth}"
                                maximumLength="#{bindings.AunitctrlUpdBy.hints.precision}"
                                shortDesc="#{bindings.AunitctrlUpdBy.hints.tooltip}"
                                binding="#{backingBeanScope.backing_untitled8.it17}"
                                id="it17">
                    <f:validator binding="#{bindings.AunitctrlUpdBy.validator}"/>
                  </af:inputText>
                  <af:inputDate value="#{bindings.AunitctrlUpdDate.inputValue}"
                                label="#{bindings.AunitctrlUpdDate.hints.label}"
                                required="#{bindings.AunitctrlUpdDate.hints.mandatory}"
                                shortDesc="#{bindings.AunitctrlUpdDate.hints.tooltip}"
                                binding="#{backingBeanScope.backing_untitled8.id2}"
                                id="id2">
                    <f:validator binding="#{bindings.AunitctrlUpdDate.validator}"/>
                    <af:convertDateTime pattern="#{bindings.AunitctrlUpdDate.format}"/>
                  </af:inputDate>
                  <af:inputText value="#{bindings.RowID.inputValue}"
                                label="#{bindings.RowID.hints.label}"
                                required="#{bindings.RowID.hints.mandatory}"
                                columns="#{bindings.RowID.hints.displayWidth}"
                                maximumLength="#{bindings.RowID.hints.precision}"
                                shortDesc="#{bindings.RowID.hints.tooltip}"
                                binding="#{backingBeanScope.backing_untitled8.it18}"
                                id="it18">
                    <f:validator binding="#{bindings.RowID.validator}"/>
                  </af:inputText>
                  <f:facet name="footer">
                    <af:panelGroupLayout layout="vertical"
                                         binding="#{backingBeanScope.backing_untitled8.pgl1}"
                                         id="pgl1">
                      <af:panelGroupLayout layout="horizontal"
                                           binding="#{backingBeanScope.backing_untitled8.pgl2}"
                                           id="pgl2">
                        <af:commandButton actionListener="#{bindings.First1.execute}"
                                          text="First1"
                                          disabled="#{!bindings.First1.enabled}"
                                          partialSubmit="true"
                                          binding="#{backingBeanScope.backing_untitled8.cb1}"
                                          id="cb1"/>
                        <af:commandButton actionListener="#{bindings.Previous1.execute}"
                                          text="Previous1"
                                          disabled="#{!bindings.Previous1.enabled}"
                                          partialSubmit="true"
                                          binding="#{backingBeanScope.backing_untitled8.cb3}"
                                          id="cb3"/>
                        <af:commandButton actionListener="#{bindings.Next1.execute}"
                                          text="Next1"
                                          disabled="#{!bindings.Next1.enabled}"
                                          partialSubmit="true"
                                          binding="#{backingBeanScope.backing_untitled8.cb4}"
                                          id="cb4"/>
                        <af:commandButton actionListener="#{bindings.Last1.execute}"
                                          text="Last1"
                                          disabled="#{!bindings.Last1.enabled}"
                                          partialSubmit="true"
                                          binding="#{backingBeanScope.backing_untitled8.cb5}"
                                          id="cb5"/>
                      </af:panelGroupLayout>
                      <af:commandButton text="Submit"
                                        binding="#{backingBeanScope.backing_untitled8.cb6}"
                                        id="cb6"/>
                    </af:panelGroupLayout>
                  </f:facet>
                </af:panelFormLayout>
              </af:dialog>
            </af:popup>
            <af:panelCollection binding="#{backingBeanScope.backing_untitled8.pc2}"
                                id="pc2">
              <f:facet name="menus"/>
              <f:facet name="toolbar">
                <af:toolbar binding="#{backingBeanScope.backing_untitled8.t3}"
                            id="t3">
                  <af:commandButton text="insert"
                                    binding="#{backingBeanScope.backing_untitled8.cb7}"
                                    id="cb7"
                                    action="#{backingBeanScope.backing_untitled8.cb7_action}"
                                    partialSubmit="true"/>
                </af:toolbar>
              </f:facet>
              <f:facet name="statusbar"/>
              <af:table value="#{bindings.ApplUnitControlView1.collectionModel}"
                        var="row" rows="#{bindings.ApplUnitControlView1.rangeSize}"
                        emptyText="#{bindings.ApplUnitControlView1.viewable ? 'No data to display.' : 'Access Denied.'}"
                        fetchSize="#{bindings.ApplUnitControlView1.rangeSize}"
                        rowBandingInterval="0"
                        filterModel="#{bindings.ApplUnitControlView1Query.queryDescriptor}"
                        queryListener="#{bindings.ApplUnitControlView1Query.processQuery}"
                        filterVisible="true" varStatus="vs"
                        selectedRowKeys="#{bindings.ApplUnitControlView1.collectionModel.selectedRow}"
                        selectionListener="#{bindings.ApplUnitControlView1.collectionModel.makeCurrent}"
                        rowSelection="single"
                        binding="#{backingBeanScope.backing_untitled8.t4}" id="t4"
                        partialTriggers=":::cb1 :::cb3 :::cb4 :::cb5 ::cb2">
                <af:column sortProperty="AunitctrlBe" filterable="true"
                           sortable="true"
                           headerText="#{bindings.ApplUnitControlView1.hints.AunitctrlBe.label}"
                           id="c6" width="105">
                  <af:inputText value="#{row.bindings.AunitctrlBe.inputValue}"
                                label="#{bindings.ApplUnitControlView1.hints.AunitctrlBe.label}"
                                required="#{bindings.ApplUnitControlView1.hints.AunitctrlBe.mandatory}"
                                columns="#{bindings.ApplUnitControlView1.hints.AunitctrlBe.displayWidth}"
                                maximumLength="#{bindings.ApplUnitControlView1.hints.AunitctrlBe.precision}"
                                shortDesc="#{bindings.ApplUnitControlView1.hints.AunitctrlBe.tooltip}"
                                id="it1">
                    <f:validator binding="#{row.bindings.AunitctrlBe.validator}"/>
                  </af:inputText>
                </af:column>
                <af:column sortProperty="AunitctrlUnit" filterable="true"
                           sortable="true"
                           headerText="#{bindings.ApplUnitControlView1.hints.AunitctrlUnit.label}"
                           id="c3" width="105">
                  <af:inputText value="#{row.bindings.AunitctrlUnit.inputValue}"
                                label="#{bindings.ApplUnitControlView1.hints.AunitctrlUnit.label}"
                                required="#{bindings.ApplUnitControlView1.hints.AunitctrlUnit.mandatory}"
                                columns="#{bindings.ApplUnitControlView1.hints.AunitctrlUnit.displayWidth}"
                                maximumLength="#{bindings.ApplUnitControlView1.hints.AunitctrlUnit.precision}"
                                shortDesc="#{bindings.ApplUnitControlView1.hints.AunitctrlUnit.tooltip}"
                                id="it9">
                    <f:validator binding="#{row.bindings.AunitctrlUnit.validator}"/>
                  </af:inputText>
                </af:column>
                <af:column sortProperty="AunitctrlCostMethod" filterable="true"
                           sortable="true"
                           headerText="#{bindings.ApplUnitControlView1.hints.AunitctrlCostMethod.label}"
                           id="c9" width="105">
                  <af:inputText value="#{row.bindings.AunitctrlCostMethod.inputValue}"
                                label="#{bindings.ApplUnitControlView1.hints.AunitctrlCostMethod.label}"
                                required="#{bindings.ApplUnitControlView1.hints.AunitctrlCostMethod.mandatory}"
                                columns="#{bindings.ApplUnitControlView1.hints.AunitctrlCostMethod.displayWidth}"
                                maximumLength="#{bindings.ApplUnitControlView1.hints.AunitctrlCostMethod.precision}"
                                shortDesc="#{bindings.ApplUnitControlView1.hints.AunitctrlCostMethod.tooltip}"
                                id="it6">
                    <f:validator binding="#{row.bindings.AunitctrlCostMethod.validator}"/>
                  </af:inputText>
                </af:column>
                <af:column sortProperty="AunitctrlCostMgmtOpt" filterable="true"
                           sortable="true"
                           headerText="#{bindings.ApplUnitControlView1.hints.AunitctrlCostMgmtOpt.label}"
                           id="c1" width="105">
                  <af:inputText value="#{row.bindings.AunitctrlCostMgmtOpt.inputValue}"
                                label="#{bindings.ApplUnitControlView1.hints.AunitctrlCostMgmtOpt.label}"
                                required="#{bindings.ApplUnitControlView1.hints.AunitctrlCostMgmtOpt.mandatory}"
                                columns="#{bindings.ApplUnitControlView1.hints.AunitctrlCostMgmtOpt.displayWidth}"
                                maximumLength="#{bindings.ApplUnitControlView1.hints.AunitctrlCostMgmtOpt.precision}"
                                shortDesc="#{bindings.ApplUnitControlView1.hints.AunitctrlCostMgmtOpt.tooltip}"
                                id="it3">
                    <f:validator binding="#{row.bindings.AunitctrlCostMgmtOpt.validator}"/>
                  </af:inputText>
                </af:column>
                <af:column sortProperty="AunitctrlCostApprMtd" filterable="true"
                           sortable="true"
                           headerText="#{bindings.ApplUnitControlView1.hints.AunitctrlCostApprMtd.label}"
                           id="c2" width="105">
                  <af:inputText value="#{row.bindings.AunitctrlCostApprMtd.inputValue}"
                                label="#{bindings.ApplUnitControlView1.hints.AunitctrlCostApprMtd.label}"
                                required="#{bindings.ApplUnitControlView1.hints.AunitctrlCostApprMtd.mandatory}"
                                columns="#{bindings.ApplUnitControlView1.hints.AunitctrlCostApprMtd.displayWidth}"
                                maximumLength="#{bindings.ApplUnitControlView1.hints.AunitctrlCostApprMtd.precision}"
                                shortDesc="#{bindings.ApplUnitControlView1.hints.AunitctrlCostApprMtd.tooltip}"
                                id="it2">
                    <f:validator binding="#{row.bindings.AunitctrlCostApprMtd.validator}"/>
                  </af:inputText>
                </af:column>
                <af:column sortProperty="AunitctrlJocApprMtd" filterable="true"
                           sortable="true"
                           headerText="#{bindings.ApplUnitControlView1.hints.AunitctrlJocApprMtd.label}"
                           id="c4" width="105">
                  <af:inputText value="#{row.bindings.AunitctrlJocApprMtd.inputValue}"
                                label="#{bindings.ApplUnitControlView1.hints.AunitctrlJocApprMtd.label}"
                                required="#{bindings.ApplUnitControlView1.hints.AunitctrlJocApprMtd.mandatory}"
                                columns="#{bindings.ApplUnitControlView1.hints.AunitctrlJocApprMtd.displayWidth}"
                                maximumLength="#{bindings.ApplUnitControlView1.hints.AunitctrlJocApprMtd.precision}"
                                shortDesc="#{bindings.ApplUnitControlView1.hints.AunitctrlJocApprMtd.tooltip}"
                                id="it4">
                    <f:validator binding="#{row.bindings.AunitctrlJocApprMtd.validator}"/>
                  </af:inputText>
                </af:column>
                <af:column sortProperty="AunitctrlCreBy" filterable="true"
                           sortable="true"
                           headerText="#{bindings.ApplUnitControlView1.hints.AunitctrlCreBy.label}"
                           id="c5" width="105">
                  <af:inputText value="#{row.bindings.AunitctrlCreBy.inputValue}"
                                label="#{bindings.ApplUnitControlView1.hints.AunitctrlCreBy.label}"
                                required="#{bindings.ApplUnitControlView1.hints.AunitctrlCreBy.mandatory}"
                                columns="#{bindings.ApplUnitControlView1.hints.AunitctrlCreBy.displayWidth}"
                                maximumLength="#{bindings.ApplUnitControlView1.hints.AunitctrlCreBy.precision}"
                                shortDesc="#{bindings.ApplUnitControlView1.hints.AunitctrlCreBy.tooltip}"
                                id="it7">
                    <f:validator binding="#{row.bindings.AunitctrlCreBy.validator}"/>
                  </af:inputText>
                </af:column>
                <af:column sortProperty="AunitctrlCreDate" filterable="true"
                           sortable="true"
                           headerText="#{bindings.ApplUnitControlView1.hints.AunitctrlCreDate.label}"
                           id="c8" width="103">
                  <f:facet name="filter">
                    <af:inputDate value="#{vs.filterCriteria.AunitctrlCreDate}"
                                  binding="#{backingBeanScope.backing_untitled8.id5}"
                                  id="id5"/>
                  </f:facet>
                  <af:inputDate value="#{row.bindings.AunitctrlCreDate.inputValue}"
                                label="#{bindings.ApplUnitControlView1.hints.AunitctrlCreDate.label}"
                                required="#{bindings.ApplUnitControlView1.hints.AunitctrlCreDate.mandatory}"
                                shortDesc="#{bindings.ApplUnitControlView1.hints.AunitctrlCreDate.tooltip}"
                                id="id3">
                    <f:validator binding="#{row.bindings.AunitctrlCreDate.validator}"/>
                    <af:convertDateTime pattern="#{bindings.ApplUnitControlView1.hints.AunitctrlCreDate.format}"/>
                  </af:inputDate>
                </af:column>
                <af:column sortProperty="AunitctrlUpdBy" filterable="true"
                           sortable="true"
                           headerText="#{bindings.ApplUnitControlView1.hints.AunitctrlUpdBy.label}"
                           id="c7" width="107">
                  <af:inputText value="#{row.bindings.AunitctrlUpdBy.inputValue}"
                                label="#{bindings.ApplUnitControlView1.hints.AunitctrlUpdBy.label}"
                                required="#{bindings.ApplUnitControlView1.hints.AunitctrlUpdBy.mandatory}"
                                columns="#{bindings.ApplUnitControlView1.hints.AunitctrlUpdBy.displayWidth}"
                                maximumLength="#{bindings.ApplUnitControlView1.hints.AunitctrlUpdBy.precision}"
                                shortDesc="#{bindings.ApplUnitControlView1.hints.AunitctrlUpdBy.tooltip}"
                                id="it5">
                    <f:validator binding="#{row.bindings.AunitctrlUpdBy.validator}"/>
                  </af:inputText>
                </af:column>
                <af:column sortProperty="AunitctrlUpdDate" filterable="true"
                           sortable="true"
                           headerText="#{bindings.ApplUnitControlView1.hints.AunitctrlUpdDate.label}"
                           id="c10" width="105">
                  <f:facet name="filter">
                    <af:inputDate value="#{vs.filterCriteria.AunitctrlUpdDate}"
                                  binding="#{backingBeanScope.backing_untitled8.id6}"
                                  id="id6"/>
                  </f:facet>
                  <af:inputDate value="#{row.bindings.AunitctrlUpdDate.inputValue}"
                                label="#{bindings.ApplUnitControlView1.hints.AunitctrlUpdDate.label}"
                                required="#{bindings.ApplUnitControlView1.hints.AunitctrlUpdDate.mandatory}"
                                shortDesc="#{bindings.ApplUnitControlView1.hints.AunitctrlUpdDate.tooltip}"
                                id="id4">
                    <f:validator binding="#{row.bindings.AunitctrlUpdDate.validator}"/>
                    <af:convertDateTime pattern="#{bindings.ApplUnitControlView1.hints.AunitctrlUpdDate.format}"/>
                  </af:inputDate>
                </af:column>
                <af:column sortProperty="RowID" filterable="true" sortable="true"
                           headerText="#{bindings.ApplUnitControlView1.hints.RowID.label}"
                           id="c11" width="105">
                  <af:inputText value="#{row.bindings.RowID.inputValue}"
                                label="#{bindings.ApplUnitControlView1.hints.RowID.label}"
                                required="#{bindings.ApplUnitControlView1.hints.RowID.mandatory}"
                                columns="#{bindings.ApplUnitControlView1.hints.RowID.displayWidth}"
                                maximumLength="#{bindings.ApplUnitControlView1.hints.RowID.precision}"
                                shortDesc="#{bindings.ApplUnitControlView1.hints.RowID.tooltip}"
                                id="it8">
                    <f:validator binding="#{row.bindings.RowID.validator}"/>
                  </af:inputText>
                </af:column>
              </af:table>
            </af:panelCollection>
          </af:form>
        </af:document>
      </f:view>
      <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_untitled8-->
    </jsp:root>
        public String cb7_action() {
            try {
                BindingContainer bindings1 = getBindings();
                DCIteratorBinding dciter = (DCIteratorBinding)bindings1.get("ApplUnitControlView1Iterator");
                Row oldCcurrentRow = dciter.getCurrentRow();
                BindingContainer bindings = getBindings();
                OperationBinding operationBinding = bindings.getOperationBinding("CreateInsert");
                Object result = operationBinding.execute();
                if (!operationBinding.getErrors().isEmpty()) {
                    return null;
                RichPopup popup = this.getP1();
                RichPopup.PopupHints hints =
                    new RichPopup.PopupHints(); //empty hints renders dialog in center of screen
                popup.show(hints);
            catch (NullPointerException e)
                System.out.println(" cause " + e.getCause());
                System.out.println("message" + e.getLocalizedMessage());
                System.out.println("stack trace" + e.getStackTrace());
            return "insert";
        }Edited by: ADF 7 on Feb 10, 2012 2:05 AM

  • SelectOneListBox and validation error

    Hi,
    I have a validation error using a selectOneListbox. I read a lot of topics in this forum, but I still can't solve my pb.
    This is my JSP:
    <ice:selectOneListbox size="1" styleClass="totalWidth" value="#{controller.selectedCmsName}" >
        <f:selectItems value="#{controller.cmsListItem}"/>
    </ice:selectOneListbox>This is the getter/setter for cmsListItem:
    private List cmsListItem;
    public List getCmsListItem()
        cmsListItem = new ArrayList();
        try {
          cmsList = /* a method which returns an array */
          for (int i = 0; i < cmsList.length; i++) {
            cmsListItem.add(new SelectItem(cmsList.getName(), cmsList[i].getName() + " (" + cmsList[i].getUsername() + ")"));
    } catch (Exception e) {
    return cmsListItem;
    public void setCmsListItem(List cmsListItem)
    this.cmsListItem = cmsListItem;
    Same thing for selectedCmsName:
    private String selectedCmsName;
      public String getSelectedCmsName()
        return selectedCmsName;
      public void setSelectedCmsName(String selectedCmsName)
        this.selectedCmsName = selectedCmsName;
      }There is a <h:messages/> tag in my jsp which give the message:
    Validation ErrorI don't see anything wrong in my code.... An idea?
    Thanks,
    phil

    Does it work with a real basic example?
    test.jsp<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <f:view>
        <html>
        <head>
        <title>test</title>
        </head>
        <body>
        <h:form>
            <h:selectOneListbox value="#{myBean.selectedItem}">
                <f:selectItems value="#{myBean.selectItems}" />
            </h:selectOneListbox>
            <h:commandButton value="submit" action="#{myBean.action}" />
            <h:outputText value="#{myBean.selectedItem}" />
            <h:messages />
        </h:form>
        </body>
        </html>
    </f:view>MyBeanpackage mypackage;
    import java.util.ArrayList;
    import java.util.List;
    import javax.faces.model.SelectItem;
    public class MyBean {
        private String selectedItem;
        private List<SelectItem> selectItems;
            selectItems = new ArrayList<SelectItem>();
            selectItems.add(new SelectItem("value1", "label1"));
            selectItems.add(new SelectItem("value2", "label2"));
            selectItems.add(new SelectItem("value3", "label3"));
        public void action() {
            System.out.println(selectedItem);
        public String getSelectedItem() {
            return selectedItem;
        public List<SelectItem> getSelectItems() {
            return selectItems;
        public void setSelectedItem(String selectedItem) {
            this.selectedItem = selectedItem;
    }Just copypaste it, add MyBean/myBean to the faces-config and execute it.

  • Catch NetUI Error

    Hi There,
    There's been previous posts about the NetUI Warning/Error 'unable to update expression....'
    but is there a way you can catch this error and deal with it?
    Example, the form expects an int, the user enters a string. This produces the
    error above but you can't check for it in the validation in the form bean because
    it has already reverted to 0.
    Can you trap this error in the validation?
    Thanks in Advance,
    Alex.

    Thanks for your help John.
    John Rohrlich <[email protected]> wrote:
    I should have said "if the input can not be converted to an int" as all
    input from the jsp form will be strings when passed to the server.
    Here are some references on validation
    http://dev2dev.bea.com/codelibrary/code/pf_formvalid.jsp
    http://edocs.bea.com/workshop/docs81/doc/en/workshop/guide/netui/guide/conValidatingUserInput.html
    John Rohrlich wrote:
    Alex,
    A good approach here is to add validation to your form class and addan
    ActionError if the input is not an int. You won't get the error andyou
    can display a message to the user.
    john
    Alex Cave wrote:
    Hi There,
    There's been previous posts about the NetUI Warning/Error 'unable
    to
    update expression....'
    but is there a way you can catch this error and deal with it?
    Example, the form expects an int, the user enters a string. This
    produces the
    error above but you can't check for it in the validation in the form
    bean because
    it has already reverted to 0.
    Can you trap this error in the validation?
    Thanks in Advance,
    Alex.

  • Throws validation errors to NWPM

    Hi All,
    I am working on a proxy to jdbc scenario in which we have to throw validation errors to NWPM(Net Weaver Process Monitor Tool)
    I am following the below steps,
    step 1 - In message mapping a UDF is created to catch errors and store them in a variable using dynamic configuration
    step 2 - writing abap mapping for handling this thrown exception and im reading the dynamic configuration in the abap class and raising exception. The exception format expected is
    SAP:Error SOAP:mustUnderstand="" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
    <SAP:Category>XIServer</SAP:Category>
    <SAP:Code area="RCVR_DETERMINATION">NO_RECEIVER_CASE_ASYNC</SAP:Code>
    <SAP:P1>ZPI_THROW_EXCEPTION</SAP:P1>
    <SAP:P2>001</SAP:P2/>
    <SAP:P3>Mandatory field is missingBUKRS </SAP:P3>
    <SAP:AdditionalText />
    <SAP:Stack>No receiver could be determined</SAP:Stack>
    <SAP:Retry>M</SAP:Retry>
    </SAP:Error>
    but while i am trying to  test the data in message mapping it will show one error.
    and with out using abap code it works successfully but while i am adding Abap code in interface mapping it will show the following error.
    "Runtime exception when processing target-field mapping /ns0:MT_DB2_SourcePlant/Record/SourcePlant; root message: Exception:[java.lang.NullPointerException: while trying to invoke the method com.sap.aii.mapping.api.DynamicConfiguration.put(com.sap.aii.mapping.api.DynamicConfigurationKey, java.lang.String) of an object loaded from local variable '<9>'] in class CHRYSLER_com_test_scenario.ErrorHandling method testingError[, 4, , com.sap.aii.mappingtool.tf7.rt.Context@749119e6]"
    I have written the following ABAP code to achieve this:
    method IF_MAPPING~EXECUTE.
    DATA l_record type mpp_dynamic.
    DATA error type String.
    getting dynamic configuration value
    filled in by any previous mapping
    CALL METHOD DYNAMIC_CONFIGURATION->GET_RECORD
    EXPORTING
    NAMESPACE = 'http://sap.com/xi/XI/System/ERROR'
    NAME = 'ERROR'
    RECEIVING
    RECORD = l_record.
    error = l_record-value.
    *raising exception with our message
    RAISE EXCEPTION TYPE CX_MAPPING_FAULT
    EXPORTING
    TEXTID =
    PREVIOUS =
    ERROR_CODE = '001'
    ERROR_TEXT = error .
    RAISE EXCEPTION TYPE CX_MAPPING_FAULT
    EXPORTING
    TEXTID =
    PREVIOUS =
    ERROR_CODE = '003'
    ERROR_TEXT = error .
    endmethod.
    I am gettign the following message for our code:
    SAP:Error SOAP:mustUnderstand="" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
    <SAP:Category>XIServer</SAP:Category>
    <SAP:Code area="RCVR_DETERMINATION">NO_RECEIVER_CASE_ASYNC</SAP:Code>
    <SAP:P1 />
    <SAP:P2 />
    <SAP:P3 />
    <SAP:P4 />
    <SAP:AdditionalText />
    <SAP:Stack>No receiver could be determined</SAP:Stack>
    <SAP:Retry>M</SAP:Retry>
    </SAP:Error>
    Could you please help in finding the solution for getting currect error message from ABAP class?

    Hello,
    The ABAP code looks ok except the missing if error != null statement.
    Please check the similar code for raising exception provided in the below blog:
    /people/ravi.gupta4/blog/2010/02/04/automating-cancellation-of-a-failed-message-in-xi
    Also, Can you check whether exception is raised using Dynamic config UDF and a call to abap mapping is made.
    Check the other approach of raising an exception:
    /people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping
    -Rahul

Maybe you are looking for