Skip to Content
author's profile photo Former Member
Former Member

EJB with WD java

Hi All

I have a requirement in which i have to query a database

My Front End is in WD and I am using a java bean model which interacts with stateless session bean fro there connectivity with database happens.

but when in component controller i set the variables of bean model it throws me Null Pointer exception..the value which i am setting when displayed is all right but when i use say

wdContext.nodeMyCommandBean().currentMyCommandBeanElement().setDeptName(dpname);

here MyCommandBean is my java class which i am using as a model and deptName is its one of the variable

It throws a Null Pointer Exception here whereas when i display "dpname " to chk whether it has some data it gives me correct value

Please Help

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 10:17 AM

    Hi Monika,

    Always check the variable value not equal to null and then do process.

    if(dpname!=null)

    wdContext.nodeMyCommandBean().currentMyCommandBeanElement().setDeptName(dpname);

    Regards, Suresh KB

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 10:19 AM

    Hi,

    just check currentMyCommandBeanElement(). is null or not before accessing the

    setDeptName(dpname);

    Regards

    Ayyapparaj

    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.