在maven web項(xiàng)目中的index.jsp中的錯(cuò)誤信息如下:
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
從錯(cuò)誤信息可以看出來(lái),找不到該類(lèi),也就是說(shuō)找不到相應(yīng)jar包。
所以解決方法就是引用相應(yīng)jar包即可。
前提:
需要設(shè)置Server Runtime,
Window -> Perferences -> Server -> Runtime Environments -> Add -> Apache Tomcat ... , 這樣一步步做下去即可。
此問(wèn)題解決方法:
工程右鍵 -> Build Path -> Configure Build Path -> Libraries -> Add Library -> Server Runtime -> 選擇通過(guò)上面上面步驟添加的server即可, 最后點(diǎn)擊Apply。
就可以看到j(luò)sp頁(yè)面上的錯(cuò)誤消失。