aspose file tools*
The moose likes JSP and the fly likes Need help in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Need help in JSP" Watch "Need help in JSP" New topic
Author

Need help in JSP

Kartik Talasu
Ranch Hand

Joined: Aug 21, 2009
Posts: 98
Hi All,

Am having a code in JSP, where for one attribute am getting null so its throwing an exception.



For the attribute "uomCharacter" am getting null and its throwing an exception,so in JPS I need to check if its having value then this option else another option.
Please help me how to write the logic for this, as am new for this.

Regards,
Kartik
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Are you sure that the "uomCharacter" property is null and not the iterator variable "i" ?


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Kartik Talasu
Ranch Hand

Joined: Aug 21, 2009
Posts: 98
Yes, I am sure ,uomCharacter is null not the iterator variable i
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Then, try this:

Kartik Talasu
Ranch Hand

Joined: Aug 21, 2009
Posts: 98
Hi Sagar,

Am already getting uomCharacter as null, then in your logic


Here itself it will give null pointer exception, as we are checking (i.null)
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Kartik Talasu wrote:Here itself it will give null pointer exception, as we are checking (i.null)

Can you post the bean on which you're iterating ? I really don't understand how you get a property as a "null" and not its value ? Is "uomCharacter" a map value ?
Kartik Talasu
Ranch Hand

Joined: Aug 21, 2009
Posts: 98
Yes uomCharacter is a map value, in my bean class am having 3 variables time,key and uomCharacter.
Which i mapped them with db values.
For uomCharacter am getting null as i dont have any value in db.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

OK, then try using "empty" operator.


"empty(i.uomCharacter)" will return true if i.uomCharacter is null.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Moving to JSP; this is not related to Struts.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help in JSP