⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 9.txt

📁 javamail发送程序
💻 TXT
📖 第 1 页 / 共 4 页
字号:
	hobby=getStr(hobby);
	selfintro=getStr(selfintro);
%>
<%
	String sql="select ID from member where logname='"+logname+"'";
	ResultSet RS=userBean.executeQuery(sql);
	out.println(sql);
	int rowscount=0;
	try
	{
		while(RS.next())
		{
			rowscount++;
		}
	}
	catch(Exception e)
	{

	}
	//count.........
//	out.println(rowscount);
	if(rowscount==0)
	{
		regAttempt=true;
	}else response.sendRedirect("error.jsp");
	if(regAttempt==true)
	{
		String sqlinsert="insert into  member(logname,realname,password,email,gender,phone, problem,answer,province,education,hobbies,selfintro) Values('"+logname+"','"+realname+"','"+passwd1+"', '"+email+"','"+gender+"','"+phone+"','"+problem+"','"+answer+"','"+province+"','"+education+"','"+hobby+"','"+selfintro+"')";
		out.println(sqlinsert);
		userBean.executeQuery(sqlinsert);
		session.setAttribute("username",logname);
		response.sendRedirect("main.jsp");
	}
%>



例程9-6
<%@ page contentType="text/html;charset=gb239" %> 
<%@page language="java" import="java.sql.*"%>
<jsp:useBean id="userBean" scope="page" class="WebMail.conn"/>
<%!
public String getStr(String str)
{
	try
	{
		String temp_p=str;
		byte[] temp_t=temp_p.getBytes("ISO8859-1");
		String temp=new String(temp_t);
		return temp;
	}
	catch(Exception e)
	{
	 
	}
	return "null";
}
%>        
<html>
<head>
	<title>Untitled</title>
</head>

<body>         
  <table align="center" border="0" width="760" cellspacing="0" cellpadding="0" height="355">                  
	<tr>                  
		<td width="150" height="355" valign="top">                  
			                 
		</td>                  
		<td width="10" height="100%"></td>
		<td width="1" height="100%" bgcolor="#3399ff"></td>
		<td width="10" height="100%"></td>
		<td width="589" height="331" valign="top" background="images/bg1.gif">                       
        <table border="0" width="100%" cellspacing="0" cellpadding="0" height="307">                  
          <tr>                  
            <td width="100%" colspan="2" height="20" bgcolor="#3399ff">&nbsp;<font color="#ffffff">取回密码</font>       
			</td>
		  </tr>

	
		  		  	<form action="findpass_ok.jsp" method="post">
			<tr><td align="right" height="32" width="40%">登录名:</td>
            <td>
			  <input type="text" name="logname" value="">
            </td>
          </tr>
          <tr> 
            <td align="right"  height="32">E_mail:</td>
            <td>
              <input type="text" name="email">
            </td>
          </tr>
          <tr> <td colspan="2" align="center">
              <input type="submit" value="找回密码" name="findpass">
            </td>
          </tr>
		  </form>
						<tr> 
			  <td colspan="2" height="150" align="right">&nbsp;</td>
			</tr>
	   
        </table>                  
        </td>
    </tr>
  </table>
</body>
</html>



例程9-7
<%@ page contentType="text/html;charset=gb239" %> 
<%@page language="java" import="java.sql.*"%>
<jsp:useBean id="userBean" scope="page" class="WebMail.conn"/>
<%!
public String getStr(String str)
{
	try
	{
		String temp_p=str;
		byte[] temp_t=temp_p.getBytes("ISO8859-1");
		String temp=new String(temp_t);
		return temp;
	}
	catch(Exception e)
	{
	 
	}
	return "null";
}
%>                 
  <html>
<head>
	<title>Untitled</title>
</head>

<body>                  
        <table border="0" width="100%" cellspacing="0" cellpadding="0" height="">                  
          <tr>                  
            <td width="100%" height="20" bgcolor="#3399ff">&nbsp;<font color="#ffffff">取回密码</font>       
			</td>
		  </tr>
<%!
	String logname,email;
	boolean loginAttempt = false;
	String errorMessage = "";
	//logname = request.getParameter("logname");
//	logpass = request.getParameter("logpass");

%>
<%
if(request.getParameterValues("findpass") != null 
&&request.getParameterValues("logname") != null
&&request.getParameterValues("email") != null)
{
	loginAttempt = true;
}
if (loginAttempt)
{	
	logname=request.getParameter("logname");
	email=request.getParameter("email");
	logname=getStr(logname);
	email=getStr(email);
	String sql="select * from member where logname='"+logname+"' and email='"+email+"'";
	//out.println(sql);
	ResultSet RS=userBean.executeQuery(sql);
	
	int rowscount=0;
	try
	{
		while(RS.next())
		{
			rowscount++;
			errorMessage=RS.getString("password");
		}
	}
	catch(Exception e)
	{

	}
	
	if(rowscount!=0)
	{
		//errorMessage=RS.getString("password");
	}else errorMessage="您的用户名或者email不正确";
}
%>
	<tr><td height="40" >
	<font color=red>您的密码:<%=errorMessage%></font>	
	</td>
	</tr>
			<tr> 
			  <td height="40" >&nbsp;<a href="findpass.jsp">返回</a>
 				&nbsp;<a href="login.jsp">登录</a>
				</td>
			</tr>
	   
        </table>                  
        </td>
    </tr>
  </table>
</body>
</html>



例程9-8
<%
String userID;
userID=(String)session.getAttribute("username");
if(userID==""||userID.equals(""))
{
	response.sendRedirect("login.jsp");
}
%>
<html>
	<head>
		<link rel="stylesheet" href="CssLib/CssForMenu.css">
		<meta http-equiv="Content-Type" content="text/html; charset=gb239">
		<title></title>
		<Script Language=JavaScript src = "menu/FunctionForMenu.js"></Script>
	</head>
	<body scroll="no" style="MARGIN: 0px">
		<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%" id = "tblTotal" Name = "tblTotal">
			<tr>
				<td id="frmMenu" name="frmMenu" nowrap valign="center" align="middle" class=tblLeftbody>
					<iframe id="BoardTitle" name=BoardTitle  style="HEIGHT: 100%; VISIBILITY: inherit; WIDTH: 150px; Z-INDEX: 2" frameborder="0" src="menu/Menu_ new.htm"></iframe>
				</td>
				<td style="WIDTH: 7pt" bgcolor="#336699" onclick="switchSysBar()" class=tblbody>					
					<span class="navPoint" id="switchPoint" title="关闭/开启工具栏">3</span>
				</td>
				<td width="100%"> 
					<iframe id="frmRight" name="frmRight" style="HEIGHT: 100%; VISIBILITY: inherit; WIDTH: 100%; Z-INDEX: 1" frameborder=0 src="welcome.jsp" 
     ></iframe>
				</td>
			</tr>
		</table>
	</body>
</html>



例程9-9
<%
String userID;
userID=(String)session.getAttribute("username");
if(userID==""||userID.equals(""))
{
	response.sendRedirect("login.jsp");
}
%>
<html>
<head>
	<title>Untitled</title>
</head>

<body>
<%=session.getAttribute("username")%>您好,欢迎使用WebMail系统。
</body>
</html>



例程9-10
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb239">
<script Language="JavaScript" src="menu/style_plusminus/menu.js"></script>
</head>

<body bgcolor="#FFFFFF">
 <form name="form1" method="post" action="send.jsp">
  <table width="100%" border="1">
    <tr> 
      <td width="30%"> 
        <div align="right">收件人:</div>
    </td>
      <td width="70%"> 
        <input type="text" name="toID" size="40">
    </td>
  </tr>
  <tr> 
      <td width="30%"> 
        <div align="right">标题:</div>
    </td>
      <td width="70%"> 
        <input type="text" name="title" size="40">
    </td>
  </tr>
  <tr> 
      <td width="30%"> 
        <div align="right">内容:</div>
    </td>
      <td width="70%"> 
        <textarea name="content" cols="80" rows="20"></textarea>
    </td>
  </tr>
  <tr> 
      <td width="30%"> 
        <div align="right">附件:</div>
    </td>
      <td width="70%"> 
       <input type="text" name="fujian" size="40" readonly>
	   <a href=javascript:openwin('upload.jsp')> 上传附件</a>
    </td>
  </tr>
    <tr> 
      <td colspan="2">
	  <div align="center">
        <input type="button" name="Submit" value="发送" onclick="chk()">
        <input type="reset" name="Submit2" value="重写">
<script language="javascript">
			function chk()
			{
				if(document.form1.toID.value=="")
				{
					window.alert("请填写收件人名!");
					window.form1.toID.focus();
					return false;
				}
				if(document.form1.title.value=="")
				{
					window.alert("请填写标题!");
					window.form1.title.focus();
					return false;
				}
				if(document.form1.content.value=="")
				{
					window.alert("请填写内容!");
					window.form1.content.focus();
					return false;
				}
				
				document.form1.submit();
			}
</script>
	</div>
      </td>
    </tr>
</table>
</form>
</body>
</html>



