当前位置: 代码迷 >> Java Web开发 >> jsp 登陆后展示获取的用户名
  详细解决方案

jsp 登陆后展示获取的用户名

热度:4865   发布时间:2013-02-25 21:13:42.0
jsp 登陆后显示获取的用户名
Java code
<%                   if (!userlogined) {                %>                    <form action="checklogin.jsp" method="post">                        <input type="hidden" name="action" value="login" />                        <div class="fastlg cl">                            <div class="y pns">                                <table cellspacing="0" cellpadding="0">                                    <tbody>                                        <tr>                                            <td>                                                <label for="username">                                                    用户名                                                </label>                                            </td>                                            <td>                                                <input type="text" name="username" />                                            </td>                                            <td class="fastlg_l">                                                <label for="ls_cookietime">                                                    <input type="checkbox" name="cookietime" id="ls_cookietime"                                                        class="pc" value="2592000" tabindex="903">                                                    自动登录                                                </label>                                            </td>                                        </tr>                                        <tr>                                            <td>                                                <label>                                                    <label for="password">                                                          密码                                                    </label>                                                </label>                                            </td>                                            <td>                                                <input type="password" name="password" />                                            </td>                                            <td class="fastlg_l">                                                <button type="submit" class="pn pnc vm" tabindex="904">                                                    <em>登录</em>                                                </button>                                            </td>                                            <td class="cl">                                                <a href="register.jsp" class="reglink xi2 xw1"><span>立即注册</span>                                                </a>                                            </td>                                        </tr>                                    </tbody>                                </table>                                <input type="hidden" name="quickforward" value="yes">                                <input type="hidden" name="handlekey" value="ls">                            </div>                        </div>                    </form>


这段是把用户名和密码传到另一个页面用来跟数据库里的数据进行比对,如果都正确的话,会把用户名存在session里,
session.setAttribute("userId", userId);
  相关解决方案