Issue the following
Org. Apache. Jasper. JasperException: Unable to compile class for JSP:
The JSP file: [/./showhistory. JSP] is a mistake in the first line [56]
The constructor History (String, String, float, float, float, float, Date, String) is undefined
Package Floyd.
import java.util.Date;
Public class History {
Public int historyId;
Public String username;
Public float length_preference;
Public float traffic_preference;
Public float time_preference;
Public float crossing_preference;
Public String datetime.
Public String historypath;
@ Override
Public String toString () {
The return History "[username=" + username + ", length_preference="+ length_preference +", traffic_preference="
+ traffic_preference + ", time_preference="+ time_preference +", crossing_preference="
+ crossing_preference + "] ";
}
Public History (String a,
Float b,
Float c,
Float d,
Float e) {
The username=a;
Length_preference=b;
Traffic_preference=c;
Time_preference=d;
Crossing_preference=e;
}
Public History (
Int a,
String b,
Float c,
Float d,
Float e,
Float f,
String g,
String h
) {
HistoryId=a;
The username=b;
Length_preference=c;
Traffic_preference=d;
Time_preference=e;
Crossing_preference=f;
Datetime=g;
Historypath=h;
}
Public History () {
}
}
/code]
[code]=HTML
<% @ page language="Java" contentType="text/HTML. Charset=utf-8 "
PageEncoding="utf-8"
The import="Java. SQL. *"
The import="Java. Util. *"
The import="Floyd. *
"% & gt;
Title
<body background="backgroundpic. JPG" & gt;
<% request. The setCharacterEncoding (" utf-8 ");
The Object name=session. The getAttribute (" name ");
Object the password=session. The getAttribute (" password ");
% & gt;
<%
The String URL="JDBC: mysql://localhost: 3306/carcontrollner";
Final String USERNAME="root";
Final String PWD="723428";
Try {
Class.forName("com.mysql.jdbc.Driver");
} the catch (Exception e) {}
The Connection Connection=DriverManager. GetConnection (URL, USERNAME, PWD);
String SQL="select * from history where the username=?" ;
PreparedStatement PSTMT=connection. PrepareStatement (SQL);
PSTMT. SetObject (1, name);
The ResultSet rs=PSTMT. ExecuteQuery ();
The History the History=new History ();
ListHistorys=new ArrayList<> (a);
While (rs), next ()) {
The history=new history (rs. Get int (" history_id "), rs. Get string (" username "), rs. GetFloat (" length_preference "), rs. GetFloat (" danger_preference "), rs. GetFloat (" time_preference "), rs. GetFloat (" crossing_preference "), rs. Get string (" datetime "), rs. Get string (" historypath "));
Historys. Add (history);
}
% & gt;
<%
int count=0;
For (the History a: historys) {
count++;
String id=a.u sername;
% & gt;<% %=a.h istoryId & gt; <% %=a.u sername & gt; <% %=a.h istorypath & gt; <% %=a. ength_preference & gt; <% %=a.t ime_preference & gt; <% %=a.t raffic_preference & gt; <% %=a.c rossing_preference & gt;
- Related
- Links:
- CodePudding