Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.4
-
vista, tomcat6, maven, struts-convention-plugin, struts-REST-plugin
-
Patch
Description
The convention cannot work, when i set struts.convention.result.flatLayout" to FALSE
steps:
1. create a struts2 webapp, with struts2-convention-plugin-2.3.4 and struts2-rest-plugin-2.3.4.
2. in struts.xml, i wrote:
<struts> <constant name="struts.convention.action.suffix" value="Controller"/> <constant name="struts.convention.action.mapAllMatches" value="true"/> <constant name="struts.convention.default.parent.package" value="rest-default"/> <constant name="struts.convention.package.locators" value="example"/> <constant name="struts.i18n.reload" value="true"/> <constant name="struts.devMode" value="true"/> <constant name="struts.convention.result.flatLayout" value="false"/> <constant name="struts.convention.classes.reload" value="true" /> <constant name="struts.convention.action.includeJars" value="false" /> <constant name="struts.convention.exclude.packages" value="org.apache.struts.*,org.apache.struts2.*,org.springframework.web.struts.*,org.springframework.web.struts2.*,org.hibernate.*"/> </struts>
3. I entered https://localhost:8080/CONTEXT/users/1, and expected the server return the JSP file located in "..\webapp\WEB-INF\content\users\show.jsp", BUT it cannot found the file.
4. I tried to review the SOURCE, and found that there MIGHTBE something wrong in L363 in DefaultResultMapBuilder.java file.
<pre> /* * $Id: DefaultResultMapBuilder.java 1099705 2011-05-05 07:17:33Z jogep $ */ //... public class DefaultResultMapBuilder implements ResultMapBuilder { //... protected void makeResults(Class<?> actionClass, String path, String resultPrefix, Map<String, ResultConfig> results, PackageConfig packageConfig, Map<String, ResultTypeConfig> resultsByExtension) { if (path.startsWith(resultPrefix)) { int indexOfDot = path.indexOf('.', resultPrefix.length()); // This case is when the path doesn't contain a result code /*L363*/ if (indexOfDot == resultPrefix.length() || !flatResultLayout) { if (LOG.isTraceEnabled()) { LOG.trace("The result file [#0] has no result code and therefore" + " will be associated with success, input and error by default. This might" + " be overridden by another result file or an annotation.", path); } </pre>
5. I wonder that the "||" should be "&&"?
Attachments
Issue Links
- is duplicated by
-
WW-4220 set "struts.convention.result.flatLayout" to false ,that work is wrong
- Closed