【灵签源码】【apt 源码】【stardict 源码】jsp实验源码

2024-12-23 07:30:47 来源:客家话翻译网站源码 分类:百科

1.在JSP中怎么实现多项选择题,验源可以给以下源代码,
2.求jsp登录源码 急急急急急急急急急急急

jsp实验源码

在JSP中怎么实现多项选择题,可以给以下源代码,

       你说的多项选择题,我是验源灵签源码不是可以理解成多选

       多选的实现是这样的:

       第一: 必须将多选框放到form里面。

       第二: 然后name属性完全一样,验源apt 源码value不相同。验源stardict 源码这样当你提交到Action中的验源smartfoxserver 源码时候,只需要使用request对象获取toselect的验源uclibc源码值就行了。

       第三: 获取值:request.getParameterValues("toselect"),验源就会将选中的验源多选框里面的value获取,并且返回一个String[]数组,验源这个数组里面就有你想要的验源值:即选中的值

       <html>

        <body>

        <form>

        <input type = "checkbox" value = "A" name = "toselect"/>A

        <input type = "checkbox" value = "B" name = "toselect"/>B

        <input type = "checkbox" value = "C" name = "toselect"/>C

        <input type = "checkbox" value = "D" name = "toselect"/>D

        </form>

        </body>

       </html>

求jsp登录源码 急急急急急急急急急急急

       登陆页面 index.jsp源码:

       <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

       <%

       String path = request.getContextPath();

       String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

       %>

       <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4. Transitional//EN">

       <html>

        <head>

        <base href="<%=basePath%>">

        <title>login</title>

        <meta http-equiv="pragma" content="no-cache">

        <meta http-equiv="cache-control" content="no-cache">

        <meta http-equiv="expires" content="0">

        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">

        <meta http-equiv="description" content="This is my page">

        <!--

        <link rel="stylesheet" type="text/css" href="styles.css">

        -->

        </head>

        <body>

        <form action="LoginServlet" method="post">

        用户名:<input type="text" name="username" ><br>

        密码:<input type="password" name="userpass"><br>

        <input type="submit" value="登陆"> <input type="reset" value="取消">

        </form>

       </body>

       </html>

       -------------

       LoginServlet.java 源码:

       package servlet;

       import java.io.IOException;

       import java.io.PrintWriter;

       import javax.servlet.ServletException;

       import javax.servlet.http.HttpServlet;

       import javax.servlet.http.HttpServletRequest;

       import javax.servlet.http.HttpServletResponse;

       public class LoginServlet extends HttpServlet {

        /

**

        * Constructor of the object.

        */

        public LoginServlet() {

        super();

        }

        /

**

        * Destruction of the servlet. <br>

        */

        public void destroy() {

        super.destroy(); // Just puts "destroy" string in log

        // Put your code here

        }

        /

**

        * The doGet method of the servlet. <br>

       

*

        * This method is called when a form has its tag value method equals to get.

        *

        * @param request the request send by the client to the server

        * @param response the response send by the server to the client

        * @throws ServletException if an error occurred

        * @throws IOException if an error occurred

        */

        public void doGet(HttpServletRequest request, HttpServletResponse response)

        throws ServletException, IOException {

        //获得jsp页面传输的参数

        String username=request.getParameter("username");

        String userpass=request.getParameter("userpass");

        //判断

        if(username.equals("user")&&userpass.equals("")){

        response.sendRedirect("1.jsp");

        }else if(username.equals("admin")&&userpass.equals("")){

        response.sendRedirect("2.jsp");

        }else{

        response.sendRedirect("index.jsp");

        }

        }

        /

**

        * The doPost method of the servlet. <br>

       

*

        * This method is called when a form has its tag value method equals to post.

        *

        * @param request the request send by the client to the server

        * @param response the response send by the server to the client

        * @throws ServletException if an error occurred

        * @throws IOException if an error occurred

        */

        public void doPost(HttpServletRequest request, HttpServletResponse response)

        throws ServletException, IOException {

        this.doGet(request, response);

        }

        /

**

        * Initialization of the servlet. <br>

       

*

        * @throws ServletException if an error occurs

        */

        public void init() throws ServletException {

        // Put your code here

        }

       }

       -------------

       1.jsp:

       <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

       <%

       String path = request.getContextPath();

       String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

       %>

       <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4. Transitional//EN">

       <html>

        <head>

        <base href="<%=basePath%>">

        <title>My JSP '1.jsp' starting page</title>

        <meta http-equiv="pragma" content="no-cache">

        <meta http-equiv="cache-control" content="no-cache">

        <meta http-equiv="expires" content="0">

        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">

        <meta http-equiv="description" content="This is my page">

        <!--

        <link rel="stylesheet" type="text/css" href="styles.css">

        -->

        </head>

        <body>

        This is 1.jsp <br>

        </body>

       </html>

       -------------

       2.jsp

       <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

       <%

       String path = request.getContextPath();

       String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

       %>

       <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4. Transitional//EN">

       <html>

        <head>

        <base href="<%=basePath%>">

        <title>My JSP '1.jsp' starting page</title>

        <meta http-equiv="pragma" content="no-cache">

        <meta http-equiv="cache-control" content="no-cache">

        <meta http-equiv="expires" content="0">

        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">

        <meta http-equiv="description" content="This is my page">

        <!--

        <link rel="stylesheet" type="text/css" href="styles.css">

        -->

        </head>

        <body>

        This is 2.jsp <br>

        </body>

       </html>

更多资讯请点击:百科

推荐资讯

印尼塞梅魯火山噴發 火山灰柱高度達600米

據印尼火山和地質災害研究機構消息,當地時間2月4日11時49分,印尼塞梅魯火山噴發,火山灰柱高度距火山口達600米,噴發持續時間為126秒。印尼火山。新華社資料圖) 來源:央視新聞)責任編輯:

php在线咨询源码_php在线咨询源码是什么

1.分享七个PHP源码的网站2.开源分享在线客服系统搭建-基于php和swoole客服系统CRMchat附源码完整搭建教程)3.在线客服系统php网站源码教程 支持消息预知4.php源码是什么意思5.

文档共享系统源码_文档共享系统源码怎么找

1.如何在Windows系统和KaliLinux系统之间共享文件2.有哪些值得推荐的源码共享网站3.macdfs源码是什么如何在Windows系统和KaliLinux系统之间共享文件 如何在Win