
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 14 in the jsp file: /doctor.jsp
Invalid character constant
11: Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/phs", "root", "root");
12: Statement s=con.createStatement();
13:
14: ResultSet rs=s.executeUpdate("insert into patient(prescription,treatment) values('"+slip+'",'"+treaty+"') where id='"+pid+"'");
15: int count=0;
16: while(rs.next())
17: {
///////////@@@@the above mentioneed is error and code is as follows
<%@ page import="java.sql.*,javax.sql.*" %>
<%@ page import="java.util.*, java.lang.*" %>
<%
try{
String pid=request.getParameter("id");
String treaty=request.getParameter("treat");
String slip=request.getParameter("pres");
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/phs", "root", "root");
Statement s=con.createStatement();
ResultSet rs=s.executeUpdate("insert into patient(prescription,treatment) values('"+slip+'",'"+treaty+"') where id='"+pid+"'");
int count=0;
while(rs.next())
{
out.println("PAtient record updated");
}
}
catch (Exception e){
out.println(e);
}
%>

We have modified your code. Here is your modified code.
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*"%>
<%@ page import="java.lang.*"%>
<% try{
String pid=request.getParameter("id");
String treaty=request.getParameter("treat");
String slip=request.getParameter("pres"); Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/phs", "root", "root");
Statement s=con.createStatement();
s.executeUpdate("insert into patient(id,prescription,treatment) values('"+pid+"','"+slip+"','"+treaty+"')");
int count=0;
while(rs.next())
{
out.println("PAtient record updated");
}
}
catch (Exception e){
out.println(e);
}
%>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.