wood burning stoves 2.0*
The moose likes Struts and the fly likes Problem With Passing Properties of DynaValidatorForm to the Business Tier Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem With Passing Properties of DynaValidatorForm to the Business Tier" Watch "Problem With Passing Properties of DynaValidatorForm to the Business Tier" New topic
Author

Problem With Passing Properties of DynaValidatorForm to the Business Tier

JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
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

Joined: Nov 19, 2000
Posts: 1309
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;
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem With Passing Properties of DynaValidatorForm to the Business Tier