JAVA WEB項(xiàng)目的網(wǎng)絡(luò)購物網(wǎng)站源代碼的話,很復(fù)雜的話,肯定是沒有的,你可以去eoe或者安卓巴士網(wǎng)站看看有沒有源碼
創(chuàng)新互聯(lián)專業(yè)為企業(yè)提供肥鄉(xiāng)網(wǎng)站建設(shè)、肥鄉(xiāng)做網(wǎng)站、肥鄉(xiāng)網(wǎng)站設(shè)計(jì)、肥鄉(xiāng)網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)與制作、肥鄉(xiāng)企業(yè)網(wǎng)站模板建站服務(wù),十余年肥鄉(xiāng)做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。
雖然源碼便宜到十塊錢能買一套或者n套了吧,不過10分就想買還是有點(diǎn)too young too sample
想要實(shí)現(xiàn)一個(gè)簡(jiǎn)單的登錄功能的話,可以使用Servlet+jsp來實(shí)現(xiàn),jsp編寫登錄界面和登錄后的要出現(xiàn)信息界面和登錄失敗的信息界面,Servlet類用來對(duì)表單提交的用戶名和密碼進(jìn)行判斷和處理。
具體代碼如下:
Servlet類:
public class DemoServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String loginname = request.getParameter("loginname");
String password = request.getParameter("password");
if(loginname.equals("a") password.equals("a")){
request.setAttribute("msg", "登錄成功");
request.getRequestDispatcher("/loginsuccess.jsp").forward(request, response);
}else{
request.setAttribute("msg", "登錄失敗");
request.getRequestDispatcher("/loginsuccess.jsp").forward(request, response);
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
jsp頁面:
%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
html
head
titleDemo/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"
/head
body
form action="demoServlet" method="post"
input type="text" name="loginname"/br/
input type="password" name="password"/br/
input type="submit" value="登錄"/
/form
/body
/html
登錄信息頁面:
%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%
%@ taglib prefix="c" uri="標(biāo)簽庫地址"%
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
html
head
titleMy JSP 'loginsuccess.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"
/head
body
${msg }
/body
/html
需要介紹一下:登錄信息的這個(gè)頁面中的${msg }是使用jstl標(biāo)簽,需要在jsp頁面中導(dǎo)入jstl標(biāo)簽庫,使用這個(gè)標(biāo)簽庫可以節(jié)省很多代碼量。