machineCode = $(this).attr('id');
<%@page import="java.sql.ResultSet"%> <%@page import="org.dst.utils.Constants"%> <%@page import="org.eclipse.jdt.internal.compiler.impl.Constant"%> <%@page import="org.dst.db.conn.pool.Pool"%> <%@page import="org.dst.db.conn.pool.DBConnection"%> <%@page import="org.dst.db.conn.pool.DBConnection"%> <%@page import="java.sql.Statement"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <jsp:include flush="false" page="header.jsp" xmlns:jsp="#unknown"></jsp:include> <link rel="stylesheet" href="css/jquery-ui.css"> <script type="text/javascript" src="js/jquery-ui-min.js"></script> <script> machineCode = 'A'; $(document).ready(function() { $( "#fromDate" ).datepicker({ dateFormat: "dd/mm/yy"}); $( "#toDate" ).datepicker({ dateFormat: "dd/mm/yy"}); // ------------------ For Setting up the Report URL // Handle the Submit button $("#getReport").click(function() { event.preventDefault(); var urlMade = "/epcserver/MachineWiseService?fromDate=" + $("#fromDate").datepicker( "getDate" ).getTime() + "&toDate=" + $("#toDate").datepicker( "getDate" ).getTime() + "&<%=Constants.userId%>=" + <%=String.valueOf(session.getAttribute(Constants.userId))%> + "&<%=Constants.machineCode%>=" + machineCode; // View iFrame to the Page/Refresh the iFrame URL $("#reportContainer").attr("src", urlMade); }); $("#_getReport").click(function(){ var urlMade = "/epcserver/MachineWiseService?fromDate=" + $("#fromDate").datepicker( "getDate" ).getTime() + "&toDate=" + $("#toDate").datepicker( "getDate" ).getTime() + "&<%=Constants.userId%>=" + <%=String.valueOf(session.getAttribute(Constants.userId))%> + "&<%=Constants.machineCode%>=" + machineCode; $("#_getReport").attr("href", urlMade); }); // ------------------ For Setting up the MachineCode to the variable $(".machineSelector").click(function() { $(".machineSelector").removeClass('active'); machineCode = $(this).attr('id'); $(this).addClass('active'); }); }); </script> <div id="container"> <div class="row mywell"> <div class="span11" style="padding-removed 10px; border-removed #DDD 1px solid;"> <h2 style="text-align: center;"> Select Machine ID & Dates to view the Report. </h2> </div> <div class="span11"> <div class="btn-toolbar span5"> <div class="btn-group"> <% DBConnection dbConn = Pool.getInstance().getDBConnection(); Statement statement = dbConn.getConnection().createStatement(); ResultSet rs = statement.executeQuery("SELECT ID FROM epcserver.machine where ID_USERS = " + session.getAttribute(Constants.userId)); while (rs.next()) { out.print("<button class='btn machineSelector' id=" + (rs.getString("ID")) + ">" + (rs.getString("ID")) + "</button>"); } Pool.releaseConnection(dbConn); %> </div> </div> <div class="span5" style="margin-removed 9px;margin-removed 9px;"> <form class="form-inline" action=""> <input id="fromDate" type="text" class="input-small" placeholder="From Date"/> <input id="toDate" type="text" class="input-small" placeholder="To Date"/> <button id="getReport" type="submit" class="btn">Get Report</button> <a id="_getReport" target="_new" class="btn">Get Report In New Tab</a> </form> </div> </div> </div> <div class="row"> <iframe class="span12" height="400px" id="reportContainer" src=""/> </div> </div> <jsp:include flush="false" page="footer.jsp" xmlns:jsp="#unknown"></jsp:include>
id
ID
rs.getString("ID")
CStr(rs.getLong("ID"))
id="
id=X"
$(this).attr('id')
$(this).attr('id').substring(1)
$(this).attr('id').substring(1).valueOf()
rs.getLong("ID").toString()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)