struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <lukaszlen...@apache.org>
Subject Re: strange error when migrating to convention plugin - Struts 2.5.20
Date Tue, 29 Jan 2019 07:48:19 GMT
sob., 26 sty 2019 o 05:13 developer researcher
<java.developer.researcher@gmail.com> napisał(a):
>
> I am doing migration tests to convention plugin using a project generated
> with the archetype "struts2-archetype-blank"
>
> After migrating the actions from struts.xml using the @Action annotation, I
> could observe the following:
>
> The line (in a JSP): <link href="<s:url value="*/css/examplecss*"/>"
> rel="stylesheet" type="text/css"/> generates the following error:
>
> ERROR Dispatcher Could not find action or result: /blank/css/examplecss
> There is no Action mapped for namespace [/css] and action name [examplecss]
> associated with context path [/blank]. - [unknown location]
>
> The question is, why does struts look for an action in a reference to a css
> file? I'm not sure if it's a problem of "struts2-archetype-blank" or the
> IDE (Eclipse JEE 2018-12). The css file does not exist but without
> convention plugin (only struts.xml) this strange error does not occur.
>
> I solve the problem by changing the line by <link href="<s:url value="
> */css/examplecss.css*"/>" rel="stylesheet" type="text/css"/> and creating
> the css file, but still it is strange that the problem occurs only when
> using the convention plugin.
>
> What is the reason for this difference of behavior between the actions
> invocation with struts.xml and the convention plugin?

Because the Plugin tries to match all the requests, it knows nothing
about CSS and it tries to handle an incoming request. If you want to
exclude a given request define the below constant in struts.xml

<constant name="struts.action.excludePattern" value="/some/content/.*?" />

https://struts.apache.org/core-developers/static-content.html


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


Mime
View raw message