addmessage.jsp

来自「机械工业出版社的《jsp2.0动态网站开发实例指南》的源代码」· JSP 代码 · 共 70 行

JSP
70
字号
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="shop.logBean" %>
<%!
	public String codeString(String s){
		String str=s;
                try{
			byte b[]=str.getBytes("ISO-8859-1");
			str=new String (b);
			return str;
		}catch(Exception e){return str;}
	}
%>
<html>
<head>
<title>Shop</title>
</head>
<body bgcolor=#C0C0C0>
<%	
	String title;
	String toid;
	if(session.isNew()){
		%>
		<jsp:forward page="index.jsp"/>
		<%
	}
	else {
		%>
		<jsp:useBean id="log" class="shop.logBean" scope="session"/>
		<%
		String islog=log.getIslog();
		if(!islog.equals("true")){
			%>
			<jsp:forward page="index.jsp"/>
			<%
		}
		else{
			%>
			<center>
			<jsp:getProperty name="log" property="id"/>
			,添加私人留言
			<jsp:include page="head.txt"/>
			</center>
			<%
			title=request.getParameter("title");
			if(title==null)title="";
			title=codeString(title);
			toid=request.getParameter("toid");
			if(toid==null)toid="";
			toid=codeString(toid);
		}
	}
%>
<center>
<form method="post" action="dealaddmessage.jsp" name="addmessage">
标题:<input type="text" size=20 maxlength=20 name="title" value="<%=title%>">
<br>
发送给:<input type="text" size=20 maxlength=20 name="userid" value="<%=toid%>">
<br>
内容
<br>
<textarea rows="10" cols="40" scrolling="auto" name="message">
</textarea>
<br>
<input type="submit" value="确定" name="addboard">
<input type="reset" value="重置" name="reset">
</form>

</center>
</body>
</html>

⌨️ 快捷键说明

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