可按Ctrl+D收藏 蚂蚁资源网

蚂蚁资源网

jsp源码(jsp源码使用方法)

  • 全部评论(3)
  • 葬爱落雨
  • <%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%><%@ page import="java.util.*" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <title>登录页面</title></head><body> <form name="loginForm" method="post" action="judgeUser.jsp"> <table> <tr> <td>用户名:<input type="text" name="userName" id="userName"></td> </tr> <tr> <td>密码:<input type="password" name="password" id="password"></td> </tr> <tr> <td><input type="submit" value="登录" style="background-color:pink"> <input type="reset" value="重置" style="background-color:red"></td> </tr> </table> </form></body></html><%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%><%@ page import="java.util.*" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <title>身份验证</title></head><body> <% request.setCharacterEncoding("GB18030"); String name = request.getParameter("userName"); String password = request.getParameter("password"); if(name.equals("abc")&& password.equals("123")) { %> <jsp:forward page="afterLogin.jsp"> <jsp:param name="userName" value="<%=name%>"/> </jsp:forward> <% } else { %> <jsp:forward page="login.jsp"/> <% } %></body></html> <%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <title>登录成功</title></head><body> <% request.setCharacterEncoding("GB18030"); String name = request.getParameter("userName"); out.println("欢迎你:" + name); %></body></html> 总共3个jsp文件,第一个是login.jsp,第2个是judge.jsp,第3个是afterLogin.jsp
  • 2021-02-14 05:30:01
  • asd
  • 如果簡單點的話:試試下面的:<%--服务器端确认例子,peixun2.18.jsp文件代码--%><%@ page contentType="text/html;charset=gb2312"%><html><head><title>服务器端确认</title><head><body><form method="POST" name="frm1" action="loginAction.jsp"> <p align="center">用户登录 <p align="center">用户名:<input type="text" name="name" size="20">&nbsp;&nbsp;&nbsp;&nbsp; 密码:<input type="password" name="pwd" size="20"> <input type="submit" value=" 提交"> <input type="reset" value="全部重写"></p> </form></body></html>----------------------------------------------<%--服务器端确认例子,loginAction.jsp确认表单文件代码--%><%@ page contentType="text/html;charset=gb2312"%><html><head><title>确认JSP</title></head><body><%String name=request.getParameter("name");String pwd=request.getParameter("pwd");if((name!=null)&&(!name.equals(""))){name=new String(name.getBytes("ISO8859_1"), "gb2312");out.println("用户名:" +name+"");out.println("密码:"+pwd+"");}else{%><p align="center">用户名不能为空</p><form method="POST" name="frm1" action="loginAction.jsp"> <p align="center">用户登录 <p align="center">用户名:<input type="text" name="name" size="20" value="<%=name%>">&nbsp;&nbsp;&nbsp;&nbsp; 密码:<input type="password" name="pwd" size="20" value="<%=pwd%>"> <input type="submit" value=" 提交"> <input type="reset" value="全部重写"></p> </form><%}%></body></html>
  • 2021-02-11 13:09:16
  • 黑客帝国
  • jsp的源代码在那里编写,可以在dreamweaver的代码中编写,也可以新建一文本文档,然后重命名成扩展名为.jsp的名字就行了。
  • 2021-02-11 13:09:16
  • 商品推荐