Answer the question
In order to leave comments, you need to log in
How to specify path to JSP?
I understand that most of the answers on the topic html css js and php are unlikely to be answered here (But little is here ru.stackoverflow.com/questions/487393/%D0%9A%D0%B0...
Answer the question
In order to leave comments, you need to log in
Watching what you are using. If Spring, then the prefix and suffix are specified in the configuration. And in the controller, only the name of the view. If Java EE, then in web.xml . Judging by the project in the screenshot. You need to create a web.xml and organize your project structure properly.
What is the rubbish in the project? Learn maven, see what structure a standard Maven project has.
If you use Jetty, then you can do this (provided that your project structure is normal, and not like right now):
1) Create a folder in the src/main/resources folder named webapp, for example
2)
// Application.java
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import javax.servlet.Servlet;
class Application implements Runnable {
Server server;
ServletContextHandler handler;
public Application() {
server = new Server(8080);
handler = new ServletContextHandler(ServletContextHandler.SESSIONS);
server.setHandler(handler);
}
@Override
void run() {
try {
server.start();
server.join();
} finally {
server.destroy();
}
}
void addServlet(String path, Servlet servlet) {
handler.addServlet(new ServletHolder(servlet), path);
}
void addServlet(String path, Class<? extends Servlet> servletClass) {
handler.addServlet(new ServletHolder(servletClass), path);
}
}
// Main.java
import org.eclipse.jetty.servlet.DefaultServlet;
public class Main {
public static void main(String args[]) {
Application app = new Application();
app.handler.setContextPath("/");
app.handler.setResourceBase(Main.class.classLoader.getResource("webapp").toExternalForm());
app.handler.addServlet("/*", DefaultServlet.class);
app.handler.addServlet("/api/v1/*", JerseyServlet.class);
app.handler.addServlet("/ws/*", WSServlet.class);
app.run();
}
}
apply plugin:'application'
...
mainClassName = "your.package.app.Main"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question