You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Jouravlev <jm...@gmail.com> on 2005/10/06 20:10:15 UTC

[JSF] Is it possible to submit to different URL/page?

I looked up for an attribute of h:commandButton which would allow to
submit to another URL, and I could not find it. All I found was
"action" and "actionListener", which should evaluate to methods, not
to URLs:
http://java.sun.com/j2ee/javaserverfaces/1.1/docs/tlddocs/h/commandButton.html

ASP.NET 1.x does not allow posting to another page. MS fixed this
issue in ASP.NET 2.0

Michael J.

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


Re: [JSF] Is it possible to submit to different URL/page?

Posted by Craig McClanahan <cr...@apache.org>.
On 10/11/05, Michael Jouravlev <jm...@gmail.com> wrote:
>
> So, is it possible to submit a form to another page, either with
> submit button or with a link?


There is no such attribute on the <h:commandButton> or <h:commandLink>
components, because in HTML that is not what determines where the submit
goes -- it's the "action" attribute of the parent form component that
determines that. The only way to do what you're describing is to have some
client side Javascript that goes and messes with the action attribute before
calling document.submit().

Of course, doing this means you're throwing away the current component tree,
so it kind of defeats the purpose of using JSF in the first place. If you
want alternative processing of the same input data based some environmental
conditions, that's whay DI frameworks like Spring or Hivemind let you build
up on the server side -- just use them in the action method that handles the
submit to do what you need, without trying to mess around at the HTML level.

OutputLink does not seem to submit a
> form.


Nope ... that's why <h:commandLink> exists, to provide you something that
looks like a hyperlink but actually does submit the form.

Michael.


Craig

[JSF] Is it possible to submit to different URL/page?

Posted by Michael Jouravlev <jm...@gmail.com>.
So, is it possible to submit a form to another page, either with
submit button or with a link? OutputLink does not seem to submit a
form.

Michael.

---------- Forwarded message ----------
I looked up for an attribute of h:commandButton which would allow to
submit to another URL, and I could not find it. All I found was
"action" and "actionListener", which should evaluate to methods, not
to URLs:
http://java.sun.com/j2ee/javaserverfaces/1.1/docs/tlddocs/h/commandButton.html

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