小编dan*_*hem的帖子

HTTP状态500 - Servlet.init()

MyResource

@Path("myresource")
public class MyResource {

    /**
     * Method handling HTTP GET requests. The returned object will be sent
     * to the client as "text/plain" media type.
     *
     * @return String that will be returned as a text/plain response.
     */
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String getIt() {
        return "Got it!";
    }
}
Run Code Online (Sandbox Code Playgroud)

的index.jsp

<html>
<body>
    <h2>Jersey RESTful Web Application!</h2>
    <p><a href="webapi/myresource">Jersey resource</a>
    <p>Visit <a href="http://jersey.java.net">Project Jersey website</a>
    for more information on Jersey!
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

web.xml中

<?xml version="1.0" encoding="UTF-8"?>
<!-- This web.xml …
Run Code Online (Sandbox Code Playgroud)

java tomcat servlets

7
推荐指数
3
解决办法
1万
查看次数

标签 统计

java ×1

servlets ×1

tomcat ×1