strus2跳转404,帮忙看一下!
来源:互联网 发布:甲醇产业链网络协会 编辑:程序博客网 时间:2024/06/06 09:27
strus.xml
<?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.devMode" value="true"> </constant> <package name="p2" extends="struts-default"> <default-action-ref name="index"></default-action-ref> <action name="TestAction" class="com.TestAction"> <result name="success">/MyJsp.jsp</result> <result name="input">/index.jsp</result> </action> </package> </struts>
web.xml
<?xml version="1.0" encoding="UTF-8"?><web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <display-name></display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <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>*.do</url-pattern> </filter-mapping></web-app>
TestAction
package com;import com.opensymphony.xwork2.ActionSupport;public class TestAction 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(){if ("zxc".equals(username)&&"asd".equals(password)) {return "success";}else{return INPUT;}}}
index.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%>"> <title>My JSP 'index.jsp' starting page</title><meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><!--<link rel="stylesheet" type="text/css" href="styles.css">--> </head> <body> <form action="TestAction" method="post"> <input name="username" type="text"> <input name="password" type="text"> <input type="submit" value="登录"> </form> </body></html>
jar包
阅读全文
0 0
- strus2跳转404,帮忙看一下!
- 帮忙看一下。谢谢!
- 谁能帮忙看一下
- 有个问题大家帮忙看一下
- iOS GCD问题 帮忙看一下 谢谢
- 新人问题 路过的帮忙看一下
- 有没有大神来帮忙看一下
- 请大家帮忙,帮我看一下.net的这个问题
- 初学PowerDesigner做的一个图,请各们帮忙看一下
- MyEclipse+Tomcat 问题 麻烦各位帮忙看一下
- 大家帮忙看一下这一个sql语句
- 谁能帮忙看一下下面的程序
- 帮忙看一下哪儿错了 头痛 万分感谢
- 帮忙看一下代码有没有内存问题?
- 有哪位熟悉netfilter的,帮忙看一下?
- 帮忙编写一下这道题
- 高手帮忙解决一下
- 请帮忙注释一下
- 编写函数,求出并设置y年m月d日的前一天或后一天的日期(能正确判断闰年)
- 手欠升级后的各种异常处理
- Java多线程
- 【安全问道】系列:3分钟掌握一个互联网安全知识
- JAVA向Mysql插入亿级别数据---测评
- strus2跳转404,帮忙看一下!
- 通过ssh连接本地VMware中的Ubuntu
- nginx location模块--匹配规则
- django初级学习
- Android解决屏幕滑动冲突
- python记录 k-nearest neighbor
- cocos2d-x中流光效果
- 英语辅音音标
- Hadoop2.7.4单机模式/伪分布模式详细配置(Ubuntu)