关于struts2的namespace的问题 本帖最后由 wang_liang8888 于 2011-01-31 16:19:01 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 namespace是名称空间,也就是你配置的action的访问的一个入口吧。你要加后缀名才能访问。这是肯定的,但如果你用struts2中的标签,有些它自帮你把.action加上去。 楼上的解答正确,struts的默认配置文件中 配置的是.action,当然这个可以修改,如果使用struts2标签,如s:form action中的属性值可以省略.action。 <package name="User" namespace="/User" extends="wynlink_default"> <action name="*User" class="UserAction" method="{1}"> <result name="success">/WEB-INF/page/user/userList.jsp</result> <result name="toAdd">/WEB-INF/page/user/userAdd.jsp</result> <result name="list" type="redirect">listUser</result> <result name="info">/WEB-INF/page/user/userInfo.jsp</result> <result name="toInfo" type="redirect">infoUser</result> </action> </package>/User/updateUser?id=xxx 你的struts的版本是什么 不同版本的struts版本默认的后缀不同。2.0和2.1不同,你看看jar包里的struts.properties或者default.properties中的struts.action.extension 。如果值是action,就表示后缀是action 如果值是action,,说明不带后缀也可以。 比如struts.action.extension=action,do,,hh, 我记忆中命名空间和.action没有关系啊!struts.properties 中默认就配置了常量:struts.action.extension=action,, <package name="User" namespace="/User" extends="wynlink_default">namespace是访问的路径,其实像你这样的都加个/是不好的! 要像上面的那样写就规范了!还有就是版本的问题! 关于javamail的jar包修改源码,再重新打包时的签名问题. 高手进 绝对具有挑战性的问题没挑战性我出去 spring+hibernate 框架下使用uuid.hex的疑惑 jdom解析xml 提问一下关于写入内存中的问题 火狐使用struts2上传问题 关于线程的问题 如何利用J2EE开发后台服务程序 RMI问题,请高手指教,非常感谢!!! Could not open Hibernate Session for transaction; nested exception is org.hibern jsp如何实现四级联动 咨询eclipse某个功能模块的源代码在哪里
你要加后缀名才能访问。这是肯定的,但如果你用struts2中的标签,有些它自帮你把.action加上去。
楼上的解答正确,struts的默认配置文件中 配置的是.action,当然这个可以修改,如果使用struts2标签,
如s:form action中的属性值可以省略.action。
<action name="*User" class="UserAction" method="{1}">
<result name="success">/WEB-INF/page/user/userList.jsp</result>
<result name="toAdd">/WEB-INF/page/user/userAdd.jsp</result>
<result name="list" type="redirect">listUser</result>
<result name="info">/WEB-INF/page/user/userInfo.jsp</result>
<result name="toInfo" type="redirect">infoUser</result>
</action>
</package>/User/updateUser?id=xxx
namespace是访问的路径,其实像你这样的都加个/是不好的! 要像上面的那样写就规范了!
还有就是版本的问题!