You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Antonio Sánchez <ad...@gmail.com> on 2014/05/23 10:58:18 UTC

Default action method for unmatched wildcard actions

Hello.

Given:

         <action name="*Person" class="some.package.PersonAction" 
method="{1}">
                     <result 
name="input">/WEB-INF/jsp/editPerson.jsp</result>
                     <result 
name="success">/WEB-INF/jsp/persons.jsp</result>
         </action>

And url:

         http://localhost:8080/appctx/Person

No matching is found and Struts redirects to "input" result directly. In 
order to recognize "Person" as an action additional configuration is 
required:

         <action name="Person" class="..." method="list">
                     <result 
name="success">/WEB-INF/jsp/persons.jsp</result>
         </action>

Is there anyway of avoiding this extra definition, just using the 
wildcard one?






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


Re: Default action method for unmatched wildcard actions

Posted by Antonio Sánchez <ad...@gmail.com>.
Update:

It works annotating action methods:

OK: /person-edit -> #Action("person-edit") 
com.myapp.action.PersonAction#edit -> person-edit.jsp (WORKS with @Action)

However, automatic method mapping is missing and explicit annotation is 
required.

This way, I guess it is not practical using Conventions plugin for 
designing generic actions. I would be forced to overload and annotate 
each action method.

El 26/05/14 18:00, Antonio Sánchez escribió:
> That's not working for me.
>
> OK:     /person -> com.myapp.actions.PersonAction#execute (SUCCESS) -> 
> person.jsp
>
> FAILS: /person-edit -> com.myapp.action.PersonAction#edit -> 
> person-edit.jsp (FAILS even annotating with @Action)
>
> INSTEAD:/person-edit -> NO ACTION METHOD CALLED -> person-edit.jsp 
> DIRECTLY
>
> However:
>
> OK: /person-edit -> com.myapp.action.PersonEditAction#execute 
> (SUCCESS) -> person-edit.jsp
>
> It seems only "execute" method is able to be found and run, even using 
> @Action annotation: /person-edit is matching 
> PersonEditAction#execute(), but not @Action("edit") PersonAction#edit().
>
> struts.xml has no configuration at all, just devMode. and 
> "struts.convention.result.path".
>
> Using 2.3.16.3.
>
>
>
>
>
> El 26/05/14 11:58, Lukasz Lenart escribió:
>> When you use convention you don't have to use annotation:
>>
>> /person -> com.myapp.actions.Person#execute (SUCCESS) -> person.jsp
>> /person-edit -> com.myapp.action.Person#edit -> person-edit.jsp
>> /person-submit -> com.myapp.actions.Person#submit -> person-submit.jsp
>> || person-input.jsp
>>
>>
>>
>> 2014-05-26 11:41 GMT+02:00 Antonio Sánchez<ad...@gmail.com>:
>>> I'm trying to define a generic/abstract action and extend or 
>>> instantiate it
>>> with specific actions.
>>>
>>> Say a generic/abstract CRUDaction and have UserAction, InvoiceAction 
>>> etc...
>>> to instantiate/extend it.
>>>
>>> I don't see the way to do this using Conventions. I believe it is 
>>> possible
>>> using wildcards. Using conventions I am forced to override abstract 
>>> methods
>>> using Action annotations. But probably I am wrong so, please, let me 
>>> know if
>>> I can use Conventions bearing in mind this design approach.
>>>
>>>
>>>
>>> El vie 23 may 2014 11:06:10 CEST, Lukasz Lenart escribió:
>>>> Why don't use the Convention Plugin?
>>>>
>>>> 2014-05-23 10:58 GMT+02:00 Antonio Sánchez<ad...@gmail.com>:
>>>>> Hello.
>>>>>
>>>>> Given:
>>>>>
>>>>>           <action name="*Person" class="some.package.PersonAction"
>>>>> method="{1}">
>>>>>                       <result
>>>>> name="input">/WEB-INF/jsp/editPerson.jsp</result>
>>>>>                       <result
>>>>> name="success">/WEB-INF/jsp/persons.jsp</result>
>>>>>           </action>
>>>>>
>>>>> And url:
>>>>>
>>>>>           http://localhost:8080/appctx/Person
>>>>>
>>>>> No matching is found and Struts redirects to "input" result 
>>>>> directly. In
>>>>> order to recognize "Person" as an action additional configuration is
>>>>> required:
>>>>>
>>>>>           <action name="Person" class="..." method="list">
>>>>>                       <result
>>>>> name="success">/WEB-INF/jsp/persons.jsp</result>
>>>>>           </action>
>>>>>
>>>>> Is there anyway of avoiding this extra definition, just using the
>>>>> wildcard
>>>>> one?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail:user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail:user-help@struts.apache.org
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail:user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail:user-help@struts.apache.org
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail:user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail:user-help@struts.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:user-unsubscribe@struts.apache.org
>> For additional commands, e-mail:user-help@struts.apache.org
>>
>


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


Re: Default action method for unmatched wildcard actions

Posted by Lukasz Lenart <lu...@apache.org>.
Great!

2014-05-28 9:03 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
> https://issues.apache.org/jira/browse/WW-4353
>
> El mar 27 may 2014 11:58:45 CEST, Lukasz Lenart escribió:
>
>> Yes, please! Thanks!
>>
>> 2014-05-27 11:48 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
>>>
>>> JIRA?
>>>
>>> El mar 27 may 2014 11:45:28 CEST, Lukasz Lenart escribió:
>>>>
>>>>
>>>> 2014-05-27 11:43 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
>>>>>>>
>>>>>>>
>>>>>>> I believe that is not a Conventions feature, but would be great to
>>>>>>> be.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Yeah... just looking into code and looks doable, the problem is it
>>>>>> will probably break backward compatibility :\
>>>>>
>>>>>
>>>>>
>>>>> Struts3?
>>>>
>>>>
>>>>
>>>> S2.5 is closer ;-)
>>>>
>>>>
>>>> Regards
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

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


Re: Default action method for unmatched wildcard actions

Posted by Antonio Sánchez <ad...@gmail.com>.
https://issues.apache.org/jira/browse/WW-4353

El mar 27 may 2014 11:58:45 CEST, Lukasz Lenart escribió:
> Yes, please! Thanks!
>
> 2014-05-27 11:48 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
>> JIRA?
>>
>> El mar 27 may 2014 11:45:28 CEST, Lukasz Lenart escribió:
>>>
>>> 2014-05-27 11:43 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
>>>>>>
>>>>>> I believe that is not a Conventions feature, but would be great to be.
>>>>>
>>>>>
>>>>> Yeah... just looking into code and looks doable, the problem is it
>>>>> will probably break backward compatibility :\
>>>>
>>>>
>>>> Struts3?
>>>
>>>
>>> S2.5 is closer ;-)
>>>
>>>
>>> Regards
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

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


Re: Default action method for unmatched wildcard actions

Posted by Lukasz Lenart <lu...@apache.org>.
Yes, please! Thanks!

2014-05-27 11:48 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
> JIRA?
>
> El mar 27 may 2014 11:45:28 CEST, Lukasz Lenart escribió:
>>
>> 2014-05-27 11:43 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
>>>>>
>>>>> I believe that is not a Conventions feature, but would be great to be.
>>>>
>>>>
>>>> Yeah... just looking into code and looks doable, the problem is it
>>>> will probably break backward compatibility :\
>>>
>>>
>>> Struts3?
>>
>>
>> S2.5 is closer ;-)
>>
>>
>> Regards
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

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


Re: Default action method for unmatched wildcard actions

Posted by Antonio Sánchez <ad...@gmail.com>.
JIRA?

El mar 27 may 2014 11:45:28 CEST, Lukasz Lenart escribió:
> 2014-05-27 11:43 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
>>>> I believe that is not a Conventions feature, but would be great to be.
>>>
>>> Yeah... just looking into code and looks doable, the problem is it
>>> will probably break backward compatibility :\
>>
>> Struts3?
>
> S2.5 is closer ;-)
>
>
> Regards

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


Re: Default action method for unmatched wildcard actions

Posted by Lukasz Lenart <lu...@apache.org>.
2014-05-27 11:43 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
>>> I believe that is not a Conventions feature, but would be great to be.
>>
>> Yeah... just looking into code and looks doable, the problem is it
>> will probably break backward compatibility :\
>
> Struts3?

S2.5 is closer ;-)


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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


Re: Default action method for unmatched wildcard actions

Posted by Antonio Sánchez <ad...@gmail.com>.
El 27/05/14 08:27, Lukasz Lenart escribió:
> 2014-05-27 8:21 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
>>
>> El mar 27 may 2014 08:04:48 CEST, Lukasz Lenart escribió:
>>>
>>> 2014-05-26 18:00 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
>>>>
>>>> That's not working for me.
>>>>
>>>> OK: /person -> com.myapp.actions.PersonAction#execute (SUCCESS) ->
>>>> person.jsp
>>>>
>>>> FAILS: /person-edit -> com.myapp.action.PersonAction#edit ->
>>>> person-edit.jsp
>>>> (FAILS even annotating with @Action)
>>>
>>>
>>> Hm... right, I'm a bit confused I was sure it supposed to work :\
>> I believe that is not a Conventions feature, but would be great to be.
> Yeah... just looking into code and looks doable, the problem is it
> will probably break backward compatibility :\

Struts3?

>
>
> Regards


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


Re: Default action method for unmatched wildcard actions

Posted by Lukasz Lenart <lu...@apache.org>.
2014-05-27 8:21 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
>
>
> El mar 27 may 2014 08:04:48 CEST, Lukasz Lenart escribió:
>>
>>
>> 2014-05-26 18:00 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
>>>
>>>
>>> That's not working for me.
>>>
>>> OK: /person -> com.myapp.actions.PersonAction#execute (SUCCESS) ->
>>> person.jsp
>>>
>>> FAILS: /person-edit -> com.myapp.action.PersonAction#edit ->
>>> person-edit.jsp
>>> (FAILS even annotating with @Action)
>>
>>
>>
>> Hm... right, I'm a bit confused I was sure it supposed to work :\
>
> I believe that is not a Conventions feature, but would be great to be.

Yeah... just looking into code and looks doable, the problem is it
will probably break backward compatibility :\


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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


Re: Default action method for unmatched wildcard actions

Posted by Antonio Sánchez <ad...@gmail.com>.

El mar 27 may 2014 08:04:48 CEST, Lukasz Lenart escribió:
>
> 2014-05-26 18:00 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
>>
>> That's not working for me.
>>
>> OK: /person -> com.myapp.actions.PersonAction#execute (SUCCESS) ->
>> person.jsp
>>
>> FAILS: /person-edit -> com.myapp.action.PersonAction#edit -> 
>> person-edit.jsp
>> (FAILS even annotating with @Action)
>
>
> Hm... right, I'm a bit confused I was sure it supposed to work :\

I believe that is not a Conventions feature, but would be great to be.

>
>>
>> INSTEAD:/person-edit -> NO ACTION METHOD CALLED -> person-edit.jsp 
>> DIRECTLY
>>
>> However:
>>
>> OK: /person-edit -> com.myapp.action.PersonEditAction#execute 
>> (SUCCESS) ->
>> person-edit.jsp
>>
>> It seems only "execute" method is able to be found and run, even using
>> @Action annotation: /person-edit is matching 
>> PersonEditAction#execute(), but
>> not @Action("edit") PersonAction#edit().
>
>
> Try setting
> struts.convention.action.mapAllMatches = true

Already tried; it didn't work.

>
>
> Regards

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


Re: Default action method for unmatched wildcard actions

Posted by Lukasz Lenart <lu...@apache.org>.
2014-05-26 18:00 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
> That's not working for me.
>
> OK:     /person -> com.myapp.actions.PersonAction#execute (SUCCESS) ->
> person.jsp
>
> FAILS: /person-edit -> com.myapp.action.PersonAction#edit -> person-edit.jsp
> (FAILS even annotating with @Action)

Hm... right, I'm a bit confused I was sure it supposed to work :\

> INSTEAD:/person-edit -> NO ACTION METHOD CALLED -> person-edit.jsp DIRECTLY
>
> However:
>
> OK: /person-edit -> com.myapp.action.PersonEditAction#execute (SUCCESS) ->
> person-edit.jsp
>
> It seems only "execute" method is able to be found and run, even using
> @Action annotation: /person-edit is matching PersonEditAction#execute(), but
> not @Action("edit") PersonAction#edit().

Try setting
struts.convention.action.mapAllMatches = true


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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


Re: Default action method for unmatched wildcard actions

Posted by Antonio Sánchez <ad...@gmail.com>.
That's not working for me.

OK:     /person -> com.myapp.actions.PersonAction#execute (SUCCESS) -> 
person.jsp

FAILS: /person-edit -> com.myapp.action.PersonAction#edit -> 
person-edit.jsp (FAILS even annotating with @Action)

INSTEAD:/person-edit -> NO ACTION METHOD CALLED -> person-edit.jsp DIRECTLY

However:

OK: /person-edit -> com.myapp.action.PersonEditAction#execute (SUCCESS) 
-> person-edit.jsp

It seems only "execute" method is able to be found and run, even using 
@Action annotation: /person-edit is matching PersonEditAction#execute(), 
but not @Action("edit") PersonAction#edit().

struts.xml has no configuration at all, just devMode. and 
"struts.convention.result.path".

Using 2.3.16.3.





El 26/05/14 11:58, Lukasz Lenart escribió:
> When you use convention you don't have to use annotation:
>
> /person -> com.myapp.actions.Person#execute (SUCCESS) -> person.jsp
> /person-edit -> com.myapp.action.Person#edit -> person-edit.jsp
> /person-submit -> com.myapp.actions.Person#submit -> person-submit.jsp
> || person-input.jsp
>
>
>
> 2014-05-26 11:41 GMT+02:00 Antonio Sánchez<ad...@gmail.com>:
>> I'm trying to define a generic/abstract action and extend or instantiate it
>> with specific actions.
>>
>> Say a generic/abstract CRUDaction and have UserAction, InvoiceAction etc...
>> to instantiate/extend it.
>>
>> I don't see the way to do this using Conventions. I believe it is possible
>> using wildcards. Using conventions I am forced to override abstract methods
>> using Action annotations. But probably I am wrong so, please, let me know if
>> I can use Conventions bearing in mind this design approach.
>>
>>
>>
>> El vie 23 may 2014 11:06:10 CEST, Lukasz Lenart escribió:
>>> Why don't use the Convention Plugin?
>>>
>>> 2014-05-23 10:58 GMT+02:00 Antonio Sánchez<ad...@gmail.com>:
>>>> Hello.
>>>>
>>>> Given:
>>>>
>>>>           <action name="*Person" class="some.package.PersonAction"
>>>> method="{1}">
>>>>                       <result
>>>> name="input">/WEB-INF/jsp/editPerson.jsp</result>
>>>>                       <result
>>>> name="success">/WEB-INF/jsp/persons.jsp</result>
>>>>           </action>
>>>>
>>>> And url:
>>>>
>>>>           http://localhost:8080/appctx/Person
>>>>
>>>> No matching is found and Struts redirects to "input" result directly. In
>>>> order to recognize "Person" as an action additional configuration is
>>>> required:
>>>>
>>>>           <action name="Person" class="..." method="list">
>>>>                       <result
>>>> name="success">/WEB-INF/jsp/persons.jsp</result>
>>>>           </action>
>>>>
>>>> Is there anyway of avoiding this extra definition, just using the
>>>> wildcard
>>>> one?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail:user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail:user-help@struts.apache.org
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail:user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail:user-help@struts.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:user-unsubscribe@struts.apache.org
>> For additional commands, e-mail:user-help@struts.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:user-unsubscribe@struts.apache.org
> For additional commands, e-mail:user-help@struts.apache.org
>


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


Re: Default action method for unmatched wildcard actions

Posted by Lukasz Lenart <lu...@apache.org>.
When you use convention you don't have to use annotation:

/person -> com.myapp.actions.Person#execute (SUCCESS) -> person.jsp
/person-edit -> com.myapp.action.Person#edit -> person-edit.jsp
/person-submit -> com.myapp.actions.Person#submit -> person-submit.jsp
|| person-input.jsp



2014-05-26 11:41 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
> I'm trying to define a generic/abstract action and extend or instantiate it
> with specific actions.
>
> Say a generic/abstract CRUDaction and have UserAction, InvoiceAction etc...
> to instantiate/extend it.
>
> I don't see the way to do this using Conventions. I believe it is possible
> using wildcards. Using conventions I am forced to override abstract methods
> using Action annotations. But probably I am wrong so, please, let me know if
> I can use Conventions bearing in mind this design approach.
>
>
>
> El vie 23 may 2014 11:06:10 CEST, Lukasz Lenart escribió:
>>
>> Why don't use the Convention Plugin?
>>
>> 2014-05-23 10:58 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
>>>
>>> Hello.
>>>
>>> Given:
>>>
>>>          <action name="*Person" class="some.package.PersonAction"
>>> method="{1}">
>>>                      <result
>>> name="input">/WEB-INF/jsp/editPerson.jsp</result>
>>>                      <result
>>> name="success">/WEB-INF/jsp/persons.jsp</result>
>>>          </action>
>>>
>>> And url:
>>>
>>>          http://localhost:8080/appctx/Person
>>>
>>> No matching is found and Struts redirects to "input" result directly. In
>>> order to recognize "Person" as an action additional configuration is
>>> required:
>>>
>>>          <action name="Person" class="..." method="list">
>>>                      <result
>>> name="success">/WEB-INF/jsp/persons.jsp</result>
>>>          </action>
>>>
>>> Is there anyway of avoiding this extra definition, just using the
>>> wildcard
>>> one?
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

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


Re: Default action method for unmatched wildcard actions

