首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >datepicker不要在jsp中打开日历

问datepicker不要在jsp中打开日历
EN

Stack Overflow用户
提问于 2016-06-08 11:51:47
回答 2查看 269关注 0票数 0

我正在使用jQuery日期选择器在我的页面上查看日历。

我以正确的顺序导入库,但它不起作用。

代码语言:javascript
复制
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page language="java"%>
<%@page import="java.sql.*"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    <link type="text/css" href="css/jquery-ui.css"/>
    <script type="text/javascript" src="JS/jquery-2.2.4.js"></script>
    <script type="text/javascript" src="JS/jquery-ui.min.js"></script>
    <script>
        $(function(){
            $("#fecha").datepicker();
        });
        </script>
        <style>
            .tabla{
                width: 80%;
            }
            .thCliente{
                font-family:sans-serif;
                font-size: 16px;
                font-weight: bolder;
                background: cadetblue;
            }
            .tdCliente{
              font-family:sans-serif;
              font-size: 14px;
              background: beige;
              align-content: stretch;
            }
        </style>
    </head>
    <body>
        <table id="cliente" border="1" class="tabla">
            <form  method="get" action="generaReporte" id="forminicio">
            <tr><th class="thCliente">Febrero</th></tr>
            <th class="thCliente">Fecha </th>
            <th class="thCliente">Cliente</th>
            <th class="thCliente">Actividad</th>
            <th class="thCliente">Horas</th>
<tr>
    <th>
    <input id="fecha" type="text">
    </th>
    <th>    
            <%//establecemos la conexion a la BD para mostrar los clientes
            try
            {
                Connection conexion = null; 
                Statement sentencia = null;
                ResultSet resultado = null;
                Class.forName("com.mysql.jdbc.Driver");
                String cadenaConexion = "jdbc:mysql://localhost:3306/LOGIN";
                String usuario = "root";
                String clave = "5533834712";
                conexion = DriverManager.getConnection(cadenaConexion,usuario,clave);
                if(!conexion.isClosed())
                {
                    sentencia = conexion.createStatement();
                    resultado = sentencia.executeQuery("select * from cliente");
                    out.println("<select style='width:300px;border:1px;font-family:sans-serif;font-size: 16px;' name='select'>");
                    out.println("<option >Selecciona el Cliente</option>");
                    while(resultado.next())
                    {
                     String nombre = resultado.getString("Nombre");
                     //String id = resultado.getString("id");
                     out.println("<option value='"+nombre+"'></option>");
                    }
                    out.println("</select>");
                    conexion.close();
                }
                else
                    out.println("fallo");
            }
            catch(Exception e)
            {
                out.println("Error"+e);
                e.printStackTrace();
            }
            %>
    </th>
    <th>
        <input type="text" style="width:300px;border:1px;font-family:sans-serif;font-size: 16px;" value="Agregar tu Actividad" name="actividad">
    </th>
    <th>
        <input type="text" maxlength="4" style="width:300px;border:1px;font-family:sans-serif;font-size: 16px;" value="Añade tu tiempo" name="actividad">
    </th>
        <th>
        <input type="button" value="Guardar" name="save">
    </th>
</tr>
            </form>
        </body>
</html>
EN

回答 2

Stack Overflow用户

发布于 2016-06-08 12:00:46

有时,正常的jQuery日期选择器会出错,不能给出正确的输出。我已经习惯了。一个使用标准jQuery日期选择器的很好的日期选择器。你可以自定义这个比普通日期选择器更多的东西。也是一个很好的文档。这在我的jsp页面上工作得很好。

Get the new custom jQuery datepicker from here

票数 0
EN

Stack Overflow用户

发布于 2016-06-08 12:12:13

它可以正常工作,请检查https://jsfiddle.net/5h5vb0nj/。您是任务表关闭标签

代码语言:javascript
复制
 </th>
</tr>   ***</table>***
            </form>
        </body>

如果问题仍然存在,那么删除scriptlet并检查它现在是否正常工作。如果iot工作,则意味着scriptlet中存在错误。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37692927

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档