快崩潰了,在家里做畢設一個bug能卡一天。。這都什么時候了畢業論文老師還不讓我開始寫。。請前輩們教教我
問題如下
org.apache.jasper.JasperException: Unable to compile class for JSP:
JSP檔案:[/./showhistory.jsp] 的第 [56] 行發生了一個錯誤
The constructor History(String, String, float, float, float, float, Date, String) is undefined
代碼:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"
import="java.sql.*"
import="java.util.*"
import="floyd.*"
%>
//原本是可以的,但是后來我在構造方法中加入了一個引數,就一直顯示不可以了
<html>
<head>
<!-- <link rel="stylesheet" href="https://bbs.csdn.net/CarControllSystem/layui/layui/css/layui.css"/> -->
<!-- <script type="text/javascript" src="https://bbs.csdn.net/CarControllSystem/layui/layui/layui.all.js"></script> -->
<!-- <script src="https://bbs.csdn.net/CarControllSystem/layui/layui/layui.js"></script> -->
<title>Title</title>
</head>
<body background="backgroundpic.jpg">
<% request.setCharacterEncoding("utf-8");
Object name = session.getAttribute("name") ;
Object password= session.getAttribute("password");
%>
<%
String URL ="jdbc:mysql://localhost:3306/carcontrollner";
final String USERNAME ="root";
final String PWD = "723428";
try{
Class.forName("com.mysql.jdbc.Driver");
}catch(Exception e){}
Connection connection = DriverManager.getConnection(URL,USERNAME,PWD) ;
String sql ="select * from history where username=?";
PreparedStatement pstmt = connection.prepareStatement(sql);
pstmt.setObject(1, name);
ResultSet rs = pstmt.executeQuery();
History history= new History();
List<History> historys = new ArrayList<>();
while(rs.next()) {
history = new History(rs.getString("history_id"),rs.getString("username"),rs.getFloat("length_preference"),rs.getFloat("danger_preference"),rs.getFloat("time_preference"),rs.getFloat("crossing_preference"),rs.getDate("datetime"), rs.getString("historypath"));
historys.add(history);
}
%>
<div >
<!-- 內容主體區域 -->
<p align="center">用戶資訊管理</p>
<table width="64%" border="1" align="center" cellspacing="0" class="l_table_1 table" id="table_1">
<tr>
<td width="8%" align="center">記錄ID</td>
<td width="8%" align="center">用戶名</td>
<td width="20%" align="center">歷史路線</td>
<td width="12%" align="center">距離偏好值</td>
<td width="12%" align="center">時間偏好值</td>
<td width="12%" align="center">安全偏好值</td>
<td width="12%" align="center">拐點偏好值</td>
<td width="12%" align="center">駕駛時間戳</td>
<td width="8%" colspan="2" align="center">操作</td>
</tr>
<%
int count=0;
for (History a:historys) {
count++;
String id=a.username;
%>
<tr>
<td><%= a.history_id %></td>
<td><%= a.username %></td>
<td><%=a.historypath %></td>
<td><%=a.length_preference %></td>
<td><%=a.time_preference %></td>
<td><%=a.traffic_preference%></td>
<td><%=a.crossing_preference %></td>
<td><%=a.datetime%></td>
<td><a href="https://bbs.csdn.net/topics/form_historyupdate.jsp?name= &history_id=">更新 </a></td>
<td><a href="https://bbs.csdn.net/topics/historydelete.jsp?name= &history_id=">洗掉 </a></td>
</tr>
<% }
%>
</table>
</div>
</body>
<html>
History.jsp
package floyd;
import java.util.Date;
public class History {
public String history_id;
public String username;
public float length_preference;
public float traffic_preference;
public float time_preference;
public float crossing_preference;
public Date datetime;
public String historypath;
@Override
public String toString() {
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){
username = a;
length_preference = b;
traffic_preference = c;
time_preference = d;
crossing_preference = e;
}
public History(
String a ,
String b,
float c,
float d,
float e,
float f,
Date g,
String h
){
history_id = a;
username = b;
length_preference = c;
traffic_preference = d;
time_preference = e;
crossing_preference = f;
datetime = g;
historypath = h;
}
public History(){
}
}
uj5u.com熱心網友回復:
小弟弟,你可以這么發帖,會有人幫你
,不然代碼太亂,沒人看的
uj5u.com熱心網友回復:
好的,謝謝您!
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/45483.html
標籤:應用服務器
