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

来源:百度知道 编辑:UC知道 时间:2024/05/05 07:05:58
jsp 里 登陆后 获取用户名 在首页显示出来 , 放在 首页原来显示登陆 注册链接的 地方
我意思就是 如何在 将 获取的 用户名 或者 昵称 覆盖掉 首页上 “登陆” 的链接 就像起点中文网 登陆那样

汗。这个好简单的,你可以用 程序来判断,是不是session中有,用户名,(已经登陆),在首页那块代码处,用程序进行判断,
我这里没有写,不过有PHP 的,类似的,你自己看着改改
<?php

if(isset($_SESSION['userinfo']))
{
echo "欢迎 <font color=#ff0000>".$_SESSION['userinfo'][0]."</font>  头衔:<font color=#ff0000>".$_SESSION['userinfo'][1]."</font>";
}
else
{
?>
<div id=userinfo>
<div id=nav><a href="index.php">清如许论坛</a> </div>
<p>
<form id=loginform name=login action="loading.php?location=index.php&lastpage=index.php" method=post onSubmit="return checkLogin()">

<input id=username onClick="this.value = ''" tabindex=1 maxlength=40 size=15 value=用户名 name=username>
<input id=password onClick="this.value = ''" tabindex=2 type=password size=10 value=&