方枪枪的java世界

不要因为风雨飘落就停止了你的脚步,真正的得失就在你的心中。 做喜欢做的事,不轻言放弃!

11 整合spring3和mybatis进行web开发之Hello1Action(类没有RequestMapping猪脚)

Hello1Acction.java
//请注意类上不定义RequestMapping,视图以/开始
@Controller
public class Hello1Action
{
    @RequestMapping("/pub/hello1/helloA")
    public String helloMethodA()
    {
        System.out.println("hello1.helloA");
        return "/pub/hello1/helloA";
    }
   
    @RequestMapping("/pub/hello1/helloB")
    public String helloMethodB()
    {
        System.out.println("hello1.helloB");
        return "/pub/hello1/helloB";
    }
}

WEB-INF/pub/hello1/hello1A.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>天河框架案例演示</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="http://localhost:8080/jxc/skins/default/css/ngmain.css" />
<script language=javascript src="http://localhost:8080/jxc/skins/default/js/ngcommon.js"></script>
<script language="javascript">
function doLogin()
{
 document.form0.action = "<%=request.getContextPath()%>/loginAction!login.action";
 document.form0.method = "post";
 document.form0.submit();
}
</script>
</head>

<body>
<h2>hello1.helloA</h2>

<center>
<div id="footer">
<h5>帮助 | 关于我们 | 使用条款 | 开放平台</h5>
<a href="http://localhost:8080/jxc/welcome.jsp">f_qiangqiang@qq.com</a>
</div>
</center>
</body>
</html>


WEB-INF/pub/hello1/hello1B.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>天河框架案例演示</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="http://localhost:8080/jxc/skins/default/css/ngmain.css" />
<script language=javascript src="http://localhost:8080/jxc/skins/default/js/ngcommon.js"></script>
<script language="javascript">
function doLogin()
{
 document.form0.action = "<%=request.getContextPath()%>/loginAction!login.action";
 document.form0.method = "post";
 document.form0.submit();
}
</script>
</head>

<body>
<h2>hello1.helloB</h2>

<center>
<div id="footer">
<h5>帮助 | 关于我们 | 使用条款 | 开放平台</h5>
<a href="http://localhost:8080/jxc/welcome.jsp">f_qiangqiang@qq.com</a>
</div>
</center>
</body>
</html>

posted on 2012-07-07 15:23 做强大的自己 阅读(157) 评论(0)  编辑  收藏 所属分类: Spring


只有注册用户登录后才能发表评论。


网站导航: