Click to See Complete Forum and Search --> : uploading my project online


sher_amf
09-24-2009, 07:50 AM
so we have a group project
we were using resin to run this... but when i uploaded the file and SQL database here is the outcome...

http://sher_amf.0fees.net/Chapters/admin_home.jsp

what could have been wrong?

this is the database name i have uploaded
fees0_4187690_ictproj


here is the actual code of the page

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

<html>
<head>
<title></title>
<style type="text/css">
<!--
.style7 {font-family: Calibri; font-weight: bold; color: #FFFFFF; }
.style8 {font-weight: bold; font-family: Calibri;}
.style9 {font-family: Calibri ;color: #000000}
.style10 {font-family: Calibri}
-->
</style>
</head>
<body>
<p><img src="images/announcement.jpg" width="54" height="60"></p>
<table width="305" border="0">
<tr>
<td width="299">Today is:
<em> <script type="text/javascript">
var d=new Date()
var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
document.write(weekday[d.getDay()] + " ")
document.write(d.getDate() + ". ")
document.write(monthname[d.getMonth()] + " ")
document.write(d.getFullYear())
</script></em>
</td>
</tr>

</table>
<table width="692" height="49" border="0">
<tr>
<td height="21" class="style8"><strong>Announcements</strong></td>
<td scope="row">&nbsp;</td>
</tr>
<tr>
<td width="530" bgcolor="#00009B" scope="row"><span class="style7">Topic</span></td>
<td width="152" bgcolor="#00009B" scope="row"><span class="style7">Date</span></td>
</tr>
<%@ page import="com.sun.rowset.CachedRowSetImpl;" %>
<%



int i = 0;



MyMethods2 view = new MyMethods2();
CachedRowSetImpl crset = new CachedRowSetImpl();
crset = view.viewalerts();

while (crset.next())
{

String day2 = crset.getString("dep_date");

String[] monthcol= day2.split("-");

int year = Integer.parseInt(monthcol[0]);
int month = Integer.parseInt(monthcol[1]);
int day= Integer.parseInt(monthcol[2]);
String m="";

if(month==1)
{
m="Jan";
}
else if (month==2)
{
m="Feb";
}
else if (month==3)
{
m="March";
}
else if (month==4)
{
m="April";
}
else if (month==5)
{
m="May";
}
else if (month==6)
{
m="June";
}
else if (month==7)
{
m="July";
}
else if (month==8)
{
m="Aug";
}
else if (month==9)
{
m="Sept";
}
else if (month==10)
{
m="Oct";
}
else if (month==11)
{
m="Nov";
}
else if (month==12)
{
m="Dec";
}


if(i==0)
{
%>
<tr>

<td scope="row"><div align="left" class="style9&gt;&lt;span class= style10"style9"> <a href="http://localhost:8080/ICTPROJ/Chapters/reports.jsp?t=<%=crset.getString("dep_time")%>&l=<%= crset.getString("dep_location") %>&d=<%= crset.getString("dep_date") %>"><%= crset.getString("dep_name") %> </a></span></div></td>
<td scope="row"><div align="left" class="style9">

<% out.println(day);%>
<% out.println("-");%>
<% out.println(m);%>
<% out.println("-");%>
<% out.println(year);%>
</div></td>
</tr>
<%
i=1;
}
else
{
%>
<tr>

<td scope="row" bgcolor="#CCCCCC"><div align="left" class="style9&gt;&lt;span class= style10"style9"> <a href="http://localhost:8080/ICTPROJ/Chapters/reports.jsp?t=<%=crset.getString("dep_time")%>&l=<%= crset.getString("dep_location") %>&d=<%= crset.getString("dep_date") %>"><%= crset.getString("dep_name") %> </a></span></div></td>
<td scope="row" bgcolor="#CCCCCC"><div align="left" class="style9">

<% out.println(day);%>
<% out.println("-");%>
<% out.println(m);%>
<% out.println("-");%>
<% out.println(year);%>
</div></td>
</tr>
<%
i=0;
}
}
%>
</table>
<h1>&nbsp;</h1>
</body>
</html>






for the methods




import java.util.*;
import java.sql.*;
import com.sun.rowset.CachedRowSetImpl;
import java.io.*;
import com.sun.rowset.*;
import java.sql.SQLException;
import javax.sql.rowset.*;
import java.net.*;

public class MyMethods2

{
GregorianCalendar calendar = new GregorianCalendar();
int nDay = calendar.get(calendar.DATE);
int nMonth = calendar.get(calendar.MONTH) + 1;
int nYear = calendar.get(calendar.YEAR);

String sDate = "" + nYear + "-" + nMonth + "-" + nDay;

Connection con;
PreparedStatement pstmt;
Statement stmt;
ResultSet rs;
CachedRowSetImpl crset;
int n,i;


public CachedRowSetImpl viewalerts() // viewvolunteer.jsp
{
try
{
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
Connection con = DriverManager.getConnection ("jdbc:odbc:ictproj", "", "");
String query = "Select * from deployment where dep_status='pending' ORDER BY dep_date DESC ";
PreparedStatement pstmt = con.prepareStatement(query);
ResultSet rs = pstmt.executeQuery();
CachedRowSetImpl crset = new CachedRowSetImpl();
crset.populate(rs);
rs.close(); pstmt.close(); con.close();
return crset;
}

catch (Exception e)
{
System.out.println(e.getMessage());
}

return null;
}

public CachedRowSetImpl alertsdetail(String timer, String location,String dater) // viewvolunteer.jsp
{
try
{
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
Connection con = DriverManager.getConnection ("jdbc:odbc:ictproj", "", "");
String query = "Select * from deployment where dep_status='pending' and dep_time='"+timer+"' and dep_location='"+location+"' and dep_date='"+dater+"' order by dep_date DESC";
PreparedStatement pstmt = con.prepareStatement(query);
ResultSet rs = pstmt.executeQuery();
CachedRowSetImpl crset = new CachedRowSetImpl();
crset.populate(rs);
rs.close(); pstmt.close(); con.close();
return crset;
}

catch (Exception e)
{
System.out.println(e.getMessage());
}

return null;
}

public void approve(String requesting,String date,String time,String name,String Type,String Type2,String location2,String report, String volunteerID2)
{// addvolunteer1.jsp (addvolunteer.jsp,previewvolunteer.jsp)
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:ictproj","","");
pstmt = con.prepareStatement("UPDATE deployment SET dep_status='approve' , dep_status2='approve', ref_num='"+volunteerID2+"' where request='"+requesting+"' and dep_date ='"+date+"' and dep_time='"+time+"' and dep_location='"+location2+"' and dep_report='"+report+"'");
rs = pstmt.executeQuery();

con.close();
rs.close();
pstmt.close();
}


catch (Exception e)
{
System.out.println("SQL Exception : " + e.getMessage());
}

}

public String getLatestRef(String requesting) // get the latest volunteer id
{

String strExtra="";
try
{
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
con = DriverManager.getConnection ("jdbc:odbc:ictproj", "", "");
pstmt = con.prepareStatement("SELECT * FROM deployment WHERE request = ? ORDER by ref_num DESC");
pstmt.setString(1,requesting);
rs = pstmt.executeQuery();
if(rs.next())
{
strExtra = rs.getString("ref_num");
}
rs.close();
pstmt.close();
con.close();

}

catch (Exception e)
{
System.out.println(e.getMessage());
}

return strExtra;
}

public String getChapter(String Chapter) // get the latest volunteer id
{ String strExtra="";
try

{


DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
Connection con = DriverManager.getConnection ("jdbc:odbc:ictproj", "", "");
String query = "SELECT * FROM chapters WHERE chapname = '"+Chapter+"'";
PreparedStatement pstmt = con.prepareStatement(query);
ResultSet rs = pstmt.executeQuery();
if(rs.next())
{
strExtra = rs.getString("chapcode");
}
rs.close();
pstmt.close();
con.close();
}

catch (Exception e)
{
System.out.println(e.getMessage());
}

return strExtra;
}


}//end

criterion9
09-24-2009, 02:18 PM
It looks like the file is not being parsed in a JSP container. Does your host provide JSP capability?

sher_amf
09-24-2009, 08:20 PM
that i am not sure with but i was assuming it would support JSP since the JSP pages appear

criterion9
09-24-2009, 09:09 PM
What do you mean when you say "the JSP pages appear"? Does your host provide Apache Tomcat or Glassfish or the like?

sher_amf
09-24-2009, 09:37 PM
i was assuming since the jsp page appeared and it seems there is just something wrong with the code that my webhost provider is capable of JSP... i am using sql... and yes they also provide sql services

criterion9
09-25-2009, 06:54 PM
What do you mean that the JSP page appeared? Are you saying that because you could upload a file you thought it would work?