• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet strange?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I have found some difficulties when i try to connect to EJB 2.0
I use servlet as client which provide some form input lets say 2 text field and 1 submit button.


the problem is when I execute the servlet directly..there is error which indicate Null Exception. when I omit code for accessing bean from bean, the problem doesnt appears.Since I want to connect to EJB so I do it input form based HTML. The problem doesnt appear either.
My question is why servlet detect null exception since i already protect from null with else condition. Is it true that servlet cannot include <form> in its body? Any solution from everyone since I still wanna doing <form> inside servlet.

Thanks, Regrd,
Satriana

 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not think that I understand your question fully but here is what I think,
As you have mentioned that if you remove the bean part of the code you do not get any exception , then I guess that home or bean in the below mentioned code might be null.Can you print the complete stack trace.

AccessBeanHome home=lookupbeanhome();
AccessRemote bean=home.create();
String name=bean.getName();

Why do not you do the stuff in the following manner for cleaner implementation.

Make a HTML to submit data to a servlet.The servlet would get the data and execute the remote method , mean invoking the bean with the input data and then set the reply from the invocation into a bean and set the bean in the request scope and forward it to result jsp .The result jsp might use the bean set in request for displaying the values to the user.
 
reply
    Bookmark Topic Watch Topic
  • New Topic