Results 1 to 6 of 6
Thread: Bean class error
- 08-15-2008, 07:34 PM #1
Member
- Join Date
- May 2008
- Posts
- 18
- Rep Power
- 0
Bean class error
Can some one tell me why the value from the servlet class is not reaching the bean class?
Here is my servlet
Here is my bean class (StringBean)Java Code:try{ StringBean bean = new StringBean(); bean.setBean(value); request.setAttribute("result", bean); }catch(Exception e){ e.printStackTrace(); }
When I run my program I only see Hi as the output. Some how the value is not reaching the StringBean class.Java Code:package pack01; public class StringBean{ private String answer="Hi"; public void setBean(String value){ answer = value; } public String getBean(){ return(answer); } }
Many thanks
- 08-15-2008, 08:28 PM #2
Have you tried debugging the code by using println()s?
- 08-16-2008, 05:41 AM #3
Member
- Join Date
- May 2008
- Posts
- 18
- Rep Power
- 0
Yes, it works fine. Some how I am not able to transfer the value to StringBean as I am able to get Hi as the output.
Thanks for your help.
- 08-16-2008, 02:00 PM #4
??? Then there is no problem if it works. Is that right?Yes, it works fine.
- 08-16-2008, 03:08 PM #5
Member
- Join Date
- May 2008
- Posts
- 18
- Rep Power
- 0
I think I dint understand your question. What works fine is, when I try to print the value using the servlet it actually prints the value. When use StringBean class, that is from servlet send the value to the StringBean class and then try print the out put, all I get is "Hi", which is the default String variable value in StringBean class.
some how I am not able to transfer the calculated value from the Servlet to the StringBean class and then print it.
by the way, what did you mean by "Have you tried debugging the code by using println()s?"
- 08-16-2008, 03:46 PM #6
Similar Threads
-
How to write a java bean class object to XML file
By Java Tip in forum java.ioReplies: 1Last Post: 01-29-2009, 09:35 AM -
Error deploying Entity Bean
By RobertoWIN_MX in forum Enterprise JavaBeans (EJB)Replies: 0Last Post: 05-01-2008, 05:17 AM -
How to use Inner bean definitions via nested bean elements
By JavaBean in forum Java TipReplies: 0Last Post: 09-26-2007, 08:36 PM -
Error in class
By ai_2007 in forum Advanced JavaReplies: 1Last Post: 07-09-2007, 04:06 PM -
Struts tag error with bean:write
By sandor in forum Web FrameworksReplies: 1Last Post: 04-07-2007, 04:50 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks