我是靠谱客的博主 粗心长颈鹿,最近开发中收集的这篇文章主要介绍jsp+servlet-把servlet代码写在jsp中,显示注册内容,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

register.jsp

action="show.jsp"把表单输入的数据交给show,jsp处理

<form action="show.jsp">
用户名:<input type="text" name="username" ><br/>
密码:<input type="password" name="userpassword"><br/>
<input type="submit" value="注册">
<input type="submit">
</form>

show.jsp,把servlet.java写在了jsp页面中

1.<%java代码%>
2.<%=%>称作jsp表达式,用于将已经声明的变量或者表达式输出到网页上面

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<% String username=	request.getParameter("username");
	System.out.println("用户名"+username);
	String userpassword=	request.getParameter("userpassword");
	System.out.println("密码"+userpassword);%>
注册信息如下<br/>
	用户名:<%=username %>
	密码:<%=userpassword %>
	
</body>
</html>

最后

以上就是粗心长颈鹿为你收集整理的jsp+servlet-把servlet代码写在jsp中,显示注册内容的全部内容,希望文章能够帮你解决jsp+servlet-把servlet代码写在jsp中,显示注册内容所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(40)

评论列表共有 0 条评论

立即
投稿
返回
顶部