velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jack-tom <agdefen...@yahoo.com>
Subject Re: FormTool doesn't work
Date Fri, 27 Jun 2008 02:12:51 GMT

chris ,
>>> <html:text property="user.username"/>
in jsp,it works. but in velocity ,it doesn't work.
in User class,it has properties:username and password,and getter,setter
methord.


Christopher Schultz-2 wrote:
> 
> Jack/Jake,
> 
> 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 "$form.name" 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.
> 
> -chris
> 
> 
>  
> 

-- 
View this message in context: http://www.nabble.com/FormTool-doesn%27t-work-tp18106592p18146934.html
Sent from the Velocity - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message