Hi,
i have the javascript and jsp combination code for calendar functionality is there.
in that i take the events from database.For that i write a condition to select the events as "select * fom importtimetable where month='jspvar'. This statement didn't work. In that i declared jspvar as
Now jspvar didn't pass to the select statement. Anybody plz tell that whats the wrong in that
i have the javascript and jsp combination code for calendar functionality is there.
in that i take the events from database.For that i write a condition to select the events as "select * fom importtimetable where month='jspvar'. This statement didn't work. In that i declared jspvar as
Code:
<script>var jsvar=monthNum;</script>
String jspvar="<script>document.writeln("javar")</script>";
Code:
[javascript]
function createCalendar(monthNum,yearNum) {
calendarString = '';
var daycounter = 0;
calendarString +='<td height=\"20\" colspan=\"4\" valign=\"top\"><a class=\"breadlink\" href=\"#\">Home</a> - Calender of Events</td>';
calendarString +='<td width=\"21%\" height=\"30\"><font class=\"calender\">'+ wordMonth[monthNum-1]+ todaysDate +'</font></td>';
calendarString +='<option selected>'+ wordMonth[monthNum-1]+'</option>';
calendarString +='<option value=1>January</option>';
calendarString +='<option value=2>February</option>';
calendarString +='<option value=3>March</option>';
calendarString +='<option value=4>April</option>';
calendarString +='<option value=5>May</option>';
calendarString +='<option value=6>June</option>';
calendarString +='<option value=7>July</option>';
calendarString +='<option value=8>August</option>';
calendarString +='<option value=9>September</option>';
calendarString +='<option value=10>October</option>';
calendarString +='<option value=11>November</option>';
calendarString +='<option value=12>December</option>';
calendarString +='</select>';
calendarString +='<select name="select5">';
calendarString +='<option>21-24</option>';
calendarString +='</select>';
calendarString +='<select name=\"select4\" id=\"select4\" onchange=\"selectdate()\">';
calendarString +='<option selected>'+ yearNum +'</option>';
calendarString +='<option value=2006>2005</option>';
calendarString +='<option value=2007>2006</option>';
calendarString +='<option value=2008>2007</option>';
calendarString +='<option value=2009>2008</option>';
calendarString +='<option value=2010>2009</option>';
calendarString +='<option value=2011>2010</option>';
calendarString +='<option value=2012>2011</option>';
calendarString +='<option value=2013>2012</option>';
calendarString +='<option value=2014>2013</option>';
calendarString +='<option value=2015>2014</option>';
calendarString +='<option value=2016>2015</option>';
calendarString +='<option value=2017>2016</option>';
calendarString +='</select>';
var jsvar=monthNum;
<%@ page language="java" %>
<%
String connectionURL = "jdbc:mysql://localhost:3306/";
String dbName = "user_register";
Connection connection = null;
Statement stmt = null;
ResultSet rs = null;
ResultSet rs2 = null;
PreparedStatement pstatement = null;
PreparedStatement pstatement2 = null;
String title = request.getParameter("title");
String description = request.getParameter("description");
String month = request.getParameter("month");
String jspvar="<script>document.writeln(jsvar)</script>";
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL+dbName, "root", "root");
pstatement2 = connection.prepareStatement("Select * from importtimetable where month='jspvar'");
rs2 = pstatement2.executeQuery();
while(rs2.next()){
%>
calendarString +='<td width=\"66\" height=\"66\" align=\"center\" bgcolor=\"#EBFEE0\" class=\"text\">00:00</td>';
calendarString +='<td width=\"638\" height=\"55\" align=\"left\" valign=\"top\" bgcolor=\"#FFFFFF\"><%=rs2.getString(1)%> </td>';
<%
}
%>
}
[/javascript]
Comment