例程9-11
<HTML>
<BODY BGCOLOR="white">
<H1>上传附件:</H1>
<HR>
<FORM METHOD="POST" ACTION="upload_ok.jsp" ENCTYPE="multipart/form-data">
   <INPUT TYPE="FILE" NAME="FILE1" SIZE="30"><BR>
   <INPUT TYPE="SUBMIT" VALUE="上         传">
</FORM>
</BODY>
</HTML>



例程9-12
<%@ page contentType="text/html;charset=gb239" %> 
<%@ page language="java"  import="com.jspsmart.upload.*"%>
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />

<HTML>
<BODY BGCOLOR="white">
<H1>上传附件:</H1>
<HR>

<%
	// Variables
	int count=0;        
	// Initialization
	mySmartUpload.initialize(pageContext);
	mySmartUpload.setTotalMaxFileSize(1000000000);
	// Upload	
	mySmartUpload.upload();
	try {
		// Save the files with their original names in the virtual path "/upload"
		// if it doesn't exist try to save in the physical path "/upload"
		count = mySmartUpload.save("/WebMail_jsp/upload");
		
		com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(0);
		String fileName=myFile.getFileName();
		out.println("文件名:"+fileName+"<br><br>");
		// Display the number of files uploaded 
		out.println(count + " 个文件已经上传成功.<br><br>");
%>
<a href="javascript:fujianName()">关闭窗口</a>
<script language="javascript">
<!--
function fujianName()
{
	opener.document.form1.fujian.value="<%=fileName%>";
	self.close();
}
-->
</script>
<%
	} catch (Exception e) { 
		out.println(e.toString());
	}
%>
</BODY>
</HTML>



例程9-13
<%@ page contentType="text/html;charset=gb239" %> 
<%@page language="java" import="java.sql.*"%>
<jsp:useBean id="userBean" scope="page" class="WebMail.conn"/>
<%!
public String getStr(String str)
{
	try
	{
		String temp_p=str;
		byte[] temp_t=temp_p.getBytes("ISO8859-1");
		String temp=new String(temp_t);
		return temp;
	}
	catch(Exception e)
	{
	 
	}
	return "null";
}
%> 
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb239">
<script Language="JavaScript" src="menu/style_plusminus/menu.js"></script>
</head>
<body bgcolor="#FFFFFF">
<%
String toID,title,content,fujian;
toID=request.getParameter("toID");
title=request.getParameter("title");
content=request.getParameter("content");
fujian=request.getParameter("fujian");

//转换成中文
toID=getStr(toID);
title=getStr(title);
content=getStr(content);
fujian=getStr(fujian);

String sql;
sql="insert into inbox(userID,fromID,title,content,fujian) values('";
sql=sql+toID+"','"+session.getAttribute("username")+"','"+title+"',";
sql=sql+"'"+content+"','"+fujian+"')";
try
{
	userBean.executeQuery(sql);
}
catch(Exception e)
{
	out.println(e);
}
%> 
成功发送信件
</body>
</html>



例程9-14
<%@ page contentType="text/html;charset=gb239" %> 
<%@page language="java" import="java.sql.*"%>
<jsp:useBean id="userBean" scope="page" class="WebMail.conn"/>
<%!
public String getStr(String str)
{
	try
	{
		String temp_p=str;
		byte[] temp_t=temp_p.getBytes("ISO8859-1");
		String temp=new String(temp_t);
		return temp;
	}
	catch(Exception e)
	{
	 
	}
	return "null";
}
%> 
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb239">
</head>

<body bgcolor="#FFFFFF">
<table width="100%" border="1">
  <tr>
    <td width="18%">发件人</td>
    <td width="25%">标题</td>
    <td width="29%">时间</td>
    <td width="28%">附件</td>
  </tr>
<%
String sql;
sql="select * from inbox where userID='"+session.getAttribute("username")+"'";
ResultSet RS;
RS=userBean.executeQuery(sql);
while(RS.next())
{
int id;
id=RS.getInt("id");
%>
  <tr>
    <td width="18%">&nbsp;<%=RS.getString("fromID")%></td>
    <td width="25%">&nbsp;<a href="read.jsp?id=<%=id%>"><%=RS.getString("title")%></a></td>
    <td width="29%">&nbsp;<%=RS.getDate("send_time")%></td>
    <td width="28%">&nbsp;<%=RS.getString("fujian")%></td>
  </tr>
<%
}
RS.close();
%>
</table>
</body>
</html>



例程9-15
<%@ page contentType="text/html;charset=gb239" %> 
<%@page language="java" import="java.sql.*"%>
<jsp:useBean id="userBean" scope="page" class="WebMail.conn"/>
<%!
public String getStr(String str)
{
	try
	{
		String temp_p=str;
		byte[] temp_t=temp_p.getBytes("ISO8859-1");
		String temp=new String(temp_t);
		return temp;
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -