struts2-convention-plugin

define interceptors with struts2 annotations

拜拜、爱过 提交于 2019-12-07 14:15:16
问题 I'm trying to use the struts2-convention-plugin which provides java annotations to define struts2 components. With Actions so far so good but how can i use annotations to define interceptors ? (i'm talking of @InterceptorRefs or @InterceptorRef ). Is this even possible ? At the moment i've configured actions with annotations and interceptors with the struts.xml file. Is it possible to completely eliminate the struts.xml file and use a 100% annotation oriented configuration ? 回答1: The struts2

struts.convention.result.path is not working in Struts2

一曲冷凌霜 提交于 2019-12-06 21:19:25
My current project structure is as follows WebContent WEB-INF View TestPage.jsp other JSP pages... My assignment is to put all JSP pages inside folder WEB-INF and do all relative changes in the project. WebContent WEB-INF View TestPage.jsp other JSP pages... So I have to update all result tag in struts.xml <result name="success">/View/TestPage.jsp</result> to <result name="success">/WEB_INF/View/TestPage.jsp</result> After search on web I found a plugin - struts convention plugin to achieve this, But it follows its Naming convention. Can I override Struts convention plugin configuration (that

Why the Exception raised from my Interceptor is not caught by <global-exception-mappings>?

人走茶凉 提交于 2019-12-06 10:21:11
I have a custom Interceptor, from which I throw an Exception; The Action(s) running that Interceptor is managed by Convention plugin; The Exception raised by the Interceptor is globally defined in struts.xml for the package the Action is running into. RESULT: the exception mapping is ignored and I get the Struts Problem Report Struts has detected an unhandled exception: ... Stacktraces java.lang.IllegalArgumentException: my message I guess I'm just missing something stupid... we've already discussed of this in a similar question , but it's still not clear if it can or can't work this way:

struts2 conventions plugin not working properly

自闭症网瘾萝莉.ら 提交于 2019-12-06 06:16:06
问题 I was trying to run the application with convention plugin Struts2. The application was fine with struts.xml configured like this: <struts> <package name="struts2demo" extends="struts-default"> <action name="hey" class="action.CountryAction" method="get"> <result name="success">/index.jsp</result> </action> <action name="add" class="action.CountryAction" method="add"> <result type="redirect" name="success">hey</result> </action> <!-- Add your actions here --> </package> </struts> now I

Struts 2 Convention Plugin and JSP files under WEB-INF

ε祈祈猫儿з 提交于 2019-12-06 05:12:45
When using Struts2 convention plugin, the plugin automatically forwards a hello-world.action request to /WEB-INF/content/hello-world.jsp even if no HelloWorld.java is defined. Please see http://struts.apache.org/release/2.1.x/docs/convention-plugin.html for that. On the other hand, we put JSP files under WEB-INF to avoid any direct access to JSP files. I think this behavior of convention plugin ruins JSP access policy. Any one can make a direct access to a JSP by simply calling a, build on the fly, action. Am I correct?! If yes, can we disable this feature? Roman C No, you are not quite

How set base package to scan subpackages for actions?

ぃ、小莉子 提交于 2019-12-06 03:33:05
How can I tell to Struts 2 convention plugin to scan all subpackages of a package. I tried with this <constant name="struts.convention.action.suffix" value="Controller" /> <constant name="struts.convention.package.locators.basePackage" value="fi.fpf.mvc" /> and this <constant name="struts.convention.action.suffix" value="Controller" /> <constant name="struts.convention.package.locators.basePackage" value="fi.fpf.mvc.*" /> but they don't work. my actions end with "Controller" suffix. Someone knows how to do it? here's my struts.xml : <struts> <constant name="struts.convention.exclude

struts2-rest plugin..making both struts actions + rest actions work together but. giving java.lang.reflect.InvocationTargetException

不想你离开。 提交于 2019-12-06 02:43:36
I am converting my existing struts 2 application to serve through some rest based services also. I have used two plugins, struts2-rest plugin and struts-convention plugin, Along with these I have also used asm.jar because above was giving a class not found exception which was there in asm jar. I want to have both the functionalities as ..my normal struts action mappings should also work along with rest urls. struts.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">

define interceptors with struts2 annotations

梦想的初衷 提交于 2019-12-05 21:57:19
I'm trying to use the struts2-convention-plugin which provides java annotations to define struts2 components. With Actions so far so good but how can i use annotations to define interceptors ? (i'm talking of @InterceptorRefs or @InterceptorRef ). Is this even possible ? At the moment i've configured actions with annotations and interceptors with the struts.xml file. Is it possible to completely eliminate the struts.xml file and use a 100% annotation oriented configuration ? The struts2-convention-plugin doesn't replace XWork and its configuration which is xml based. So you cannot eliminate a

Struts 2 Convention Plugin Define Multiple Parent Packages

十年热恋 提交于 2019-12-02 12:09:50
问题 I'm working on Struts 2 web application, using the Convention Plugin to configure everything via annotations. I'm hitting a snag with some of my action classes, where I'd like to use multiple parent packages. I did find a means of doing it on Apache's site - but that appears to be deprecated. It does not work, throwing back a Type mismatch: cannot convert from String[] to String error. @ParentPackage({"my-parent-package1, my-parent-package2"}) package com.mycompany.myapp.actions import org

Struts 2 convention plugin - upload a file of more than 2 MB

≡放荡痞女 提交于 2019-12-02 09:14:15
问题 If i try to upload a file of more than 2 MB size its error-ed. I found in apache web site saying "There are two separate file size limits. First is struts.multipart.maxSize which comes from the Struts 2 default.properties file. This setting exists for security reasons to prohibit a malicious user from uploading extremely large files to file up your servers disk space. This setting defaults to approximately 2 megabytes and should be adjusted to the maximum size file (2 gigs max) that your will