码迷,mamicode.com
首页 > Web开发 > 详细

以jhtml结尾的文件

时间:2015-09-17 16:52:06      阅读:125      评论:0      收藏:0      [点我收藏+]

标签:

用一个实例来说明,直接上代码。

LogonAction.java(一个servlet)

package com.lz.web.action;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class LogonAction extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
   
    public LogonAction() {
        super();
        
    }

	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	
		System.out.println("#####################get######################");
		request.getRequestDispatcher("/result.jsp").forward(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	
		doGet(request, response);
	}

}

  web.xml文件配置

<servlet>
  	<servlet-name>login</servlet-name>
  	<servlet-class>com.lz.web.action.LogonAction</servlet-class>
  </servlet>
  
  <servlet-mapping>
  	<servlet-name>login</servlet-name>
  	<url-pattern>/login.jhtml</url-pattern>
  </servlet-mapping>

  index.jsp

<body>
	 <a href="login.jhtml">登陆</a>
</body>

  result.jsp

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
   <h1>结果页面</h1>
</body>
</html>

  可以实现。

以jhtml结尾的文件

标签:

原文地址:http://www.cnblogs.com/lzeffort/p/4816649.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!