rmi, jsp + mysql
i have a jsp page as follows that requests information from a database
<body>
<form method="post" action="http://localhost/servlet/JobServlet">
View Job Details:
Enter job number
<input name="jobno" type="text" id="jobno" />
<input name="view" type="submit" id="view" value="View Details" />
</form>
</body>
</html>
my interface:
import java.rmi.*;
public interface JobInt extends Remote
{
public String getDetails(int jobno) throws RemoteException;
}
the server:
import java.rmi.*;
public class JobServer
{
public static void main(String[] args)
{
try
{
JobImpl j = new JobImpl();
Naming.rebind("//"+"localhost"+"/JobImpl",j);
System.out.println("Registered");
}
catch (Exception e)
{
System.out.println("Exception occured in JobServer ... " +e);
}
}
}
implementation:
import java.rmi.*;
import java.rmi.server.*;
import java.sql.*;
public class JobImpl extends UnicastRemoteObject implements JobInt
{
Connection con;
Statement st;
ResultSet rs;
String url = "jdbc:mysql://localhost:3306/db?user=root;password=admin";
public JobImpl() throws RemoteException
{
super();
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection(url, "", "");
st = con.createStatement();
}
catch (Exception e)
{
System.out.println("problem while establishing connection"+e);
}
}
public String getDetails(int jobno) throws RemoteException
{
try
{
rs = st.executeQuery("Select * from job where jobno="+jobno);
rs.next();
return(rs.getString(2));
}
catch (Exception e)
{
e.printStackTrace();
}
return null;
}
}
from the jsp page, when the jobno is entered all the details about the job should be displayed on the servlet
the servlet:
import java.rmi.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class JobServlet extends HttpServlet
{
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
PrintWriter out = res.getWriter();
res.setContentType("text/plain");
try
{
int jobno = Integer.parseInt(req.getParameter("jobno"));
JobInt j = (JobInt)Naming.lookup("//"+"localhost"+"/JobInt");
System.out.println("Job Details: "+j.getDetails(jobno));
}
catch (Exception e1)
{
System.out.println(""+e1);
}
}
}
i get a HTTP 405 error... i really dont know whats the problem and y it doesnt work... im doing an assignment on these... plz help

