1、使用java連接LDAP伺服器進行賬號驗證時,當用戶被禁用,返回什麼異常.
Context.SECURITY_PRINCIPAL這個相當於。不給你你怎麼登陸ldap伺服器。估計你能給出客戶給了哪些信息嗎。不需要你全部給出。
2、用java判斷一個IP是否和伺服器聯網,用什麼方法?
static BufferedReader bufferedReader;
public static void main(String[] args) throws IOException {
Scanner input = new Scanner(System.in);
System.out.print("請輸入IP(180.97.33.107)或者域名(baidu.com):");
String address = input.next();
try {
Process process = Runtime.getRuntime()
.exec("ping " + address+" -t");//-t可以去掉
bufferedReader = new BufferedReader(new InputStreamReader(
process.getInputStream()));
String connectionStr =null;
while ((connectionStr = bufferedReader.readLine()) != null) {
System.out.println(connectionStr);
}
} catch (IOException e) {
System.out.println("鏈接失敗");
e.printStackTrace();
} finally {
bufferedReader.close();
}
}
你試試這個代碼
3、如何在Java程序里判斷伺服器是否開啟
你可以運用URL類來連接伺服器ip
4、手機java里有一個軟體安裝不上,說是 驗證伺服器證書失敗,請檢查你的設備的日期設置
我的手機只要取下電池時間就會變,接著就是上不了網,很正常,一般是手機時間變了引起的,把手機時間改到當前時間就可以了。很簡單!
5、java web開發伺服器端表單驗證應寫在哪裡
如果是表單預前嚴整,比如字元符不符合標准,是不是空,這些都應該寫在jsp的<script>中,在onsubmit中調用.
如果是類似判斷密碼正不正確這些,當你選擇struts的時候你可以寫在後台的action中.或者重寫驗證方法.
6、伺服器端 驗證上傳圖片 格式的 正則 (java)
||用字元串判斷性能比正則好,
String imgExt = "jpg|jpeg|png|bmp|GIF|JPG|PNG|JPEG";
imgExt .indexOf("圖片後綴專") >= 0
或者 imgExt .contains("圖片後綴")
這兩種就可以屬
7、java實現一個登錄窗口(socket發送到伺服器,伺服器返回驗證),成功後跳轉到聊天窗口,
我寫了一個模仿qq的 和你這個差不多 代碼很多 有一個客戶端程序和一個專服務端程序 還用到數屬據庫了 要我可以發給你
原理是客戶端發送請求給服務端,
服務端查詢資料庫,處理請求並返回一個指令,
客戶端執行指令。
8、java web 如何防止 用戶繞過js驗證,直接地址欄提交表單或自己編寫html頁面,提交數據到伺服器?
一個簡單的方法是,在用戶獲取html頁面的時候,後台生成一個(MD5)字串(假設為k),並且返回給前端。
提交表單的時候,順帶也把這個k一起提交。
在處理提交的地方(後台),去校驗這個k,看看是不是自己生成的。
如果用戶偽造http請求,那麼自然是不帶k的,或者k是錯誤的。
還可以判斷http請求頭,比如UserAgent之類的,用於 輔 助 判斷請求的合法性。
9、求助:用java語言寫一個用戶登陸系統,伺服器與客服端連接上了,但不會用伺服器驗證用戶信息。往下看。
這個是登錄界面jsp的。你自己連接後台代碼(Action)!祝你好運
<SCRIPT language=JavaScript src="/js/FoshanRen.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
function checkForm(){
var form = document.forms[0];
if(form.username.value=="" || form.username.value.length<6){
alert("請輸入長度6位以上的用戶名");
return false;
}
if(form.password.value=="" || form.password.value.length<6){
alert("請輸入長度6位以上的密碼");
return false;
}
return true;
}
//-->
</SCRIPT>
<style type="text/css">
<!--
.STYLE1 {color: #666666}
.logintitle H2 {
DISPLAY: block; FONT-WEIGHT: bold; FONT-SIZE: 14px; MARGIN: 0px 0px 0px 0px;PADDING:0 0 0 10px;color:#525252
}
.ablue2{
FONT-SIZE: 14px; color:#0066FF
}
-->
</style>
</head>
<body>
<jsp:include page="/WEB-INF/page/share/simpleHead.jsp"/>
<!-- Head End -->
<TABLE cellSpacing=0 cellPadding=0 width=770 align=center border=0>
<TBODY>
<TR><TD background="/images/login/login_03.jpg"> </TD></TR>
</TBODY>
</TABLE>
<br/><c:if test="${!empty message}">
<DIV id="errorinfo">
<TABLE cellSpacing=1 cellPadding=8 width="600" align="center" bgColor="#dd9988" border=0>
<TBODY>
<TR>
<TD bgColor="#ffffd5" align="left"><IMG height="17" src="/images/buy/exclamation-error-red.gif" width="17"> <FONT color="#990000"><STRONG><SPAN class="font14">錯誤提示<BR></SPAN></STRONG></FONT>
<DIV id="errorMessage">${message }</DIV>
</TD>
</TR>
</TBODY>
</TABLE>
</DIV></c:if>
<html:form action="/user/logon" method="post" onsubmit="javascript:return checkForm()">
<INPUT TYPE="hidden" NAME="directUrl" value="${param.directUrl}"/>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
</tr>
<tr>
<td align="center"><table width="80%" border="0" align="center" cellpadding="10" cellspacing="0">
<tr>
<td width="100%" height="50" valign="top"><table width="95%" height="25" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="3%"><img src="/images/global/loginicon1.gif" width="16" height="15" align="absBottom"></td>
<td width="97%" align="left" class="logintitle"><H2>管理員登錄</H2></td>
</tr>
</table> </td>
</tr>
<tr>
<td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="40%" align="right" class="c5"><strong>您的用戶賬號:</strong></td>
<td width="27%"> <input name="username" id="username" type="text" size="20" maxlength="20" /></td>
<td align="left"> </td>
</tr>
<tr>
<td colspan="3" align="right" height="15"></td>
</tr>
<tr>
<td align="right" class="c5"><strong>您的密碼:</strong></td>
<td > <input name="password" type="password" size="20" maxLength="16"> </td>
</tr>
</table> </td>
</tr>
<tr>
<td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
</tr>
</table> </td>
</tr>
<tr>
<td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="34%" align="right"> </td>
<td width="8%" align="left" valign="middle"><input type="image" name="ImageButton1" src="/images/global/regloginbutton2.jpg" alt="" border="0" /> </td>
</tr>
</table> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table></html:form>
10、java聊天室驗證登錄,使用socket向伺服器調用密碼驗證。代碼我給你,基本都搭好了。
你是不會寫jdbc吧