You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Tim Colson <tc...@cisco.com> on 2003/07/29 18:38:59 UTC

[VELTOOLS] FormTool design

Hey folks -

I've been working a bit with the struts forms tool and find this syntax
a bit cumbersome to explain to my Designer:

## The same can be written as
<input type="text" name="username" value="$form.bean.username">

On the page, there are 1 or more forms... named in the
struts-config.xml, so couldn't we automatigally have them available to
the template?

Ex. FooAction.do has FooForm associated which has a field accessor
getUsername(). 

I think the template should be able to use 
 $form.FooForm.username 
 $FooForm.username
or, perhaps the default form as simply:
 $form.username

I can't recall if this has been discussed before, so perhaps I've just
missed the reasons why this wouldn't be better?


Cheers,
Timo


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


Re: [VELTOOLS] FormTool design

Posted by Nathan Bubna <na...@esha.com>.
Tim Colson said:
...
> Thanks Nathan/Marino for so kindly pointing out my stupidity and somehow
> not reading all of the RTFM on this one. Will I ever learn not to post
> when I first wake up? ;-)

we've all got our brain-dead moments.  RT[F]M is not something i'd ever say to
someone who wrote/enhanced a lot of our documentation.  :)

> As pennance, howabout I do something I suggested a while ago - an
> abbreviated "Users Guide" doc for the Tools?

what if i say "no, i'll only forgive you if you write all the doc suggestions
in STATUS *and* the abbreviated UG!" ?  ;-)   just kidding, of course.  when
it comes to docs, i'm eager for help!

Nathan Bubna
nathan@esha.com


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


RE: [VELTOOLS] FormTool design

Posted by Tim Colson <tc...@cisco.com>.
> FormTool.getBean() is purely a convenience method for those 
> not wishing to
> depend on the form name as specified in the struts-config.  
> it even says so in
> the javadoc for the method.  :)  it simply provides a 
> consistent interface.

Doh!

Thanks Nathan/Marino for so kindly pointing out my stupidity and somehow
not reading all of the RTFM on this one. Will I ever learn not to post
when I first wake up? ;-)

As pennance, howabout I do something I suggested a while ago - an
abbreviated "Users Guide" doc for the Tools? 

-Timo



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


Re: [VELTOOLS] FormTool design

Posted by Nathan Bubna <na...@esha.com>.
Tim Colson said:
...
> I've been working a bit with the struts forms tool and find this syntax
> a bit cumbersome to explain to my Designer:
>
> ## The same can be written as
> <input type="text" name="username" value="$form.bean.username">
...

FormTool.getBean() is purely a convenience method for those not wishing to
depend on the form name as specified in the struts-config.  it even says so in
the javadoc for the method.  :)  it simply provides a consistent interface.

Nathan Bubna
nathan@esha.com


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


Re: [VELTOOLS] FormTool design

Posted by Simon Christian <si...@stoutstick.com>.
Hi Tim,

I've only been using velstruts for a short while, so excuse me if this 
is out of place, but I just sort of assumed you could use that short 
syntax, and it does seem to work (!) like:

  $!logonForm.username

Where logonForm is defined nowhere but struts-config.xml

- simon


Tim Colson wrote:
> Hey folks -
> 
> I've been working a bit with the struts forms tool and find this syntax
> a bit cumbersome to explain to my Designer:
> 
> ## The same can be written as
> <input type="text" name="username" value="$form.bean.username">
> 
> On the page, there are 1 or more forms... named in the
> struts-config.xml, so couldn't we automatigally have them available to
> the template?
> 
> Ex. FooAction.do has FooForm associated which has a field accessor
> getUsername(). 
> 
> I think the template should be able to use 
>  $form.FooForm.username 
>  $FooForm.username
> or, perhaps the default form as simply:
>  $form.username
> 
> I can't recall if this has been discussed before, so perhaps I've just
> missed the reasons why this wouldn't be better?
> 
> 
> Cheers,
> Timo
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
> 


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


RE: [VELTOOLS] FormTool design

Posted by "Marinó A. Jónsson" <ma...@centrum.is>.
hmm ... the forms _are_ automatically available in the template :)

Ex. FooAction.do has FooForm associated which has a field accessor
getUsername().

You should be able to use
	$FooForm.username

I do it like this in all my projects (aside from the fact I use
DynaActionForms extensively).

cheers,
Marino 

-----Original Message-----
From: Tim Colson [mailto:tcolson@cisco.com] 
Sent: 29. júlí 2003 16:39
To: 'Velocity Developers List'
Subject: [VELTOOLS] FormTool design

Hey folks -

I've been working a bit with the struts forms tool and find this syntax
a bit cumbersome to explain to my Designer:

## The same can be written as
<input type="text" name="username" value="$form.bean.username">

On the page, there are 1 or more forms... named in the
struts-config.xml, so couldn't we automatigally have them available to
the template?

Ex. FooAction.do has FooForm associated which has a field accessor
getUsername(). 

I think the template should be able to use 
 $form.FooForm.username 
 $FooForm.username
or, perhaps the default form as simply:
 $form.username

I can't recall if this has been discussed before, so perhaps I've just
missed the reasons why this wouldn't be better?


Cheers,
Timo


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




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