You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Musachy Barroso (JIRA)" <ji...@apache.org> on 2007/05/10 14:21:43 UTC

[jira] Commented: (WW-1919) submit tag's 'action' property is ignored if enclosing form uses 'ajax' theme (form serialization/dojo problem)

    [ https://issues.apache.org/struts/browse/WW-1919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40960 ] 

Musachy Barroso commented on WW-1919:
-------------------------------------

When the submit tag is used in the ajax theme, the used url must be specified in the "href" attribute, whoch should be constructed using the "url" tag. If the submit tag doesn't have a "href" attribute it will use the one from the enclosing form, see:

http://struts.apache.org/2.x/docs/ajax-tags.html

for details


> submit tag's 'action' property is ignored if enclosing form uses 'ajax' theme (form serialization/dojo problem)
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-1919
>                 URL: https://issues.apache.org/struts/browse/WW-1919
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.6, 2.0.7
>         Environment: Reproduceable on: Firefox 2.0.0.3, Opera 9.20, Internet Explorer 7.0.5730.11
>            Reporter: Jaunius Belickas
>         Assigned To: Musachy Barroso
>
> When using <s:form with 'ajax' theme, <input type="submit" ../> fields are not submitted (not serialized), so "action" attribute of "<s:submit ..>" tag is not effective and default form action is used.
> query string extracted from HTTP headers: someHiddenFldName=val&
> After removing "theme" attribute from "<s:form ..>" tag, HTML input tag's are submitted as expected. Query string from HTTP headers:  someHiddenFldName=val&action%3Afirst=first
> ------------------------------------------------------------------------
> test.jsp:
> <%@ taglib prefix="s" uri="/struts-tags" %>
> <html>
>     <head>
>         <title>Hello World!</title>
>         <s:head theme="ajax"/>
>     </head>
>     <body>
>         <s:form method="post" id="someForm" action="test" theme="ajax">
>         	<s:hidden name="someHiddenFldName" value="val"></s:hidden>
>         	<s:submit 
>         		value="first"
>         		action="first" />
>         	<s:submit 
>         		value="second"
>         		action="second" />
>         </s:form>
>     </body>
> </html>
> struts.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE struts PUBLIC
>     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>     "http://struts.apache.org/dtds/struts-2.0.dtd">
> <struts>
> 	<include file="struts-default.xml" />
>    
>     <package name="default" extends="struts-default">
>        
>         <action name="test" class="test.TestAction" method="test">
>         	<result name="SHOW">jsp/test.jsp</result>
>         </action>
> 		<action name="first" class="test.TestAction" method="first">
>         	<result name="SHOW">jsp/test.jsp</result>
>         </action>
> 		<action name="second" class="test.TestAction" method="second">
>         	<result name="SHOW">jsp/test.jsp</result>
>         </action>
>  </package>
> </struts>
> TestAction.java:
> package test;
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> public class TestAction  {
> 	private static final long serialVersionUID = -1918535468057675686L;
> 	private static final Log log = LogFactory.getLog(TestAction.class);
> 	
> 	public String test()
> 	{
> 		log.debug("=============");
> 		log.debug("[ DEFAULT ] ACTION");
> 		log.debug("=============");
> 		return "SHOW";
> 	}
> 	public void first()
> 	{
> 		log.debug("=============");
> 		log.debug("FIRST ACTION");
> 		log.debug("=============");
> 		
> 	}
> 	public void second()
> 	{
> 		log.debug("=============");
> 		log.debug("SECOND ACTION");
> 		log.debug("=============");
> 	}
> 	
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.