Skip to Content

Null Check while passing Values to Context from UI

Hi All,

I am having around 10 Input fields in the UI from which any no of fields can be filled and sent to back end for a search. Where, none of the fields are mandatory. While sending to back end through Context, i want to pass each one of them as an uppercase String.

Is there any way to avoid Null pointer Exception by using TOUPPER method in this case.

Please Let me know all possible solutions for this Situation..

Thanking in advance,

Debasish

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Nov 18, 2005 at 06:23 AM

    hi Debashish,

    what you can do is pass the values as, wdcontext.currentContextElement().get<yourinputfieldattribute>().toUpperCase();

    regards,

    rahul

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Before converting to the uppercase check to see that it is not null.

      String value = wdContext.currentContextElement().getAttributeAsText("<AtributeName>");
      //Statement suggested by Rahul also works here.
      if(value != null)
       String  upperCaseValue = value.toUpperCase();

  • Posted on Nov 28, 2005 at 12:22 PM

    Hi All,

    Thanks for your Valuable suggestions.

    Regards,

    Debasish

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.