找不到namespace和action的问题

mianguiwu2107 2017-11-29 10:57:13
如题,我想要一打开jsp页面就执行一个action,于是在jsp页面写了如下代码
<s:action name="getUser" executeResult="true" namespace="TUserDetail" />
我的TUserDetailAction
@Namespace("/TUserDetail")
@ParentPackage("xproduct")
public class TUserDetailAction extends BaseAction {

@Action("getUser")
public String getUser(){
try {
tuserdetail = tDetailService.findByOpenid(openid);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return SUCCESS;
}

已经写了namespace和action
但是报错[xproduct[ERROR][anonymous|/page/Weixin/user_index.jsp][2017-11-29 10:43:44]| Could not execute action: TUserDetail/getUser
There is no Action mapped for namespace [TUserDetail] and action name [getUser] associated with context path [/xproduct]. - [unknown location]
对了,我用的框架是SSH,strut是用了零配置
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
<!-- constant name="struts.enable.DynamicMethodInvocation" value="false"/ -->
<constant name="struts.devMode" value="false"/>
<constant name="struts.i18n.encoding" value="UTF-8"/>
<constant name="struts.serve.static.browserCache" value="false"/>
<constant name="struts.action.extension" value="do"/>
<constant name="struts.convention.result.path" value="/page" />
<constant name="struts.convention.package.locators" value="action" />
<constant name="struts.convention.action.name.separator" value="-" />
<!-- 设置上传文件的临时文件夹 -->
<constant name="struts.multipart.saveDir" value="d:/tmp"/>
<!-- 设置上传文件上限10M(1M=1048576) -->
<constant name="struts.multipart.maxSize" value="1000000000" />
<package name="xproduct" extends="struts-default">
<result-types>
<result-type name="json" class="org.apache.struts2.json.JSONResult">
<!-- 解决IE下提示下载 -->
<param name="contentType">text/html</param>
</result-type>
<!-- <result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/>
<result-type name="dispatcher" class="org.apache.struts2.dispatcher.ServletDispatcherResult" default="true"/>
<result-type name="freemarker" class="org.apache.struts2.views.freemarker.FreemarkerResult"/>
<result-type name="httpheader" class="org.apache.struts2.dispatcher.HttpHeaderResult"/>
<result-type name="redirect" class="org.apache.struts2.dispatcher.ServletRedirectResult"/>
<result-type name="redirectAction" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"/>
<result-type name="stream" class="org.apache.struts2.dispatcher.StreamResult"/>
<result-type name="velocity" class="org.apache.struts2.dispatcher.VelocityResult"/>
<result-type name="xslt" class="org.apache.struts2.views.xslt.XSLTResult"/>
Deprecated name form scheduled for removal in Struts 2.1.0. The camelCase versions are preferred. See ww-1707
<result-type name="redirect-action" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"/>
<result-type name="plaintext" class="org.apache.struts2.dispatcher.PlainTextResult" /> -->
</result-types>
<interceptors>
<interceptor name="permissionInterceptor" class="cn.com.checknull.interceptor.PermissionInterceptor"></interceptor>
<interceptor name="json" class="org.apache.struts2.json.JSONInterceptor"/>
<interceptor-stack name="xproductStack">
<interceptor-ref name="exception"/>
<interceptor-ref name="alias"/>
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="i18n"/>
<interceptor-ref name="prepare"/>
<interceptor-ref name="chain"/>
<interceptor-ref name="scopedModelDriven"/>
<interceptor-ref name="modelDriven"/>
<interceptor-ref name="fileUpload">
<!-- 配置允许上传的文件类型(2003excel,2007excel)
<param name="allowedTypes">application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</param> -->
<!-- 配置允许上传的文件大小 单位字节 -->
<param name="maximumSize">1000000000</param>
</interceptor-ref>
<interceptor-ref name="checkbox"/>
<interceptor-ref name="multiselect"/>
<interceptor-ref name="staticParams"/>
<interceptor-ref name="actionMappingParams"/>
<interceptor-ref name="params">
<param name="excludeParams">^class\..*,^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,parameters\...*</param>
</interceptor-ref>
<interceptor-ref name="conversionError"/>
<interceptor-ref name="validation">
<param name="excludeMethods">input,back,cancel,browse</param>
</interceptor-ref>
<interceptor-ref name="workflow">
<param name="excludeMethods">input,back,cancel,browse</param>
</interceptor-ref>
<interceptor-ref name="debugging"/>
<interceptor-ref name="json"/>
<interceptor-ref name="permissionInterceptor" />
</interceptor-stack>
</interceptors>

<default-interceptor-ref name="xproductStack" />
<global-results>
<result name="json" type="json">
<param name="root">json</param>
</result>
</global-results>
</package>

</struts>
各位大神助我,怎么解决啊
...全文
81 回复 点赞 打赏 收藏 举报
写回复
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
相关推荐
发帖
Web 开发
加入

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2017-11-29 10:57
社区公告
暂无公告