题目
编写两个 JSP 页面 inputString.jsp 和 computer.jsp,用户可以使用 inputString.jsp 提供的表单输入一个字符串,并提交给 computer.jsp 页面,该页面通过内置对象获取 inputString.jsp 页面提交的字符串,并显示该字符串的长度。
代码
inputString.jsp
<%@ page contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" %>
<html>
<body>
<form action="computer.jsp" method="post">
请输入字符串:
<input type="text" name="inputStr">
<input type="submit" value="提交">
</form>
</body>
</html>
computer.jsp
<%@ page contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" %>
<html>
<body>
<% String inputStr = request.getParameter("inputStr");
out.print("输入的字符