You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shale.apache.org by Jason Vincent <jt...@gmail.com> on 2006/11/10 01:54:41 UTC

s:token tag as last component.

Hi all,

I've read that the s:token tag must now be the last component in the
form's child compnents.
I was hoping that perhaps there is an autmatic way to get all forms to
use the token tag, without me having to remember to put in the page
source as the last component.

I tried a FormRenderer class that extends the JSF FormRenderer that
attempted to add a Token component as the last child of the form.  It
didn't work - probably since the calling class has already established
the list of components to render without expecting to have new ones
appened.

Any ideas?
Perhaps a s:form tag that has a singleSubmit=true attribute?
Some other way to insert a component in a tree that has already
started to render?

Thanks,
Jason

Re: s:token tag as last component.

Posted by Craig McClanahan <cr...@apache.org>.
On 11/9/06, Jason Vincent <jt...@gmail.com> wrote:
>
> Hi all,
>
> I've read that the s:token tag must now be the last component in the
> form's child compnents.
> I was hoping that perhaps there is an autmatic way to get all forms to
> use the token tag, without me having to remember to put in the page
> source as the last component.
>
> I tried a FormRenderer class that extends the JSF FormRenderer that
> attempted to add a Token component as the last child of the form.  It
> didn't work - probably since the calling class has already established
> the list of components to render without expecting to have new ones
> appened.


It's likely that the issue here was actually the saved state of the
component tree, which has to be calculated BEFORE the page is actually
rendered so that it can be emitted (by the form component) as a hidden
variable if you're using client side state saving.

Any ideas?
> Perhaps a s:form tag that has a singleSubmit=true attribute?
> Some other way to insert a component in a tree that has already
> started to render?


Interesting idea ... and the default should probably be to emit the token by
default, because otherwise there'd be no reason to use the special form
component.

In Shale, we're trying to stay away from becoming yet another library of
visual JSF components; rather, the only components we should have are those
that integrate framework features (like the token, and validators).  Seems
like this would qualify on that standard :-).

In a JSF 1.2 environment, we could put this kind of functionality (add a
token component if necessary) into the createView() method of ViewHandler,
since the entire component tree will have been precreated and we could just
scan for components that are "instanceof UIForm".  Alas, that doesn't work
for 1.1 environments where you're using JSP, since the component tree is
built on the fly.  So, a specialized form component sounds like a reasonable
alternative in the short run.

I've added a new JIRA issue[1] to track this RFE.  Thanks for the
suggestion!

Thanks,
> Jason
>

Craig

[1] https://issues.apache.org/struts/browse/SHALE-329