JSP简单添加,查询功能代码(3)

<%@ page contentType="text/html; charset=GB2312" %> <html> <head> <title> jsp8 </title> </head> <body bgcolor="#ffffff"> <h1> 这是统计页 !!! </h1> <br> <% String user,pwd; //user=request.getParameter("username"); user=new String(request.getParameter("username").getBytes("ISO8859_1")); pwd=request.getParameter("password"); %> username is: <%=user%><br> password is: <%=pwd%><br> </body> </html>

input.html

<HTML> <HEAD> <TITLE>网页引导</TITLE> </HEAD> <BODY> <CENTER> <FONT SIZE = 5 COLOR = blue>网页引导</FONT> </CENTER> <BR> <HR> <BR> <FORM action="sendRedirect.jsp" method=post name=form1> <P>姓名 : <INPUT name=inputName ></P> <P>E-Mail : <INPUT name=inputE_Mail ></P> <INPUT name=submit type=submit value=送出> </FORM> </BODY> </HTML

sendRedirect.jsp:

<%@ page contentType="text/html; charset=GB2312" %> <%@ page language="java" %> <% String Name = request.getParameter("inputName"); String E_Mail = request.getParameter("inputE_Mail"); if(Name.equals("") || E_Mail.equals(""))//检查Name或E_Mail是否完成资料输入 response.sendRedirect("sendRedirect.html"); //若未完成资料输入则将网页导向sendRedirect.html %> <HTML> <HEAD> <TITLE>网页引导</TITLE> </HEAD> <BODY> <CENTER> <FONT SIZE = 5 COLOR = blue>网页引导</FONT> </CENTER> <BR> <HR> <BR> <P>您的大名是: <%= Name %> </P> <P>E-Mail帐号为: <%= E_Mail %> </P> <p><a href="https://www.jb51.net/jsp1.jsp">返回</a></p> </BODY> </HTML>

sendRedirect.html:

<HTML> <HEAD> <TITLE>网页引导</TITLE> </HEAD> <BODY> <CENTER> <FONT SIZE = 5 COLOR = blue>网页引导</FONT> </CENTER> <BR> <HR> <BR> <FORM action="sendRedirect.jsp" method=post name=form1> <font size=5 color=red> 你输入的信息不完整,请重新输入! </font> <br> <P>姓名 : <INPUT name=inputName ></P> <P>E-Mail : <INPUT name=inputE_Mail ></P> <INPUT name=submit type=submit value=送出> </FORM> </BODY> </HTML>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzfwyx.html