表单开发(一):获取文本框和密码框数据 用户登录网页

passwordForm.jsp<%@ page language=”java” import=”java.util.*” pageEncoding=”UTF-8″%><%String path = request.getContextPath();//获取上下文路径String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;%>> =>My JSP ‘passwordForm.jsp’ starting page=====”description” content=”This is my page”><!–<link type=”text/css” href=”styles.css”>–> =”text/javascript”>{if(document.loginform.zhanghao.value==””){window.alert(“账号不能为空!”);return ;}if(document.loginform.mima.value==””){window.alert(“密码不能为空!”);return ;}loginform.submit();}==>=>请输入账号:=>>请输入密码:=>>===>> </body></html><!–passwordForm_result.jsp–><%@ page language=”java” import=”java.util.*” pageEncoding=”UTF-8″%><%String path = request.getContextPath();String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;%>>>My JSP ‘passwordForm_result.jsp’ starting page=====”description” content=”This is my page”><!–<link type=”text/css” href=”styles.css”>–> </head> <body><%String user=request.getParameter(“zhanghao”);String password=request.getParameter(“mima”);%>>>>密码为:>></html>

结果如图所示:

查看passwordForm_result.jsp的网页源代码

会发现java代码没有显示,,是因为html和javascript都是前端语言,是浏览器编译运行的,而jsp/php/asp都是在服务器端运行的后端脚本语言

可是我知道结果是惨淡的,但还是心存希望!

表单开发(一):获取文本框和密码框数据 用户登录网页

相关文章:

你感兴趣的文章:

标签云: