• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem With Passing Properties of DynaValidatorForm to the Business Tier

 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, my program compiled OKay. When I ran the application, somehow, the properties of my DynaValidatorForm are not passed from the action class to the business tier and then to the data access tier. Please help me taking a look at what went wrong.
It looks that the validation worked fine:

because when I intentionally left several of the text fields blank and submitted my JSP form, an applet got prompted showing something in those fields are required.
In my action class (see below), I used BeanUtils to copy all the properties of the DynaValidatorForm to a bean (ThreadBean):

I then added a number of properties with pre-defined values to the ThreadBean in the Action class:

I then called a method in a service class ThreadHandler and passing threadBean as the parameter of that method:

In the ThreadHandler class, I first tried to get the values of those properties out of the ThreadBean. It turned out that all the values of those properties are null (see below).

[ January 06, 2004: Message edited by: JiaPei Jen ]
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 (ThreadBean.java). All the values turned out to be null or 0. Now, what
is wrong with the code below?
class ThreadHandler extends ThreadBean
{
String receiver = getReceiver();
String sender = getSender();
String threadTopic = getPostTopic();
String threadBody = getPostBody();
Timestamp threadCreationDate = getThreadCreationDate();
int threadViewCount = getThreadViewCount();
int threadReplyCount = getThreadReplyCount();

public ThreadHandler() {}
MessageDAO md = new MySQLMessageDAO();
public int insertThread( ThreadBean threadBean )
throws MessageDAOSysException, ObjectNotFoundException
{
md.createThread( receiver, sender, threadTopic, threadBody,
threadCreationDate, threadViewCount, threadReplyCount );
int threadID = 0;
.....
.....
return threadID;
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic