struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Sánchez <ads...@gmail.com>
Subject Re: Default action method for unmatched wildcard actions
Date Mon, 26 May 2014 18:57:31 GMT
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<adsn37@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<adsn37@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


Mime
View raw message