java - How does Struts2 map URLs to actions? -


i want understand used long time ago, without knowing how works.

when click on hyperlink :

<a href="name_action.action">link</a> 

how struts2 activate action mapped struts.xml file ?

<action name="name_action">     <result type="redirect">web/page.jsp</result> </action> 

struts2 maps urls actions actionmapper.

the actionmapper interface provides mapping between http requests , action invocation requests , vice-versa.

when given httpservletrequest, actionmapper may return null if no action invocation request matches, or may return actionmapping describes action invocation framework try.

the actionmapper not required guarantee actionmapping returned real action or otherwise ensure valid request. accordingly, actionmappers not need consult struts configuration determine if request should mapped.

just requests can mapped http action invocation, opposite true well. however, because http requests (when shown in http responses) must in string form, string returned rather actual request object.


by default, defaultactionmapper used:

default action mapper implementation, using standard *.[ext] (where ext "action") pattern. extension looked struts configuration key struts.action.extension.

note: shouldn't land on jsp directly, dispatching them after being passed through action.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -