Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in accessing the hidden variable from a jsp page.

 
rammie singh
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi every body.

i am having problem in accesing a hidden variable from a jsp page.

my problem description is



i have a hidden variable "statusHidn" in my jsp page.




i am appending int values of an array into it through javascript function.

the function is as below






now i am trying to access this variable in my servlet as







it is giving null pointer exception when i am trying to assign status[i]=statusInt;


may be there is some problem of String to int conversion. i tried lot's of things but still exception error is coming.

can any body help me please in finding what is the reason for this and what could be the solution.


Thanks and Regards.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because the status array is null--you never assign it to anything.
 
rammie singh
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

initially status[] would be null only.
so what is the solution for this??

Thanks and Regards.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rammie singh wrote:
so what is the solution for this??


you need to initialize right?. or use ArrayList. but dont use like below

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic