本文目錄一覽:
- 1、假設我的index.jsp頁面有一個登錄框,用戶登錄成功後會顯示用戶信息,未登陸時顯示登錄框,如何實現
- 2、請問我用myeclipse中的tomcat插件編寫的index.jsp登陸界面,還有一些相關功能的jsp文件中產生了很多問題
- 3、網頁製作,如何在首頁之前再加一個登錄頁面
- 4、我是用PHP Mysql實現登錄的,怎樣在登陸後由登陸界面跳轉到index.html主頁面並在登陸的地方顯示用戶名
- 5、求asp+access用戶登錄代碼:index.asp為登錄界面,
假設我的index.jsp頁面有一個登錄框,用戶登錄成功後會顯示用戶信息,未登陸時顯示登錄框,如何實現
%
String user = (String)session.getAttribute( “USER” );
if ( user == null || user == “” )
{
%
trtda class=’undecor’遊客你好!請/a/td
tda class=’undecor’ onclick = popSignFlow()
登陸 /a/td
/tr
%
}
else
{
out.println( “歡迎您! ” + user );
out.println( “a href = ‘Logout.jsp’ 退出登陸/a” );
}
%
在後台搭建一個java程序做檢查嘛
然後在xml文件裡面添加路徑
請問我用myeclipse中的tomcat插件編寫的index.jsp登陸界面,還有一些相關功能的jsp文件中產生了很多問題
應該是你的伺服器配置的問題。
大體上的操作是這個樣子的,具體的需要在你的環境下具體配置。
在Eclipse的菜單中如下操作:window–視圖–其他–在彈出的畫面中找到Server並雙擊裡面的選項,之後會在你的Eclipse下方出現Server視圖,在該Server視圖中右鍵,新追加Server,並將你的系統選入到Server中,然後在Server視圖中啟動你的Tomcat伺服器就可以。
在瀏覽器中訪問:項目名稱/index.jsp
網頁製作,如何在首頁之前再加一個登錄頁面
加個登陸頁面其實是不難的, 關鍵在於你做成什麼樣。採用什麼樣的設計,先做好個設計再敲代碼。
我是用PHP Mysql實現登錄的,怎樣在登陸後由登陸界面跳轉到index.html主頁面並在登陸的地方顯示用戶名
通常來說, index 頁面與 login 頁面被設計成兩個頁面,當通過 mysql 查詢數據,並驗證成功登錄後,可以自動轉向 index 頁面(或其他頁面):
if($num){
$row=mysql_fetch_array($result);
$_SESSION[“username”]=$uuser;
header(“Location:index.html”);
在 index 頁面需要添加代碼:例如:
?php
session_start();
//檢測是否登錄,若沒登錄則轉向登錄界面
if(!isset($_SESSION[‘username’])){
header(“Location:login.html”);
exit();
}
echo ‘當前登錄用戶:’ . $_SESSION[‘username’]
求asp+access用戶登錄代碼:index.asp為登錄界面,
index.asp
% If Session(“UserName”)=”” Then %table width=”100%” border=”0″ cellspacing=”0″ cellpadding=”0″
form action=’UserLogin.asp’ method=’post’ name=’UserLogin’ onSubmit=’CheckForm();’ tr
td class=rdiv align=”center”用戶名:/div/td
td input name=”username” type=”text” class=”box” id=”textfield” size=”16″/td
td class=rdiv align=”center”密碼:/div/td
tdinput name=”userpassword” type=”password” class=”box” id=”textfield2″ size=”16″/td
tdinput name=’Login’ type=’submit’ id=’Login’ value=’ 登錄 ‘ input name=’Reset’ type=’reset’ id=’Reset’ value=’ 清除 ‘/td
td /td
td div align=”center”/div/td
/tr/form
/table%
Else response.write ” 歡迎您!” Session(“UserName”)
response.write “a href=’UserLogout.asp’退出/a”
end if
%
UserLogin.asp
!–#include file=”conn.asp”–
%
dim sql
dim rs
dim username
dim userpassword
username=trim(request(“username”))
userpassword=trim(Request(“userpassword”))
set rs=server.createobject(“adodb.recordset”)
sql=”select * from User where username='” username “‘ and userpassword='” userpassword “‘”
rs.open sql,conn,1,3
if not(rs.bof and rs.eof) then
if userpassword=rs(“userpassword”) then
session(“UserName”)=rs(“username”)
Response.Redirect “login.asp”
end if
end if
Response.Write(“script language=””JavaScript””alert(“”用戶名或密碼錯誤!!””);history.go(-1);/script”)
rs.close
conn.close
set rs=nothing
set conn=nothing
%
login.asp
!–#include file=”conn.asp”–
%
UserName=session(“UserName”)
set rs=server.createobject(“adodb.recordset”)
sqltext=”select * from xinxi where user='” UserName “‘”
rs.open sqltext,conn,1,1
%
%= rs(“xinxi”) %
conn.asp
%
dim conn,db
dim connstr
db=”Databases/date.mdb” ‘資料庫文件位置
on error resume next
connstr=”DBQ=”+server.mappath(“”db””)+”;DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};”
set conn=server.createobject(“ADODB.CONNECTION”)
if err then
err.clear
else
conn.open connstr
end if
sub CloseConn()
conn.close
set conn=nothing
end sub
%
還有個推出的
UserLogout.asp
%
session(“UserName”)=””
Response.Redirect “index.asp”
%
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/285909.html