Robert, I followed your advices. Your code works
very well. I have successfully inserted all the
values of my bean properties into the database. Thank
you very much.
--- Robert Taylor [EMAIL PROTECTED] wrote:
The same problem exists, you are calling getters on
a ThreadBean instance
which
Glad it worked for you.
robert
-Original Message-
From: Caroline Jen [mailto:[EMAIL PROTECTED]
Sent: Friday, January 09, 2004 5:12 PM
To: Struts Users Mailing List
Subject: RE: All The Bean Properties Are Null in the Business Tier!!!
(Used BeanUtils to Convert DynaValidatorForm)
Your code seems a bit confusing based upon what you want to
achieve.
If indeed you want ThreadHandler to inherit from ThreadBean,
you should be able to do something like this:
DynaActionForm postForm = ( DynaActionForm )form;
ThreadHander = new ThreadHandler();
BeanUtils.copyProperties(
Thank you for your comment, which is very helpful.
Instead of extends ThreadBean, I now import the
ThreadBean into my ThreadHandler class (see the code
below). I am still getting all null or zero values
from the bean.
What is the proper way to do it? I simply want to
insert the value of all the
The same problem exists, you are calling getters on a ThreadBean instance
which has not yet been populated.
Below three ways to accomplish your goal:
METHOD 1:
Try this (proxy):
public final class ThreadHandler {
MessageDAO md = new MySQLMessageDAO();
public int
I don't think ThreadHandler represents a java.lang.Thread handler.
I think it more or less is a business object to facilitate persistance.
I think the use of the word Thread here is more representative of a
forum discussion thread.
I could be wrong though.
robert
-Original Message-
Robert, you are absolutely right. I am trying to
build a personal message inbox using Struts. I use
the word Thread to represent a discussion topic. My
ThreadHandler is a business tier class. The word
Thread has nothing to do with the java.lang.Thread.
-Caroline
--- Robert Taylor [EMAIL
Have you checked to make sure that the fields you expect
actually exist in the form before calling BeanUtils.populate()?
If so, have you checked to see if the data was copied properly
just after BeanUtils.populate()?
BeanUtils.populate() uses reflection to copy properties.
Are you usingproper
What does BeanUtils.populate(); do? I used
BeanUtils.copyProperties();
Does it make any difference?
--- Robert Taylor [EMAIL PROTECTED] wrote:
Have you checked to make sure that the fields you
expect
actually exist in the form before calling
BeanUtils.populate()?
If so, have you checked
Sorry, I mean copyProperties().
You can find the differences defined below:
http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils
/BeanUtils.html#copyProperties(java.lang.Object, java.lang.Object)
I have narrowed down the problem. Something went
wrong in my business tier class (ThreadHandler.java).
All the properties in the JavaBean are populated
properly (I have checked). The way I coded in the
ThreadHandler class failed to retrieve the value of
all the properties in the JavaBean
11 matches
Mail list logo