Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jsp showing error

I am getting the error in my eclipse mars. It won't show any pop up for that these errors. And I am able to successfully run even after the errors, though in this particular case that that is also a issue.

  1. I had to run my server again and again, it's not picking up changes.
  2. Why these red squiggly line.
  3. I am getting below error when trying to run this.

    Why red flags

Error:

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 13 in the jsp file: /HelloWorld.jsp
Date cannot be resolved to a type
10: 
11: <%
12: 
13: Date today = new java.util.Date();
14: 
15: String text = "Today's date is: " + today.toString();
16: %>
like image 281
User Avatar asked Jan 25 '26 10:01

User


1 Answers

You need to import date-class or fully qualify both.

Either put this at the top of your page:

<%@ page import="java.util.Date" %>
....
Date today = new Date();

or:

java.util.Date today = new java.util.Date(); 
like image 131
Denis Lukenich Avatar answered Jan 27 '26 22:01

Denis Lukenich



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!