Posted by Antonio Sánchez <ad...@gmail.com>.
Thanks, let me try that.


El 26/05/14 13:16, Christoph Nenning escribió:
>> I'm trying to define a generic/abstract action and extend or
>> instantiate it with specific actions.
>>
>> Say a generic/abstract CRUDaction and have UserAction, InvoiceAction
>> etc... to instantiate/extend it.
>>
>> I don't see the way to do this using Conventions. I believe it is
>> possible using wildcards. Using conventions I am forced to override
>> abstract methods using Action annotations. But probably I am wrong so,
>> please, let me know if I can use Conventions bearing in mind this
>> design approach.
>>
>
> You can use java inheritance for your abstract CrudAction. Only concrete
> actions are used by struts. Whether you confiugre them via XML, convention
> or annotations does not matter.
>
>
> E.g.:
>
> public abstract class CrudAction extends ActionSupport {
>          ...
> }
>
>
> @Action("users")
> public class UserAction extends CrudAction {
>          ...
> }
>
>
> In your URL you would just use "users.action".
>
>
> Regards,
> Christoph
>
>
> This Email was scanned by Sophos Anti Virus
>


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


Re: Default action method for unmatched wildcard actions

Posted by Christoph Nenning <Ch...@lex-com.net>.
> 
> I'm trying to define a generic/abstract action and extend or 
> instantiate it with specific actions.
> 
> Say a generic/abstract CRUDaction and have UserAction, InvoiceAction 
> etc... to instantiate/extend it.
> 
> I don't see the way to do this using Conventions. I believe it is 
> possible using wildcards. Using conventions I am forced to override 
> abstract methods using Action annotations. But probably I am wrong so, 
> please, let me know if I can use Conventions bearing in mind this 
> design approach.
> 


You can use java inheritance for your abstract CrudAction. Only concrete 
actions are used by struts. Whether you confiugre them via XML, convention 
or annotations does not matter.


E.g.:

public abstract class CrudAction extends ActionSupport {
        ...
}


@Action("users")
public class UserAction extends CrudAction {
        ...
}


In your URL you would just use "users.action".


Regards,
Christoph


This Email was scanned by Sophos Anti Virus

Re: Default action method for unmatched wildcard actions

Posted by Antonio Sánchez <ad...@gmail.com>.
I'm trying to define a generic/abstract action and extend or 
instantiate it with specific actions.

Say a generic/abstract CRUDaction and have UserAction, InvoiceAction 
etc... to instantiate/extend it.

I don't see the way to do this using Conventions. I believe it is 
possible using wildcards. Using conventions I am forced to override 
abstract methods using Action annotations. But probably I am wrong so, 
please, let me know if I can use Conventions bearing in mind this 
design approach.



El vie 23 may 2014 11:06:10 CEST, Lukasz Lenart escribió:
> Why don't use the Convention Plugin?
>
> 2014-05-23 10:58 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
>> Hello.
>>
>> Given:
>>
>>          <action name="*Person" class="some.package.PersonAction"
>> method="{1}">
>>                      <result
>> name="input">/WEB-INF/jsp/editPerson.jsp</result>
>>                      <result name="success">/WEB-INF/jsp/persons.jsp</result>
>>          </action>
>>
>> And url:
>>
>>          http://localhost:8080/appctx/Person
>>
>> No matching is found and Struts redirects to "input" result directly. In
>> order to recognize "Person" as an action additional configuration is
>> required:
>>
>>          <action name="Person" class="..." method="list">
>>                      <result name="success">/WEB-INF/jsp/persons.jsp</result>
>>          </action>
>>
>> Is there anyway of avoiding this extra definition, just using the wildcard
>> one?
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

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


Re: Default action method for unmatched wildcard actions

Posted by Lukasz Lenart <lu...@apache.org>.
Why don't use the Convention Plugin?

2014-05-23 10:58 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
> Hello.
>
> Given:
>
>         <action name="*Person" class="some.package.PersonAction"
> method="{1}">
>                     <result
> name="input">/WEB-INF/jsp/editPerson.jsp</result>
>                     <result name="success">/WEB-INF/jsp/persons.jsp</result>
>         </action>
>
> And url:
>
>         http://localhost:8080/appctx/Person
>
> No matching is found and Struts redirects to "input" result directly. In
> order to recognize "Person" as an action additional configuration is
> required:
>
>         <action name="Person" class="..." method="list">
>                     <result name="success">/WEB-INF/jsp/persons.jsp</result>
>         </action>
>
> Is there anyway of avoiding this extra definition, just using the wildcard
> one?
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

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