Struts.xml中的Struts的默认包名是什么? [英] What is the default package name for Struts in struts.xml?

查看:238
本文介绍了Struts.xml中的Struts的默认包名是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个新类 RegesterAction ,但是我没有在任何包中保存这个类。我如何在 struts.xml

I created a new class called RegesterAction but I didn't keep this class in any package. How can I configure this class in the struts.xml?

中配置这个类下面是 struts .xml 文件,但我无法理解属性值default struts-default

Below is the struts.xml file but I'm unable to understand the attribute values "default" and struts-default.

<struts>
    <package name="default" extends="struts-default">
        <action name="*Register" method="{1}" class="RegisterAction">
            <result name="populate">/register.jsp</result>
</package>
</struts>


推荐答案

包名称完全独立于您的代码工件。

The package name is completely independent of your code artifacts.

struts-default package是... Struts 2默认包。它定义了默认的结果类型,拦截器,拦截器堆栈和一些其他默认值..你不需要扩展它,但如果你不,你有大量的手动工作

The struts-default package is... the Struts 2 default package. It defines default result types, interceptors, interceptor stacks, and a few other defaults.. You do not need to extend it, but if you don't, you have a fair amount of manual work to do in your own package.

我相信你应该将你的动作类放在一个包中,并且可以认为没有合理的理由反对最佳实践的这样做。同样,您的操作类包完全独立于包名或包延伸的内容(如果有)。

I believe you should put your action classes in a package, and can think of no reasonable argument against the best practice of doing so. Again, your action class packages are completely independent of package names, or what (if any) the package extends.

这篇关于Struts.xml中的Struts的默认包名是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