Results 1 to 9 of 9
  1. #1
    ducisfirst is offline Member
    Join Date
    May 2014
    Posts
    5
    Rep Power
    0

    Default [Question] Send param in form struts2

    Hi all,
    I want send parameter in form struts2 . I try using code below:
    Java Code:
           <s:form action="Update" > 
    		<s:param name="action" value="submitEdit">action</s:param>
    		<table>
    			<tr>
    				<td>
    					<s:hidden name="objUser.id" value="%{#application.id}"  ></s:hidden>
    					<s:textfield name="objUser.name" value="%{#application.name}"  label="Name"></s:textfield>
    				</td>
    			</tr>
    			<tr>
    				<td>
    					<s:textfield name="objUser.age" value="%{#application.age}"  label="Age"></s:textfield>
    				</td>
    			</tr>
                     <tr>
    				<td colspan="2">
    					<s:submit value="Update">
     
    					</s:submit>
    				</td>
    			</tr>
    HELP ME!

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,015
    Rep Power
    20

    Default Re: [Question] Send param in form struts2

    And?
    What happens when you tried the above?

    Have you looked at the html the above produced in order to see whether there is an obvious problem?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: [Question] Send param in form struts2

    This is like taking your car to a garage and only saying "it has problems, fix it".
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    ducisfirst is offline Member
    Join Date
    May 2014
    Posts
    5
    Rep Power
    0

    Default Re: [Question] Send param in form struts2

    Hi Tools !
    Quote Originally Posted by Tolls View Post
    And?
    What happens when you tried the above?

    Have you looked at the html the above produced in order to see whether there is an obvious problem?
    In handling of file , it don't get param with name="action" . When I send param in struts form , it can don't sended. Can you help me send param to controller struts

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: [Question] Send param in form struts2

    Why not making it a hidden input field?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    ducisfirst is offline Member
    Join Date
    May 2014
    Posts
    5
    Rep Power
    0

    Default Re: [Question] Send param in form struts2

    Quote Originally Posted by gimbal2 View Post
    Why not making it a hidden input field?
    Hi gimbal2 !
    I begginer with struts2 , I want to making with param in struts2, so I don't using hidden field.
    How do you using param ?

  7. #7
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: [Question] Send param in form struts2

    Yes you do, its even in the stuff you posted :s

    Java Code:
    <td>
                 <s:hidden name="objUser.id" value="%{#application.id}"  ></s:hidden> <---- hidden
    You just proved you're copy pasting stuff without knowing how it works. And at this point I'm not going to bother any further, I suggest you get a good book on Struts 2 and learn something.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  8. #8
    Join Date
    Apr 2014
    Posts
    49
    Rep Power
    0

    Default Re: [Question] Send param in form struts2

    change the line <s:param name="action" value="submitEdit">action</s:param>

    to

    <s:param name="action" value="submitEdit"></s:param> or <s:param name="action">submitEdit</s:param>

    for more info go to param

  9. #9
    ducisfirst is offline Member
    Join Date
    May 2014
    Posts
    5
    Rep Power
    0

    Default Re: [Question] Send param in form struts2

    Quote Originally Posted by itswebin@gmail.com View Post
    change the line <s:param name="action" value="submitEdit">action</s:param>

    to

    <s:param name="action" value="submitEdit"></s:param> or <s:param name="action">submitEdit</s:param>

    for more info go to param
    has not been, it don't send param , return NULL

Similar Threads

  1. Replies: 3
    Last Post: 07-23-2014, 08:28 AM
  2. send a form to servlet with a link
    By Gunther34567 in forum JavaServer Pages (JSP) and JSTL
    Replies: 5
    Last Post: 05-31-2012, 09:17 AM
  3. Send post form data into external url
    By Tores in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 02-22-2012, 11:16 AM
  4. How to send value recently selected in the url as a param?
    By clanmilano in forum Web Frameworks
    Replies: 0
    Last Post: 08-01-2011, 08:33 PM
  5. Struts2 :File upload and div on same form
    By saqib in forum Web Frameworks
    Replies: 2
    Last Post: 08-19-2008, 11:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •