The struts2-convention-plugin-2.1.6
jar file is needed if your are using annotations.
The Convention plug-in
is the one which does everything in the background. The Convention plug-in does the following things.
- By default the Convention plug-in looks for the action classes inside the following packages strut, struts2, action or actions
. Here our package name is com.vaannila.action
. Any package that matches these names will be considered as the root package for the Convention plug-in.
-
The action class should either implement com.opensymphony.xwork2.Action
interface or the name of the action class should end with Action
. Here we extend our WelcomeUser class from com.opensymphony.xwork2.ActionSupport
which inturn implements com.opensymphony.xwork2.Action.
- The Convention plug-in uses the action class name to map the action URL. Here our action class name is WelcomeUser
and the URL is welcome-user
. The plug-in converts the camel case class name to dashes to get the request URL.
- Now the Convention plug-in knows which Action class to call for a
particular request. The next step is to find which result to forward
based on the return value of the execute method. By default the
Convention plug-in will look for result pages in WEB-INF/content
directory.
- Now the Convention plug-in knows where to look for results, but it
doesn't know which file to display inside the content directory. The
Convention plug-in finds this with the help of the result code returned
by the Action class. If "success
" is returned then the Convention plug-in will look for a file name welcome-user-success.jsp or welcome-user.jsp
. It need not be a jsp file it can be even a velocity or freemaker files.
If the result value is "input" it will look for a file name welcome-user-input.jsp or welcome-user-input.vm or welcome-user-input.ftl.
分享到:
相关推荐
struts2-convention-plugin-2.1.6.jar
不论高低版本,要使用struts2-core这个jar包,当又需struts2-convention-plugin.jar时勿必要使两者版本一致哦,否则会有DefError、Unable to read class诸等错误
NULL 博文链接:https://jackroomage.iteye.com/blog/888807
struts2-convention-plugin-2.1.6.jar //2* struts2-spring-plugin-2.1.6.jar //1 xwork-2.1.2.jar //2 xerces-2.6.2.jar //3 xml-apis.jar //3 注:以下包为数据源连接池 相关 用到那个添加相应的包 c3p0-0.9.1.2...
从 Struts 2.1 开始,Struts 2 改为使用 Convention 插件来支持零配置。Convention 插件彻底地抛弃了配置信息,不仅不需要使用 struts.xml 文件进行配置,甚至不需要使用 Annotation 进行配置。而是由 Struts 2 根据...
将 Struts 2 项目下 struts2-convention-plugin-2.1.6.jar、struts2-rest-plugin-2.1.6.jar 两个 JAR 包复制到 Web 应用的 WEB-INF/lib 路径下。 由于 Struts 2 的 REST 插件还需要将提供 XML、JSON 格式的数据,...
1.1.jar,junit-4.5.jar,mysql-connector-java-3.1.13-bin.jar,ognl-2.6.11.jar,slf4j-api-1.5.8.jar,slf4j-nop-1.5.8.jar,spring.jar,struts2-convention-plugin-2.1.6.jar,struts2-core-2.1.6.jar,struts2-spring-...
比较全的java开发包,要用到的朋友可以下载 ...struts2-convention-plugin-2.1.8.1.jar struts2-core-2.1.8.1.jar struts2-embeddedjsp-plugin-2.1.8.1.jar struts2-json-plugin-2.1.8.1.jar xwork-core-2.1.6.jar
commons-fileupload-1.2.1 commons-io-1.3.2 freemarker-2.3.15 ognl-2.7.3 struts2-json-plugin-2.1.8.1 struts2-embeddedjsp-plugin-2.1.8.1 struts2-core-2.1.8.1 ...struts2-spring-plugin-2.1.8.jar
从struts2.1开始,struts2不再推荐使用Codebehind作为零配置插件,而是改为使用Convention插件来支持零配置,和Codebehind相比,Convention插件...1. 将struts-Convention-plugin-2.1.6.jar文件复制到WEB-INF/lib路径下
从struts2.1版本开始,Convention Plugin作为替换替换Codebehind Plugin来实现Struts2的零配置。• 包命名习惯来指定Action位置• 命名习惯制定结果(支持JSP,FreeMarker等)路径• 类名到URL的约定转换• 包名...