1.求jsp登录源码 急急急急急急急急急急急
2.ç½ç«åå°ç®¡çç³»ç»å¦ä½ä½¿ç¨
求jsp登录源码 急急急急急急急急急急急
登陆页面 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. Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>login</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="LoginServlet" method="post">
用户名:<input type="text" name="username" ><br>
密码:<input type="password" name="userpass"><br>
<input type="submit" value="登陆"> <input type="reset" value="取消">
</form>
</body>
</html>
-------------
LoginServlet.java 源码:
package servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class LoginServlet extends HttpServlet {
/
*** Constructor of the object.
*/
public LoginServlet() {
super();
}
/
*** Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/
*** The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//获得jsp页面传输的参数
String username=request.getParameter("username");
String userpass=request.getParameter("userpass");
//判断
if(username.equals("user")&&userpass.equals("")){
response.sendRedirect("1.jsp");
}else if(username.equals("admin")&&userpass.equals("")){
response.sendRedirect("2.jsp");
}else{
response.sendRedirect("index.jsp");
}
}
/
*** The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}
/
*** Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}
}
-------------
1.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. Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP '1.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>
This is 1.jsp <br>
</body>
</html>
-------------
2.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. Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP '1.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>
This is 2.jsp <br>
</body>
</html>
ç½ç«åå°ç®¡çç³»ç»å¦ä½ä½¿ç¨
ç½ç«åå°ç®¡çç³»ç»æä¹ç¨ï¼æè§å¾ä¸ªäººfoosunä¸éï¼å¼æºï¼éåçæç½ç»ç¼ç¨ç人ãASPä¹å¾å¥½ï¼ä½æ¯éè¦å®è£ ç»ä»¶ã详æ 请å¨ä»ä»¬ç论åä¸ç»äºè¯¦ç»å¸®å©ãå½ç¶ï¼ä»ä»¬é½æå è´¹åä»è´¹çç³»ç»ä¾ä½ éæ©ãå®æ¯åå°ç®¡çåæ§å¶æ´ä¸ªç½ç«è¿è¡ãç»´æ¤åæ´æ°çå¹³å°ï¼èåå°åªæä¾å°éçèµæºä¿¡æ¯ç»´æ¤å管çãå ¶ä¸»è¦åè½æ¯è®¾ç½®ç½ç«å称ï¼æ°æ®è·¯å¾ï¼åç§åæ°ï¼æé«ç¨æ·æéãä¸è¬å计ç®æºç®¡çåï¼å®ç°æ¹æ³ä¸æ¯ä¸å¥è¯å°±è½è¯´æ¸ æ¥çï¼ä¸»è¦æ¯éè¿åç§ç¨åºæ¥å®ç°ãç»éä¸ä¸ªç½ç«åå°æä¹ç»éï¼
æ¥éª¤å¦ä¸ï¼
1ãè¦æ³ç»å½ç½ç«åå°ï¼å¦æä½ æ¯ç½ç«ç®¡çåï¼é£ä¹ï¼ä½ å¨åå®äºç½ç«ä¹åï¼ç½ç«å¶ä½æ¹æè ä½ èªå·±ï¼å¦æç½ç«æ¯ä½ èªå·±åçè¯ï¼ç¥ééè¿æä¹æ ·è·¯å¾å°±è½ç»å½åå°ç®¡çç½ç«ï¼ä¸è¬ç管çåç»å½åå°é¾æ¥å½¢å¼æ¯è¿æ ·çï¼http://ä½ çåå/admin/ï¼å½ç¶ï¼è¿ä¸æ¯å¯ä¸çã
æ人ç¥éæä¹è¿å ¥ç½ç«çåå°ï¼ç»´æ¤ç½é¡µä¹ï¼
ä¸è¬æ åµä¸ï¼ä¸è½½çç½ç«æºä»£ç ä¸é带ç说ææ件ï¼æè ä¸è½½é¡µé¢ä¸ç说æï¼ä¼ç»åºé»è®¤ç管çå ¥å£å°å以åé»è®¤çæé«æéå¯ç ãç §æ¤æ¹æ³å³å¯è¿å ¥ç»´æ¤ãåå¦æ¯å·¥ä½ä¸æè æåè¦æ±åå©ï¼ä¸è¬äº¤æ¥çæ¶åä¼ç»ä½ è¿ä¸ªå ³é®æ§çä¸è¥¿ã
ææºç½ç«åå°æä¹å¼ï¼
å½ä½ è°è¯ã建设ç½ç«æè 论åçæ¶åï¼ç½ç«ç¨åºå¤«å¸¦æ说æçãä½ ç°å¨è¿æ ·é®ï¼è¯´æä½ è¿æ²¡å°è¯è°è¯ã
1ãæ¾å°è¿å ¥åå°ç®¡ççç»å½å£æè é¾æ¥ï¼
2ã使ç¨ç½ç«æä¾çé»è®¤ç管çåè´¦å·ç»å½è¿å ¥åå°ï¼è´¦å·ä¸è¬æ¯ï¼ç¨æ·åï¼adminå¯ç ï¼adminï¼æè adminå ·ä½è¦ç使ç¨è¯´æã
ç½ç«åå°ç®¡çç³»ç»æä¹ååºæ¥çï¼
åå°æ¯ASPï¼PHPæJSP建ç«çï¼ä½ çè¿ä¸ªæ¯ä¸å¯è½æåå°åè½çã
1åå°åºäºæµè§å¨è§£éï¼åå°åºäºæå¡å¨è§£éï¼å®å ¨æ¯ä¸¤ç äºï¼
2ç½ä¸æå¾å¤å è´¹çç³»ç»ï¼å¦æä½ è¦æ±ä¸é«ï¼å¯ä»¥ç´æ¥æ¾æºç ç½æå¾å¤åå°å¯ä»¥ç¨ï¼ä½æ¯ï¼é½æ¯è¾LOWï¼
3äºèç½ä¸ï¼å è´¹çä¸è¥¿æ¯æè´µçï¼èæ主æºä¸è¬ä¸å¹´å·¦å³ï¼æ¯æ¯è¾å°ä¸è½ç¨çï¼å¤ªä¾¿å®ç没好å¤ï¼å¤ªè´µçä¹æ²¡æä¹ï¼