Validation messages and displaying

I am using JDeveloper 3.0 and not having an easy time with getting my validation error messages to show up. My Oracle contact is not a programmer and tends to give me an answer she doesn't understand herself.
Anyway, I have tried creating a validator and per the oracle person, a domain. Either method does validate the field entry and prevent the data from being stored; however, both methods do not display the useful error message I threw back. I throw a jboexception that I want displayed and instead I get messages about how the validation failed or how it was unable to create, depending on whether the exception occurs in a validator or a domain.
I am not familiar with the code and was hoping the documentation would give me a step by step of how to override whatever it is that I need to override or do whatever it is that I need to do. I want to use the functionality of the wizards by being able to set the validation or set the type of attribute to a domain. I think I could code this in the entity object java file, but I really want to make this sort of thing easy for another developer to choose my validation routine or domain while running the wizard.
The example in Oracle's samples walks you through a simple edit on salary (salary > 1200). The validation catches all salaries below 1200 and throws back some ugly message about how the validation failed. What does one need to do to show their personal error message like "Salary must be greater than 1200"? Why is this simple concept so HARD?
Please help me as I am ready to throw out JDeveloper and go with another product.
Lisa

In the setter method for an attribute on which you've installed a validator, (say for "Salary" attribute, in setSalary method), you could trap JboException and if the exception's error-code is 27011 (the one thrown from the compare validator as per your example), you could throw another JboException. Here's a sample code-snippet:
public void setSalary (Number n)
try
setAttributeInternal(COMM, value);
catch (JboException e)
if (e.getErrorCode().equals("27011"))
throw new oracle.jbo.JboException ("MY ERROR MESSAGE");
// add logic for other exceptions
throw e;
Also, in the JDeveloper docs you could find more on how to customize exceptions. I've pasted some snippet from one of the docs.
Programming with Exceptions
Use exceptions to indicate serious or unexpected error conditions, conditions from which the program cannot easily recover. This topic presents the following
information:
About Java exceptions
About exception classes
Creating custom exception classes
Localizing exception messages
Marshaling exceptions
About Java Exceptions
Java exceptions fall into two categories: either they extend java.lang.RuntimeException (these are called implicit exceptions) or they do not (these are called
explicit exceptions). When a method uses an explicit exception to indicate an error, a Java program requires:
A throws clause in the method signature that declares the type of exception the method will throw when an error occurs.
A throw statement in the method body that creates and throws an exception of the type specified in the signature.
The following code shows a method getCustName that declares and throws a ValidationException.
public String getCustName(Customer cust) throws ValidationException {
String name = cust.mName;
if (name == null) {
throw new ValidationException();
return name;
When you write code that calls a method that throws an exception, enclose the call in a try...catch block. For example, the following code calls getCustName, a
method defined to throw a ValidationException. The try keyword indicates that you are about to call one or more methods that throw exceptions. The catch
keyword marks the beginning of a code block that executes only when an exception is thrown.
public printName(Customer cust) {
try {
// Call the method(s) here.
getCustName(cust);
catch (ValidationException dae) {
// Handle the error here.
System.out.println(dae.getMessage());
Java programs are more lenient about implicit exceptions: they do not have to be declared or caught. You can write a method that throws a RuntimeException (or a
subclass of RuntimeException) without declaring it in the method signature (although you can do so, if you prefer).
About Exception Classes
The Business Components framework provides many exception classes (for example, ValidationException and NameClashException). These classes extend
oracle.jbo.JboException, which extends java.lang.RuntimeException. Therefore, a Business Component method can throw a Business Component
exception without a throws clause in the signature.
Business Component exceptions have an attribute that stores an error message, and they support NLS translation and message formatting. JboException uses
java.util.ListResourceBundle to format its messages. A resource bundle class defines constants and strings to use as error messages. The default format is
{productCode}-{errorCode}: {messageBody}
For example,
ORA-10234: You cannot do that.
Business Component exception messages are derived from the following generalized set of parameters:
Parameter
Example
Product code
"OBCJ"
Error code
"03101"
ResourceBundle
"oracle.jbo.CSMessageBundle"
an optional set of parameters
"Vendor", "Oracle"
details
Any exception thrown in low-level code that is transformed
into a Business Component exception
Messages may need to include information known only when the exception is thrown, so error message strings can include placeholders that refer to values in an array
of Objects passed to the exception when it's thrown. When the message is formatted for display, these parameters are placed into slots in the message (the first slot is 0)
using the standard formatting capabilities provided by java.text.MessageFormat. Following is a an entry from CSMessageBundle.java.
public static final String EXC_VAL_ATTR_SET_FAILED = "03101";
// Description: Generic Attribute validation failure.
// set<Attribute> method failed to set the value.
// Parameter 0: Ignored.
// Parameter 1: Entity Object/View Object name.
// Parameter 2: Attribute name.
// Parameter 3: New value
{EXC_VAL_ATTR_SET_FAILED, "Attribute set with value {3} for {2} in {1} failed."},
The JboException class provides the following methods for working with exceptions.
Method
Description
JboException(String message,
String errorCode,
Object[] params)
Create a Formattable Exception Object.
JboException(Class resBundleClass,
String errorCode,
Object[] params)
Create a Translatable Exception Object.
String getProductCode()
Return the Product code for the Message.
String getErrorCode()
Return the Error code.
String getLocalizedMessage(Locale loc)
Return the Message in the specific Locale.
Object[] getDetails()
Details are usually used to accommodate
lower-level exceptions. For example, if a
SQLException is thrown in some low-level code, the Business Component
framework can catch it and represent it as
one of the Business Component exceptions.
The original SQLException becomes
the first entry in the detail.
String getResourceName()
Return the name of the ResourceBundle used to
resolve messages.
Object[] getErrorParameters()
Return the Parameters to the Error.
Creating Custom Exception Classes
You can use Business Component exception classes in your own code to indicate errors, and you can create custom exception classes. For example, you can extend
JboException and override the getProductCode method, making it return values appropriate for your exception.
You can throw a JboException by using a statement like this:
throw new JboException("Don't do that.", "101", null );
The drawback to this approach is that the hard-coded error message is not easy to localize.
Localizing Exception Messages
To make an exception localizable into different national languages, use the NLS framework. First, create a resource bundle for your error messages. The following code
example defines a bundle named MyMsgBundle that stores three error messages.
import oracle.jbo.common.util.CheckedListResourceBundle;
public class MyMsgBundle extends CheckedListResourceBundle
// String Constants
public static final String BAD_EMPNO = "101";
public static final String DEPT_NOT_FOUND = "102";
public static final String NOT_IN_DEPT = "103";
* Private 2-D array of key-value pairs
private static final Object[][] sMessageStrings = {
{ BAD_EMPNO, "Invalid employee number." },
{ DEPT_NOT_FOUND, "Department {0} does not exist." }
{ NOT_IN_DEPT, "Employee {0} not found in Department {1}." }
Then you can use the resource bundle class to define a value to pass to the constructor for your exception class or JboException.
throw new JboException(MyMsgBundle.class /* Class of Bundle */,
MyMsgBundle.DEPT_NOT_FOUND /* String Constant */,
new Object[1] { localVar1 } /* Arguments to message */
JboException provides a getLocalizedMessage method which returns the message formatted for the specified locale.
The framework translates the message text when the client calls getLocalizedMessage rather than at creation time because the client may need to present the
message in a number of different languages. This mechanism provides a single point for localizing and formatting messages.
Using JboExceptionHandler
JboExceptionHandler is user-installable exception handler for three-tier applications. When exceptions are br ought over through the piggyback mechanism, the
normal Java language throw does not quite work, because (among other things) the piggyback may have carried back more than one exceptions. Thus, instead of
throwing the exception, a method on the JboExceptionHandler interface is invoked with each exception unloaded from the piggyback.
JboExceptionHandler defines:
void handleException(Exception ex, boolean lastEntryInPiggyback);
Where ex is the exception unloaded from the piggyback and lastEntryInPiggyback is a flag indicating whether the exception was the last entry on the piggyback.
(Note that for two-tier execution there is no piggyback.)
If you do not install your own handler, the default handler is used. The default handler is implemented by the Application Module. (At the interface level,
ApplicationModule implements JboExceptionHandler.) For jbo.client.remote, this implementation ignores the exception if lastEntryInPiggyback is
false. If lastEntryInPiggyback is true, the exception is thrown.
To install your own handler, call the following method on the Application Module interface:
void setExceptionHandler(JboExceptionHandler hndlr);
and pass in your own implementation of the JboExceptionHandler interface.
Marshaling Exceptions
JboException can marshal itself across a network. It handles NLS issues for the middle tier, enabling one instance of a middle-tier component to serve (for example)
French users and English users at the same time.
If your exception contains member data that need to be marshalled, extend JboException and override readObject and writeObject. The Java serialization
mechanism uses these methods to serialize/deserialize an object. For example, suppose you have the class MyException (shown below), and you want to carry
memberA and memberB across tiers.
public class MyException extends JboException
int memberA;
String memberB;
Write code like the following in MyException:
private void writeObject(ObjectOutputStream out) throws IOException {
out.writeInt(memberA);
out.writeUTF(mEntityRowHandle);
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
memberA = in.readInt();
memberB = in.readUTF();
null

Similar Messages

  • Want to change length validator message and change field format.

    I want to override Length Validator Message as I want to tell the user that phone number
    must contain 10 numbers
    I've added this validator on the phone field
    af:validateLength minimum="10" maximum="10"
                                   hintMinimum="11" hintMaximum="22"
                                   hintNotInRange="33" messageDetailMinimum="44"
                                   messageDetailMaximum="55"
                                   messageDetailNotInRange="66" id="lengthval"/>and this when I enter less than 10 numbers the error message tell that you must enter 10 characters
    I want to override this message to be "you must enter 10 numbers"
    And I want to make this number format like
    XXXX,XXX,XX
    How can I make this.

    Strictly speaking a number in this format is no number. It's a phone number and you should use a regular expression validator for this.
    Check http://docs.oracle.com/cd/E15051_01/apirefs.1111/e12419/tagdoc/af_validateRegExp.html for more info.
    Timo

  • How to keep order of required validation messages while displaying.

    Hi,
    I need to keep required validation messages as in the order of components in the page. Now it not showing properly.
    please let me know , if anybody have the solution.
    Vipin

    hi user,
    am not sure this ah best way.
    but you may try this.
    way organiszed in vo query and attributes in vo. rasinig those errors i think so.
    so you may change the way of an organiszed vo. based on your need.
    and am sure some one post or suggest better comments about this.

  • How to display Entity level validation messages in a table

    I'm using ADF 11g 11.1.1.2.0. I have a page with an updateable table based on an EO. In the EO I have defined some entity level and attribute level declarative business rules. When the user enters a value in the table that violates an attribute level validation, the related message is displayed inline and the attribute is surrounded by a red box. Furthermore the user is not able to place his cursor in a different row. In this way it is clear which row and attribute caused the error. However if the user enters some data that violates an entity level validation, the validation message is displayed as global messages in the message-popup when the business rule is based on a script or a method. This means that the user gets a global message popup, and does not know which row caused the error. Ofcourse we can include the identifying attributes of the row in the error message, but I would like to know if there is another more visual way to communicate to the user which row caused the error.
    Edited by: Jonas de Graaff (PSB) on 10-feb-2010 2:51

    Hi Chittibabu,
    what about using a TreeTable control?
    SAPUI5 SDK - Demo Kit
    Regards
    Tobias

  • Firefox 4.0 doesn't render validation message when editing page process

    Hi there,
    I downloaded and installed Firefox 4.0 this morning. I was using it to edit a PL/SQL page process in one of my applications, and when I applied the changes, rather than returning to the page definition, I was left on the edit process page with no feedback. It turned out that I had introduced an error in the PL/SQL code, but there was no validation message (and my changes of course were not saved). I tried in Chrome (11.0.696.16 beta) and it worked fine (i.e. the validation message displayed - then I corrected the code and applied the changes and was returned to the page definition with positive confirmation of my changes).
    My Apex version is 4.0.1.00.03.
    I don't mind rolling back to the previous version of FF, because some of my add-ons are not yet compatible, but I thought I should raise this question in case others are experiencing this issue. Is there a way around it or a fix?
    Regards,
    Jerry

    Hmm...I actually cannot replicate this now. Also - the "Return to page" checkbox wasn't ticked when it happened earlier (I tried toggling it).
    Has anyone else experienced this?

  • How to stop a process from running and display a message

    I have a button that inserts data into a table based on bind variable selected on the page. I would like to add code to that button that will check to see if certain data already exists in the table, for that bind variable, and if that data already exists, stop the process and display a message that says "you have already inserted that information - bla bla bla". If not, continue inserting. What would be the best way to do this?
    Currently, the button is a plsql that inserts the data.
    Any help or examples would be greatly appreciated!
    mholman
    Edited by: user10488561 on Jul 27, 2009 8:48 AM

    Use a validation process for that. If the validation fails (data exists) the processes will not be run. If it doesn't then the processing will continue.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    ------------------------------------------------------------------------------

  • How to validate concurrent program parameter and display a custom message?

    Hi Friends,
    I have a concurrent program which has two non-mandatory parameters.
    The requirement is that user should provide value for any one of the parameters.
    If user does not enter value for both the parameters, i need to display a custom error message.
    Parameter1 has an independent value set.
    Parameter2 has character value set with validation type as special.
    Process i tried so far:
    In the value set for the second parameter, under the Validate event, i have written the following code:
    FND PLSQL "declare
    l_paramb VARCHAR2(20) := :!VALUE;
    l_parama VARCHAR2(20) := :$FLEX$.MOT_CUSTMSGTST_A;
    BEGIN
    IF 1 = 1  THEN
    fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
    fnd_message.set_token('MESSAGE','Please enter any of the ip1 or ip2');
    fnd_message.raise_error;
    END IF;
    END;" I am not using those variables that are defined for the time being.
    Now since the condition 1=1 is always satisfied, i should always receive the error message.
    I am not receving any error message and i can go ahead and submit the program..
    Please advise on where am i going wrong.
    Reports Version - 6i
    Oracle Apps Version - 11.5.10.2
    Regards,
    Sreekanth Munagala

    Hi srrekanth,,
    I've similar issue , I need to display custom message for concurrent program parameter.Need to validate the parameter & display custom message .
    Can you pl provide solution.

  • How to display all validator messages at the same time?

    Hi Guys,
    I have a form with validators attached to a couple of my input boxes. I tried to write validators which are reusable in other parts of my app ie. social security number check etc. I also then customized the messages and it all works fine.
    But when I submit the form it displays the messages one at a time, in other words every validator is performed and if there was an error the form is rendered. I believe this is how it should behave and that's fine.
    But what if I want all validators to be performed when I submit the form?Then all messages are displayed at the top of the page and the user can make all his changes and try again. This makes more sense to me.
    So my question is whether there is a way to force the page to perform all validators when the page is submitted and then display all error messages in a h:messages tag?
    Cheers and thanks alot
    p.s. i know about and use the hidden input field validator hack which does all validations, but if I do it that way I duplicate the code which does the social security check for all applicable forms.

    Strange, I was under the impression that all validators were run by default. In my JSF apps, all the validators run and output their errors without any special confguration to make this happen.
    I wonder why yours are just running one at a time? Could you show some of your JSP code, and the hidden field validator code?
    CowKing

  • BADI or User Exit validation of operations tab and displaying an error mess

    Hello,
    Could you please let me know the BADI or User Exit validation of operations tab and displaying an error message in iw32
    Thanks,
    Suresh Mgl

    Hi ..
    I tried that user-exit...but i need to block the changes for purchase requisition which is in released stutus..
    .i hope i need to do implicite enchancement spot.....could you please help me to do that..
    Thanks,
    Suresh Mgl

  • How to validate VO result and display error message?

    Hi,
    I have created 2 pages:
    Page 1: User to enter employee number and click 'Go' button to search (redirect to Page 2)
    Page 2: To display employee details
    In situation where employee is suspended, employee detail will be display as blank in Page 2.
    At the same time, we would like to display error message which inform user to refer to HR Department for this scenario.
    Need guidance on how to perform the validation and display error message.
    Thanks and Regards,
    Shiau Chin

    Hi Shiau,
    In this case instead of redirecting to next page, throw an exception on the same page.
    If you want redirect it to next page then while redirecting it to next page pass some info that can indicate that employee is suspended, get this value in Process request if it has value then throw exception else query details.
    Regards,
    Reetesh Sharma

  • Regarding Focus and Validation message on the JDialog

    Hi All,
    Can any body provide the Solution for the below scenario.
    I have a dialog ,on this i have some components like combobx , TextField and check box etc..... and also one OKButton and Cancel button.
    The problem is when i enter some invalid data or with out entering the values in any fields , if i click on ok button a validation message will be displayed stating that perticuler field is mandatory and if i click on that validation message the focus should go to the corresponding field.
    it is not happening some times(i.e the focus is not going to the corresponding field)
    but some times it is happening.
    can u provide a solution or suggest me on this regard.
    Thanks in Advance.
    Regards,
    jeevan.

    Put the request focus code inside this:
    SwingUtilities.invokeLater(new Runnable()
         public void run()
                 //Put the code here to set the focus
    });

  • Validation and displaying as log file

    hi i need to do some validation! actually in my program the delivering country and the import code works as the key. so i need to check that the delivering country and the import code is present in a table t604.(i am updating data from presentation server to an internal table)
    and also i need to check that whether the country of origin is in the table t005 or not.
    if the validations are success then put those into a log file and dsiplay otherwise put the error record in a log file and display and also the total; no of error records and the no of records!!
    can u people plss help me!!

    Dear Sonia,
    u can try this.
    1. Make the dropdown fields mandatory( by changing 'State' property.)
    2. Use the "Check_mandatory_attr_on_view " method...
    Just follow the code........
    data:
    lo_view_controller        TYPE REF TO if_wd_view_controller,
    msg_tab                     TYPE cl_wd_dynamic_tool=>t_check_result_message_tab.
      lo_view_controller = wd_this->wd_get_api( ).
        cl_wd_dynamic_tool=>check_mandatory_attr_on_view(
        EXPORTING
        view_controller = lo_view_controller
        IMPORTING
        messages = msg_tab ).
    Hope this will solve ur purpose. Let me know...
    Regards,
    Aditya.

  • Method Validator is not displaying Error Messages

    Hi!
    I'm using JDeveloper 10.1.3.1.0. I have to validate the value of a particular field in a form, and I've done this via method validator on my Entity Object. If the validation succeeds, I return true; otherwise, I return false as specified in the documentation. The issue is that the error message I added via the wizard is not appearing when my code returns false. I debugged my application and verified that my test case did indeed fail validation and return a false value, but no error message appeared. Furthermore, I tried raising a JboException in this validation code, and it too didn't appear.
    However, when I placed my validation code in the setXXX method of the attribute I was validating, the JboException message was displayed.
    Given that the ADF manual is encouraging developers to place validation code in method validators, I found it strange that any excpetions thrown by method validators colud not displayed.
    Can anyone help clarify this behavior?
    Thanks!
    Rey

    Rey,
    What view technology are you using (JSF, Swing, etc)? If you are using ADF Faces, do you have an af:messages component on the page?
    Regards,
    John

  • Hi, I've recently bought an iPad2 and can't get connected with AppStore or iTunes, when I tap on these icons a grey page pops up saying is loading but never opens the page, no failure message is displayed, it just keep saying is loading. Apparently it is

    Hi, I’ve recently bought an iPad2 and can’t get connected with AppStore or iTunes, when I tap on these icons a grey page pops up saying is loading but never opens the page, no failure message is displayed, it just keep saying is loading.
    Apparently it is not an issue with wifi since Safari, You Tube and Maps work well, I’ve tried some of the tips, e.g. log off/on my Id, change password but no one worked.
    Your help will be highly appreciated.
    Thank you.
    Luis.

    Try a reset. Hold the Sleep and Home button down for about 10 seconds until you see the Apple logo. Ignore the red slider.

  • HT4061 iTunes will not open when my iPhone 4S is attached to my Mac Book Pro. iTunes will start up but as soon as my iPhone appears in the list of devices the program then quits and displays the message 'iTune Quit Unexpectedly'? Can anybody help?

    The Problem/s
    1. I am unable to sync my iPhone 4S with my Mac Book Pro, either by cable, wifi or bluetooth
    2. iTunes will initiall open and briefly identifies the iPhone in the Device section in iTunes.
    3. When iTunes starts to read the iPhone (displaying the spinning wheel), it immediately then quits and
    4. Opens a 'dialogue box' which displays the message "iTunes Quit Unexpectedly"
    5 The dialoge box offers the following button options to:-
    'Show Details'
    The 'Show Details' button will open and display a list of the 'Problem Details and System Configeration'. To the average user the information is useless, as one doesn't know what to look for to solve the problem. This is a long and detailed report (too long to include in this message), which includes information such as:-
    Crashed Thread:  20
    Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes: KERN_INVALID_ADDRESS at 0x00000000000006f0
    'OK'
    The 'Ok' button simply quits and closes the dialogue box
    'Reopen'
    The 'Reopen' button will again reopen iTunes, briefly showing that it is trying to read the iPhone in the Devices section, but then returns again to display the same dialogue box.
    Other Information
    1. iTunes will still start normally once the USB cable is removed from the Mac book Pro, but crashes again once the USB cable is reattached to the computer
    Any advice or help offered would be greatly appreciated.
    Sincerely
    Rob
    Message was edited by: Robmanrico

    Hi there anaqeed,
    I would recommend taking a look at the troubleshooting steps found in the article below.
    Issues installing iTunes or QuickTime for Windows
    http://support.apple.com/kb/ht1926
    -Griff W.

Maybe you are looking for