You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by jcombs346 <jc...@gmail.com> on 2014/08/20 16:26:05 UTC

Pass Variable from Wicket Page to .jsp

New to Wicket.

I'm working on changing web application pages from .jsp to Wicket. With a
button onSubmit() I need to pass a string value to a jsp. Currently with
.jsp this is the function that is called when the "change" button is
pressed:

	function changeRecord() {
		var selectedValue = getSelectedValue();
		if (selectedValue == null)
			return;
		document.forms['pageForm'].method = "get";
		document.forms['pageForm'].action = "record/change";
		document.forms['pageForm'].submit();
	}

The Java Controller for the change page gets the value from the request and
goes from there:

		String value = request.getParameter("value");


I need a way to duplicate this action with Wicket. Any ideas?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Pass-Variable-from-Wicket-Page-to-jsp-tp4667119.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Pass Variable from Wicket Page to .jsp

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

The requirement is not very clear to me..
I guess you have a Wicket page with a Form and you want this form to submit
to an old/JSP page, correct ?
If this is correct then override Form's getActionUrl() to return
"the/path/to/jspPage" (i.e. record/change) and the change button should do:

        function changeRecord() {
                var selectedValue = getSelectedValue();
                if (selectedValue == null)
                        return;
                document.forms['pageForm'].submit(); // or just
this.form.submit();
        }




On Wed, Aug 20, 2014 at 5:26 PM, jcombs346 <jc...@gmail.com> wrote:

> New to Wicket.
>
> I'm working on changing web application pages from .jsp to Wicket. With a
> button onSubmit() I need to pass a string value to a jsp. Currently with
> .jsp this is the function that is called when the "change" button is
> pressed:
>
>         function changeRecord() {
>                 var selectedValue = getSelectedValue();
>                 if (selectedValue == null)
>                         return;
>                 document.forms['pageForm'].method = "get";
>                 document.forms['pageForm'].action = "record/change";
>                 document.forms['pageForm'].submit();
>         }
>
> The Java Controller for the change page gets the value from the request and
> goes from there:
>
>                 String value = request.getParameter("value");
>
>
> I need a way to duplicate this action with Wicket. Any ideas?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Pass-Variable-from-Wicket-Page-to-jsp-tp4667119.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>