|
|
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>
<%@ page import="javax.naming.NamingException"%>
<%@ page import="javax.naming.InitialContext"%>
<%@ page import="javax.sql.DataSource"%>
<%
Connection dbCon = null;
PreparedStatement statshopcat = null;
PreparedStatement statvendors = null;
PreparedStatement statoccasion = null;
PreparedStatement statoccfeat = null;
PreparedStatement statcount = null;
PreparedStatement statcountven = null;
PreparedStatement statcountocc = null;
PreparedStatement statweek = null;
PreparedStatement statchocoweek = null;
PreparedStatement statrecom = null;
PreparedStatement statfeature = null;
PreparedStatement stathot = null;
PreparedStatement stattest = null;
ResultSet rsshopcat = null;
ResultSet rsvendors = null;
ResultSet rscountven = null;
ResultSet rscount = null;
ResultSet rsoccasion = null;
ResultSet rsoccfeat = null;
ResultSet rscountocc = null;
ResultSet rsweek = null;
ResultSet rschocoweek = null;
ResultSet rsfeature = null;
ResultSet rshot = null;
ResultSet rstest = null;
//ResultSet rsrecom = null;
//String cat = null;
//String subcat = null;
String strshopcat="select * from catvendor";
String strvendors="select * from vendordetail";
String stroccasion="select * from occasion";
String stroccfeat="select * from occasion where approved = ? order by occasiondate desc";
String strcount="select count(*) as strcount from catvendor";
String strcountven="select count(*) as strcount from catvendor";
String strcountvendor="select count(*) as strcount from vendordetail";
String strcountocc="select count(*) as strcount from occasion";
String strweek="select * from proddetails where featured=?";
String str="select * from proddetails where featured=?";
String strchocoweek="select * from chocolates where chocooftheweek=?";
//String strrecom="select * from proddetails where recommended=?";
String strfeatures ="select * from vendorproduct where approve=? and feature = ?";
String strhot ="select * from vendorproduct where approve=? and hotproduct = ?";
String strtest ="select * from testimonials where approved=?";
int catid=0;
int count=0;
int countocc=0;
int countven=0;
String fl="Y";
String feature="yes";
String chocooftheweek="yes";
String approved="yes";
try {
//javax.naming.Context initialContext = new javax.naming.InitialContext();
//javax.naming.Context envContext = (javax.naming.Context) initialContext.lookup("java:/comp/env");
//javax.sql.DataSource dataSource = (javax.sql.DataSource) envContext.lookup("jdbc/mssql");
//dbCon = dataSource.getConnection();
Class.forName("com.mysql.jdbc.Driver").newInstance();
//dbCon = DriverManager.getConnection("jdbc:mysql://localhost:3306/maheks_mahek","maheks","mahak");
ServletContext ctx = getServletContext();
String url=ctx.getInitParameter("url");
String user=ctx.getInitParameter("user");
String pw=ctx.getInitParameter("password");
dbCon = DriverManager.getConnection(url,user,pw);
statfeature=dbCon.prepareStatement(strfeatures);
stathot=dbCon.prepareStatement(strhot);
stattest=dbCon.prepareStatement(strtest);
stathot.setString(1,feature);
stathot.setString(2,feature);
rshot=stathot.executeQuery();
statfeature.setString(1,feature);
statfeature.setString(2,feature);
rsfeature=statfeature.executeQuery();
stattest.setString(1,approved);
rstest=stattest.executeQuery();
statshopcat=dbCon.prepareStatement(strshopcat);
rsshopcat=statshopcat.executeQuery();
statcount=dbCon.prepareStatement(strcount);
statcountven=dbCon.prepareStatement(strcountvendor);
rscountven=statcountven.executeQuery();
rscount=statcount.executeQuery();
statoccasion=dbCon.prepareStatement(stroccasion);
rsoccasion=statoccasion.executeQuery();
statcountocc=dbCon.prepareStatement(strcountocc);
rscountocc=statcountocc.executeQuery();
statvendors=dbCon.prepareStatement(strvendors);
rsvendors=statvendors.executeQuery();
if (rscount.next())
{
count = rscount.getInt("strcount");
//out.println("" + count + " | ");
}
if (rscountocc.next())
{
countocc = rscountocc.getInt("strcount");
//out.println("" + countocc + " | ");
}
if (rscountven.next())
{
countven = rscountven.getInt("strcount");
//out.println("" + count + " | ");
}
%>
|
|
|
| Forthcoming
Occasions |
<%
statoccfeat=dbCon.prepareStatement(stroccfeat);
statoccfeat.setString(1,approved);
rsoccfeat=statoccfeat.executeQuery();
%>
<%
DateFormat format;
String datestr=null;
while (rsoccfeat.next())
{
if(rsoccfeat.getDate("occasiondate").equals(null)){
datestr = "Date Not Entered";
} else {
java.util.Date date2 = rsoccfeat.getDate("occasiondate");
//java.util.Date date1 = new java.util.Date(time);
format = DateFormat.getDateInstance(2);
datestr = format.format(date2);
}
%>
<%=rsoccfeat.getString("occasion")%> : <%=datestr%>
<%
}
%>
|
|
| Featured
products |
<%
for (int i=1;i<=3; i++)
{
if(rsfeature.next())
{
%>
|
|
Rs. <%=rsfeature.getString("costprice")%> |
|
|
|
|
<%
}
}
%>
|
| |
|
|
| |
| |
|
| Testimonials |
| |
|
<%
if (rstest.next())
{
%>
<%=rstest.getString("postedby")%>
<%=rstest.getString("description")%>...
<%
}
else
{
out.print("No records found!");
}
%>
|
| |
|
|
|
|
|
|