幽鬼狼魂 发表于 2008 年 3 月 9 日 20:57:03

发个自己写的JSP处男作

http://117.22.215.236:8080/web/index.jsp

Index.jsp<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
        <head>
                <title>用户登陆页面</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">
        -->
<style type="text/css">
<!--
body {
        margin-top: 0px;
        margin-left: 0px;
}
.Wenzi {
        font-family: "宋体";
        font-size: 12px;
        color: #999999;
}
a {
        font-size: 12px;
        color: #999999;
}
a:link {
        text-decoration: none;
}
a:visited {
        text-decoration: none;
        color: #CCCCCC;
}
a:hover {
        text-decoration: none;
}
a:active {
        text-decoration: none;
}
-->
</style>
        <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
        <script language="javascript">
                function qk(){
                        document.loginUsers.userName.value = "";
                }
        </script>
        </head>

        <body>

                <table width="1004" height="140" border="0" align="center" cellpadding="10"
                        cellspacing="1">
          <tr>
            <td align="center" background="topbackground.gif" bgcolor="#DDF7FF">&nbsp; ; ;</td>
          </tr>
    </table>
                <%@include file="userlogin.jsp" %>
                <table width="760" border="0" align="center" cellpadding="10"
                        cellspacing="1" bgcolor="#ACEBFF">
                        <tr>
                                <td bgcolor="#DDF7FF" class="Wenzi">
                                        上午
                                </td>
                               
                                <td bgcolor="#DDF7FF" class="Wenzi">
                                <label> <a href="?newsID=1">AM8:00~AM9:00</a> </label>
                                </td>
                               
                                <td bgcolor="#DDF7FF" class="Wenzi">
                                <label> <a href="?newsID=2">AM9:00~AM10:00</a> </label>
                                </td>
                                <td bgcolor="#DDF7FF" class="Wenzi">
                                <label> <a href="?newsID=3">AM10:00~AM11:00</a> </label>
                                </td>
                                <td bgcolor="#DDF7FF" class="Wenzi">
                                <label> <a href="?newsID=4">AM11:00~AM12:00</a> </label>
                                </td>
                        </tr>
                        <tr>
                                <td bgcolor="#DDF7FF" class="Wenzi">
                                        下午
                                </td>
                                <td bgcolor="#DDF7FF" class="Wenzi">
                                <label> <a href="?newsID=5">PM12:00~PM2:00</a> </label>
                                </td>
                                <td bgcolor="#DDF7FF" class="Wenzi">
                                <label> <a href="?newsID=6">PM2:00~PM4:00</a> </label>
                                </td>
                                <td bgcolor="#DDF7FF" class="Wenzi">
                                <label> <a href="?newsID=7">PM4:00~PM6:00</a> </label>
                                </td>
                                <td bgcolor="#DDF7FF" class="Wenzi">
                                <label> <a href="?newsID=8">PM6:00~PM12:00</a> </label>
                                </td>
                        </tr>
                </table>
                <table width="760" border="0" align="center" cellpadding="10"
                        cellspacing="1" bgcolor="#CCCCCC">
                        <tr>
                          <td width="145" align="center" bgcolor="#FFFFFF"><img src="1.gif" /></td>
                                <td align="center" bgcolor="#FFFFFF" class="Wenzi">
                                <%
                                String userName1=(String)session.getAttribute("user");
                                String passWord1=(String)session.getAttribute("pass");
                                if(userName1==null || passWord1==null){
                                out.println("您暂时还没有登陆所以无法查看作息时间表,有任何问题请联系管理员!");
                                }else{ %>
                                        <%@ include file="content.jsp" %>
                                        <%} %>
                                </td>
                        </tr>
                </table>
                <p>&nbsp; ; ;
                       
        </p>

        </body>
</html>Content.jsp<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%
        String info = request.getParameter("newsID");
        int infoId = 0;
        String noMsg = "暂时没有信息...";
        String yMsg = "";
        if (info == null) {
                out.println(noMsg);
                return;
        }
        infoId = Integer.parseInt(info.trim());
        switch(infoId){
                case 1:
                        yMsg = "<b>上午8点到九点,睡觉..卧龙一般是在10点左右起床.</b>";
                        break;
                case 2:
                        yMsg = "<b>上午9点到十点,还是睡觉因为只有在10点以后才起来.</b>";
                        break;
                case 3:
                        yMsg = "<b>上午10点到十一点,起床洗漱,然后开电脑..</b>";
                        break;
                case 4:
                        yMsg = "<b>上午11点到12点还是电脑中..12点之后去吃饭..</b>";
                        break;
                case 5:
                        yMsg = "<b>下午12点到2点 在店里等客人来电话..顺便继续电脑</b>";
                        break;
                case 6:
                        yMsg = "<b>下午2点到4点一般是在别人家里修电脑,或者就是在店里继续工作.</b>";
                        break;
                case 7:
                        yMsg = "<b>下午4点到6点去外面转转,或者听歌看电影..</b>";
                        break;
                case 8:
                        yMsg = "<b>6点到12点一般是更新网站时间,对于自己网站的一些问题进行修复或者扩展,添加电影内容..</b>";
                        break;
        }
        out.println(yMsg);
