求助!关于构造方法的引用

qq_44236188 2020-05-26 05:32:34
快崩溃了,在家里做毕设一个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="/CarControllSystem/layui/layui/css/layui.css"/> -->
<!-- <script type="text/javascript" src="/CarControllSystem/layui/layui/layui.all.js"></script> -->
<!-- <script src="/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="form_historyupdate.jsp?name= <%= name%>&history_id=<%= a.history_id%>">更新 </a></td>
<td><a href="historydelete.jsp?name= <%= name%>&history_id=<%= a.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(){



}

}



...全文
57 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_44236188 2020-05-26
  • 打赏
  • 举报
回复
引用 1 楼 一百分是骗人的 的回复:
小弟弟,你可以这么发帖,会有人帮你,不然代码太乱,没人看的

好的,谢谢您!
「已注销」 2020-05-26
  • 打赏
  • 举报
回复
小弟弟,你可以这么发帖,会有人帮你,不然代码太乱,没人看的

5,655

社区成员

发帖
与我相关
我的任务
社区描述
Web开发应用服务器相关讨论专区
社区管理员
  • 应用服务器社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