高手请留步,新手Struts2问题

likai22 2008-01-10 04:37:48
我比着例子做的,却无法执行,报Error 404--Not Found错误,
Action:
package com.test.action;

import com.opensymphony.xwork2.ActionSupport;

public class LoginAction extends ActionSupport {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}

public String execute() throws Exception{
return SUCCESS;
}
}
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<display-name>Struts Blank</display-name>

<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

</web-app>
struts.xml
<!DOCTYPE struts PUBLIC

"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"

"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
<package name="abc" namespace="/abc" extends="struts-default">
<action name="LoginAction" class="com.text.action.LoginAction">
<result>/success.jsp</result>
</action>
</package>

</struts>
用的MyEclipse6.0+Weblogic9+JDK5.0
struts.xml文件放在WebRoot\WEB-INF\classes\下
麻烦请指教!!!
...全文
101 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
smallheadboy 2008-03-17
  • 打赏
  • 举报
回复
你的 action 中的属性名字 要和你的jsp中的对应起来才对。
zj399031930 2008-01-11
  • 打赏
  • 举报
回复
是不是JSP路径写的有问题啊,或者jsp的位置不对
anqini 2008-01-11
  • 打赏
  • 举报
回复
没能力。。。只能给帖子张人气!!
likai22 2008-01-11
  • 打赏
  • 举报
回复
大家帮忙顶一下,路过有分!!
superstorm5 2008-01-11
  • 打赏
  • 举报
回复
BTW:上个回复红色不明显,应该有哪个斜杠吧,struts2的写法不知道,感觉web.xml和路径可能有问题
superstorm5 2008-01-11
  • 打赏
  • 举报
回复
index.jsp 这个页面应该和目录WEB-INF同属一个目录

<welcome-file-list>
<welcome-file> /index.jsp </welcome-file>
</welcome-file-list>
zzxhunter 2008-01-11
  • 打赏
  • 举报
回复
<result> /success.jsp </result>
不对吧,没有说明成功后返回哪里啊?
以下是我的做法(我用的是webwork2):
<result name='SUCCESS' type='forward'> /success.jsp </result>

51,407

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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