%>Login.jsp<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>

<jsp:useBean id="user" class="com.qinghuait.beans.User" scope="request"></jsp:useBean>
<jsp:setProperty property="*" name="user"/>

<%
String userName=user.getUserName();
String passWord=user.getPassWord();
        if(userName==null || passWord==null){
                out.println("<script>alert('请填写用户名或者密码点击确定返回!');document.location.href('index.jsp');</script>");
               //response.sendRedirect("index.jsp");
                return;
        }else if(userName.equals("admin") && passWord.equals("5xxxx")){
        session.setAttribute("user",userName);
        session.setAttribute("pass",passWord);
        response.sendRedirect("index.jsp");
        }else{
                out.println("<script>alert('抱歉您的用户名密码填写有误点击确定返回!');document.location.href('index.jsp');</script>");
                //response.sendRedirect("index.jsp");
                return;
        }
%>Logout.jsp<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
session.removeAttribute("user");
session.removeAttribute("pass");
response.sendRedirect("index.jsp");
%>userlogin.jsp<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
    <%
   String userName=(String)session.getAttribute("user");
   String passWord=(String)session.getAttribute("pass");
    if(userName==null || passWord==null){
   %>
<table width="760" height="25" border="0" align="center" cellpadding="10"
                        cellspacing="1" class="Wenzi">
          <tr>
            <td align="center" bgcolor="#FFFFFF">
                        <form action="login.jsp" name="loginUsers" method="post">
                                用户名:<input name="userName" type="text" size="15" value="请填写用户名" onFocus="qk();" onBlur="if(document.loginUsers.userName.value==''){document.loginUsers.userName.value = '请填写用户名'}"/>&nbsp; ; ;&nbsp; ; ;&nbsp; ; ;&nbsp; ; ;
                                密 码:<input name="passWord" type="password" size="15" />&nbsp; ; ;&nbsp; ; ;&nbsp; ; ;&nbsp; ; ;
                                <input name="submit" type="submit" value="登陆" />
                        </form>
                        </td>
          </tr>
    </table>
    <%}else{ %>
    <table width="760" height="25" border="0" align="center" cellpadding="10"
                        cellspacing="1" class="Wenzi">
          <tr>
            <td align="center" bgcolor="#FFFFFF">
                        <form action="login.jsp" name="loginUsers">
                                用户名:您好<%=userName %>欢迎您的到来!&nbsp; ; ;&nbsp; ; ;&nbsp; ; ;&nbsp; ; ;
                                <a href="logout.jsp">注销登陆</a>&nbsp; ; ;&nbsp; ; ;&nbsp; ; ;&nbsp; ; ;
                        </form>
                        </td>
          </tr>
    </table>
        <%
        }
       %>

[ 本帖最后由 幽鬼狼魂 于 2008-3-9 21:14 编辑 ]

唐建仁 发表于 2008 年 3 月 9 日 20:57:48

偶来破处

鞑妲 发表于 2008 年 3 月 9 日 21:00:41

头疼

esnak 发表于 2008 年 3 月 9 日 21:01:42

讨厌混合模式

cquyf 发表于 2008 年 3 月 9 日 21:09:31

:lol :lol

幽鬼狼魂 发表于 2008 年 3 月 9 日 21:12:50

原帖由 esnak 于 2008-3-9 21:01 发表 http://www.jgwy.net/images/common/back.gif
讨厌混合模式
处男作嘛:$ 第一次谁都有不熟练的时候..

风之翼灵 发表于 2008 年 3 月 9 日 21:14:21

处男不喜欢 :@

cnys 发表于 2008 年 3 月 9 日 21:23:18

;P

shikey 发表于 2008 年 3 月 9 日 21:38:09

:lol

nuet 发表于 2008 年 3 月 10 日 01:06:42

支持。。。。。。。
页: [1] 2 3
查看完整版本: 发个自己写的JSP处男作