You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pham Anh Tuan <an...@ichi-corp.jp> on 2006/01/25 03:23:02 UTC

[HELP] Can't not get parameter when submit a form

Hi all,

I got a problem when I submit a form with setting like below
<form name="postEditFrm" method="POST" enctype="multipart/form-data">

<input type="submit" value="add" onclick='postEditFrm.action="$link.setAction("/addNewPost.do")?myNum=4";postEditFrm.submit;'>

</form>

I can not get the parameter name "myNum" from request.getParameter("myNum") or request.getParameterMap.containsKey("myNum");

I want to get the parameter here because I want to user that parameter "myNum" in reset method of ActionBean.

help me :(

thanks in advance!

bowlkhin

*************************************************
Pham Anh Tuan
Java Developer, HR Assistant
ICHI Corporation Vietnam.
Room #1001, 37 Ton Duc Thang, Dist. 1
Ho Chi Minh City, Vietnam.
Phone: (+84) (08) 9105732
Fax: (+84) (08) 9105734
Cell: (+84) (0) 989 505897
Email: anhtuan@ichi-corp.jp
Website: http://www.ichi-corp.jp
*************************************************

Re: [HELP] Can't not get parameter when submit a form

Posted by Laurie Harper <la...@holoweb.net>.
Pham Anh Tuan wrote:
> Hi all,
> 
> I got a problem when I submit a form with setting like below
> <form name="postEditFrm" method="POST" enctype="multipart/form-data">
> 
> <input type="submit" value="add" onclick='postEditFrm.action="$link.setAction("/addNewPost.do")?myNum=4";postEditFrm.submit;'>
> 
> </form>
> 
> I can not get the parameter name "myNum" from request.getParameter("myNum") or request.getParameterMap.containsKey("myNum");
> 
> I want to get the parameter here because I want to user that parameter "myNum" in reset method of ActionBean.

Maybe you need something like

   <input type="submit" value="add" onclick="this.form.action='
       /addNewPost.do?myNum=4;this.form.submit;" />

L.


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


Re: [HELP] Can't not get parameter when submit a form

Posted by Niall Pemberton <ni...@gmail.com>.
On 1/25/06, Pham Anh Tuan <an...@ichi-corp.jp> wrote:
> Hi all,
>
> I got a problem when I submit a form with setting like below
> <form name="postEditFrm" method="POST" enctype="multipart/form-data">
>
> <input type="submit" value="add" onclick='postEditFrm.action="$link.setAction("/addNewPost.do")?myNum=4";postEditFrm.submit;'>
>
> </form>
>
> I can not get the parameter name "myNum" from request.getParameter("myNum") or request.getParameterMap.containsKey("myNum");
>
> I want to get the parameter here because I want to user that parameter "myNum" in reset method of ActionBean.
>

Mulitpart requests are not parsed until the form population is done
(in the RequestUtils.populate() method) - so when the reset() method
is called any request parameters are not available at that point.

IMO we should separate out the Multipart handling from the form
population - I advocated a separate Command for the mutlitpart stuff
in Struts 1,3, but  at the time it looked like proposed changes to
Commons FileUpload would make that redundant. However the new
fileupload mechanisms never materialized :-(

Niall

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