本文主要是介绍JSP 简单表单显示例子,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
<html>
<!--http://localhost:8080/test_jsp/input.html -->
<head>
<meta http-equiv="Content-Type" content="text/HTML; charset=utf-8">
<title>input页面</title>
</head>
<body><form action="input.jsp" method="post">姓名:<input type="text" name="info"> <input type="submit"value="提交"></form>
</body>
</html>
input.html
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %><html><head><meta http-equiv="Content-Type" content="text/HTML; charset=gbk"> <title>测试input</title></head><body><% // 设置字符串编码,解决乱码问题request.setCharacterEncoding("utf-8");String str = request.getParameter("info");out.println("<h1>" + str + "</h1>");%><%=str%><%="你好"%></body>
</html>
input.jsp
这篇关于JSP 简单表单显示例子的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!