You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by RogerV <ro...@googlemail.com> on 2009/09/29 09:18:37 UTC

Convention Confusion

Hi

I'm having problems getting my head around how the convention plugin derives
it's URL's. In my jsp I have this snippet

<s:if test="%{ccfGroups[#status.index].id > 0}">
  <s:url value="deletegroup" var="url">
  <s:param name="deleteId" value="%{ccfGroups[#status.index].id}" />
  </s:url>
  <s:submit type="button" label="Delete" action="%{url}"/>  
</s:if>

which generates the HTML snippet

<button type="submit" id="ccfgroup___url_"
name="action:deletegroup?deleteId=3" value="Submit">
Delete
</button>

In my action I have the anotation

@Action("deletegroup")
	public String delete() {
		return "saved";
	}

and config-browser shows that the I have an Action Name of "deletegroup"
defined with a class of
com.vasilikon.actions.EditCCFGroup (which is where I placed the @Action
annotation) and a result type of "saved" defined. However, when I press the
the "delete" button I get the "There is no Action mapped for namespace / and
action name deletegroup?deleteId=" message. 

What am I missing?

Regards
-- 
View this message in context: http://www.nabble.com/Convention-Confusion-tp25658114p25658114.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Convention Confusion [BUG]?

Posted by Roger <ro...@googlemail.com>.
On Wednesday 30 September 2009 18:15:00 Musachy Barroso wrote:
> that is pretty suspicious, can you open a jira ticket with the details?
> 
> thanks
> musachy
> 
Will do. I need to construct a test case to remove all the DB activities etc. 
Is there a site with instructions on how to prepare a jira and where do I go 
to do this - I've never done this before.

Regards

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


Re: Convention Confusion [BUG]?

Posted by RogerV <ro...@googlemail.com>.


Musachy Barroso wrote:
> 
> that is pretty suspicious, can you open a jira ticket with the details?
> 

Logged. I have a demo war file (with source) available, but I couldn't see
where to attach it to the JIRA report.

Regards
-- 
View this message in context: http://www.nabble.com/Convention-Confusion-tp25658114p25732501.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Convention Confusion [BUG]?

Posted by Musachy Barroso <mu...@gmail.com>.
that is pretty suspicious, can you open a jira ticket with the details?

thanks
musachy

On Wed, Sep 30, 2009 at 2:20 AM, RogerV <ro...@googlemail.com> wrote:
>
>
>
> RogerV wrote:
>>
>> I think it's a bug in the way the URL is being interrpreted. I tried your
>> idea setting the namespace attribute on the url tag, made no difference.
>> However if I drop the parameter from the URL then the action gets
>> processed. So
>>
>
> Yep - definite bug. If I change my annotation to
> @Action("deletegroup?deleteId=1") in my action class and then click on the
> corresponding button on the jsp, the action method gets called! If I press
> the next button in the list I get "There is no Action mapped for namespace /
> and action name deletegroup?deleteId=2."
>
> Regards
>
> --
> View this message in context: http://www.nabble.com/Convention-Confusion-tp25658114p25677619.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: Convention Confusion [BUG]?

Posted by RogerV <ro...@googlemail.com>.


RogerV wrote:
> 
> I think it's a bug in the way the URL is being interrpreted. I tried your
> idea setting the namespace attribute on the url tag, made no difference.
> However if I drop the parameter from the URL then the action gets
> processed. So
> 

Yep - definite bug. If I change my annotation to
@Action("deletegroup?deleteId=1") in my action class and then click on the
corresponding button on the jsp, the action method gets called! If I press
the next button in the list I get "There is no Action mapped for namespace /
and action name deletegroup?deleteId=2."

Regards

-- 
View this message in context: http://www.nabble.com/Convention-Confusion-tp25658114p25677619.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Convention Confusion [BUG]?

Posted by RogerV <ro...@googlemail.com>.



Musachy Barroso wrote:
> 
> does adding namespace="/" to the url tag make any difference?
> 
> There is a good chance that it is related to "" vs "/" namespace.
> 
> musachy
> 

I think it's a bug in the way the URL is being interrpreted. I tried your
idea setting the namespace attribute on the url tag, made no difference.
However if I drop the parameter from the URL then the action gets processed.
So

 <s:url value="deletegroup" var="url">
   <s:param name="deleteId" value="%{ccfGroups[#status.index].id}" />
 </s:url>

which is interpretted as 

<button type="submit" id="ccfgroup___url_"
name="action:deletegroup?deleteId=3" value="Submit">Delete
 </button> 

throws a no action mapped exception, but 

<s:url value="deletegroup" var="url"></s:url>

which is interpretted as 
<button type="submit" id="ccfgroup___url_" name="action:deletegroup"
value="Submit">Delete</button>

calls the action deletegroup. I think struts is looking for an action called
"deletegroup?deleteId=3" rather than deletegroup with parameter deleteId.

Which leaves me with the problem of how to display individual "delete"
buttons against a list :(

Regards


-- 
View this message in context: http://www.nabble.com/Convention-Confusion-tp25658114p25676062.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Convention Confusion

Posted by Musachy Barroso <mu...@gmail.com>.
does adding namespace="/" to the url tag make any difference?

There is a good chance that it is related to "" vs "/" namespace.

musachy

On Tue, Sep 29, 2009 at 12:18 AM, RogerV <ro...@googlemail.com> wrote:
>
> Hi
>
> I'm having problems getting my head around how the convention plugin derives
> it's URL's. In my jsp I have this snippet
>
> <s:if test="%{ccfGroups[#status.index].id > 0}">
>  <s:url value="deletegroup" var="url">
>  <s:param name="deleteId" value="%{ccfGroups[#status.index].id}" />
>  </s:url>
>  <s:submit type="button" label="Delete" action="%{url}"/>
> </s:if>
>
> which generates the HTML snippet
>
> <button type="submit" id="ccfgroup___url_"
> name="action:deletegroup?deleteId=3" value="Submit">
> Delete
> </button>
>
> In my action I have the anotation
>
> @Action("deletegroup")
>        public String delete() {
>                return "saved";
>        }
>
> and config-browser shows that the I have an Action Name of "deletegroup"
> defined with a class of
> com.vasilikon.actions.EditCCFGroup (which is where I placed the @Action
> annotation) and a result type of "saved" defined. However, when I press the
> the "delete" button I get the "There is no Action mapped for namespace / and
> action name deletegroup?deleteId=" message.
>
> What am I missing?
>
> Regards
> --
> View this message in context: http://www.nabble.com/Convention-Confusion-tp25658114p25658114.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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