SHH整合 报404错误

w420372197 2011-06-18 03:18:34
shh整合的,访问Action的时候报404 错误不知道是那错误了,搞了一上午了,都没搞定,那位帮帮忙,非常感谢。
test.jsp页面
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
</head>
<body>
This is my JSP page. <br>
<a href="empAction!list">Action.List连接</a>
</body>
</html>


Struts.xml文件
<struts>
<constant name="struts.devMode" value="true"></constant>
<constant name="struts.objectFactory"
value="org.apache.struts2.spring.StrutsSpringObjectFactory" />

<package name="struts2springhibernate" extends="struts-default" namespace="/">
<action name="empAction" class="empAction">
<result>/test.jsp</result>
<result name="LIST">/listEmp.jsp</result>
</action>
</package>
</struts>

application.xml文件(配置的action)
<bean id="empAction" class="com.ambow.action.EmpAction">
<property name="empService" ref="empService"></property>
</bean>

报404 错误 不知道怎么搞的 ,急救啊 ...
...全文
108 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
w420372197 2011-06-19
  • 打赏
  • 举报
回复
搞定了,也不知道怎么搞的,我把Struts-core 和xwork两个包更新了下,就没问题了,换回原来的包也行了不知道是怎么高的
draling 2011-06-18
  • 打赏
  • 举报
回复
可能就像楼上所说,改成<a href="empAction!list.action">
但是/就不用要了,因为String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
已经拿到了/

试试吧,有问题再说!!
飞跃颠峰 2011-06-18
  • 打赏
  • 举报
回复
访问路径错误,应该是少写了根目录/,还要加上action后缀
<a href="empAction!list">
改成:
<a href="/empAction!list.action">
飞跃颠峰 2011-06-18
  • 打赏
  • 举报
回复
访问路径错误,应该是少写了根目录/
<a href="empAction!list">
改成:
<a href="/empAction!list">
draling 2011-06-18
  • 打赏
  • 举报
回复
404 的话,那肯定就是访问路径的问题了,检查一下你的访问路径;
贴出来看看!!
cmm4 2011-06-18
  • 打赏
  • 举报
回复
<a href="empAction!list.action">Action.List连接</a>

81,090

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