level 1
495300862
楼主
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<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">
</head>
<body>
<font face="幼圆" color="#ff0000" style="background-color: rgb(255, 255, 255);">你好</font><font color="#ff0000">,${user.username}</font>.<br><br><br><a href="login.jsp" title="点击这里登录">登录</a> <a href="logout.jsp" title="点击这里注销">注销</a><br>
</body>
</html>
这是我index.jsp的代码,执行后图是

我在做一个登陆系统,上图是用户看到的第一个界面。这时用户还没有登陆,我想让你好后面的点变成游客,就是现实“你好,游客“。如果登陆后,就变成“你好,xxx“。现在登陆后的界面我已经实现了。

在登陆前怎么加代码判断${user.username}是否为空,如果为空(即是没登陆),就显示“你好,游客”啊。
这段代码加在哪里,怎么加。跪求大神解答!!!!
2016年07月23日 02点07分
1
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<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">
</head>
<body>
<font face="幼圆" color="#ff0000" style="background-color: rgb(255, 255, 255);">你好</font><font color="#ff0000">,${user.username}</font>.<br><br><br><a href="login.jsp" title="点击这里登录">登录</a> <a href="logout.jsp" title="点击这里注销">注销</a><br>
</body>
</html>
这是我index.jsp的代码,执行后图是

我在做一个登陆系统,上图是用户看到的第一个界面。这时用户还没有登陆,我想让你好后面的点变成游客,就是现实“你好,游客“。如果登陆后,就变成“你好,xxx“。现在登陆后的界面我已经实现了。
在登陆前怎么加代码判断${user.username}是否为空,如果为空(即是没登陆),就显示“你好,游客”啊。这段代码加在哪里,怎么加。跪求大神解答!!!!