jun fang created WW-3832:
----------------------------
Summary: Convention cannot work when
"struts.convention.result.flatLayout" set to FALSE
Key: WW-3832
URL: https://issues.apache.org/jira/browse/WW-3832
Project: Struts 2
Issue Type: Bug
Components: Plugin - Convention
Affects Versions: 2.3.4
Environment: vista, tomcat6, maven, struts-convention-plugin,
struts-REST-plugin
Reporter: jun fang
Fix For: 2.3.x
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 "&&"?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira