JSP中param动作的实例详解

JSP中param动作的实例详解

一 语法


常常与一起使用,作为其子标签存在。 

二 代码

1、login.jsp

<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
 


 
  
  
  My JSP 'login.jsp' starting page
  
    
    
      
    
    
    
 
 
 
 
  

系统登录


用户名:
密码:

2、dologin.jsp

<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
 


 
  
  
  My JSP 'dologin.jsp' starting page
  
    
    
      
    
    
    
 
 
 
 
  
   
   
  
 

3、user.jsp

<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
 


 
  
  
  My JSP 'user.jsp' starting page
  
    
    
      
    
    
    
 
 
 
 
  

用户资料


<% request.setCharacterEncoding("utf-8"); String username = ""; String password = ""; String email = ""; if(request.getParameter("username")!=null) { username = request.getParameter("username"); } if(request.getParameter("password")!=null) { password = request.getParameter("password"); } if(request.getParameter("email")!=null) { email = request.getParameter("email"); } %> 用户名:<%=username %>
密码:<%=password %>
电子邮箱:<%=email %>

三 运行结果

JSP中param动作的实例详解_第1张图片

如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

你可能感兴趣的:(JSP中param动作的实例详解)