velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: FormTool doesn't work
Date Thu, 26 Jun 2008 12:47:41 GMT

jack-tom wrote:
>>> <html:text property="user.username"/>

On second look, shouldn't this be "<html:text property="user.user" />" ?
You have no 'username' property on your bean. Now do you have 
'getPassword'. This could be a problem.

> i have tried:
> #set ($username = $form.bean.user.username )
> #set ($password = $form.bean.user.password )
> <FORM method="POST" action="$link.setAction('/user')">
> name : <INPUT type="text" name="$username">
> password:<INPUT type="password" name="$password">
> but i can't get value in my action or actionform

How about trying what I recommended in my original message:

>>> form = $form
>>> bean = $form.bean
>>> user = $form.bean.user
>>> username = $form.bean.user.username

This will help uncover the problem. Also, please post the code for your 
entire bean class. Also, tell us what "$" returns.

> there are two reason why i do so:
> 1. in action i needn't do:User user=new User();
> user.setUsername(form.getUsername()) .....

Why don't you need to do this? Are you using Struts 1 or Struts 2? I'm 
guessing Struts 1 since S2 shouldn't have ActionForms any longer...

> 2. in actionform there are properties:username,password... and some
> getter,setter method,while in User  
>     class,it has the same.

Please provide the code for those two classes.

> nothing is perfect,may be you are right.

I'm confident that FormTool works. Let me help you figure out what the 
problem is.


View raw message