Create a Java Web Application using Embedded Tomcat to develop a web app using Java.
First of all, I would like to import my own class into index.jsp and use it.
For example, I created a class called Test and put a file called Test.java in the same directory as index.jsp, but when I opened index.jsp, I found that
"Test cannot be resolved to a type" appears. <%@pageimport="Test"%>
is also declared.
Anerror occurred at line: 7 in the jsp file:/index.jsp
Tes cannot be resolved to a type
4:
5:<%
6:
7—Test = new Test();
When I hit mvn --version,
mvn --version
Apache Maven 3.0.5 (XXXX; 2013-02-19 22:51:28 + 0900)
Maven home: /usr/local/apache-maven-3.0.5
Java version: 1.6.0_65, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: ja_JP, platform encoding: SJIS
OS name: "macos x", version: "10.9.5", arch: "x86_64", family: "mac"
As a rough question,
In addition, I would appreciate it if you could point out the above.
java heroku tomcat
It may not be a clear answer because it is unclear what you are using for your development environment, including your build environment.
The embeddedTomcatSample you are trying to use was a maven project, so I chose Eclipse 4.5.1 as the development environment and imported it as a maven project in Eclipse.
Eclipse automatically builds maven, automatically builds applications, compiles during development, and doesn't have to worry about where to place class files.
The steps are as follows:
Also, JSP told me that it is not possible to refer to the class, but is it possible that the Java class is not compiled or placed correctly?
I was able to create a separate package class for verification and load it from the forward to Servlet→JSP.
I hope it will be helpful.
© 2024 OneMinuteCode. All rights reserved.