servlet-HTTP状态500内部服务器错误

问题描述 投票:1回答:1

我在AWS中部署了Java Web应用程序,并尝试访问时出现了下面提到的错误。我没有使用xml文件,因为jsp会调用servlet类。

enter image description here

我的index.jsp代码:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<meta name=”viewport” content=”width=device-width,height=device-height initial-scale=1.0″/>
<link rel="stylesheet" href="style.css">
<form autocomplete='off' class='form' action="scrap" method="post">
    <div class='control'>
        <h1>
            Please fill details
        </h1>
    </div>
    <div class='control block-cube block-input'>
        <input name='Product link' placeholder='Product link' type='text'>
        <div class='bg-top'>
            <div class='bg-inner'></div>
        </div>
        <div class='bg-right'>
            <div class='bg-inner'></div>
        </div>
        <div class='bg'>
            <div class='bg-inner'></div>
        </div>
    </div>
    <div class='control block-cube block-input'>
        <input name='Email address' placeholder='Email address' type='text'>
        <div class='bg-top'>
            <div class='bg-inner'></div>
        </div>
        <div class='bg-right'>
            <div class='bg-inner'></div>
        </div>
        <div class='bg'>
            <div class='bg-inner'></div>
        </div>
    </div>
    <button class='btn block-cube block-cube-hover' type='sumbit'>
        <div class='bg-top'>
            <div class='bg-inner'></div>
        </div>
        <div class='bg-right'>
            <div class='bg-inner'></div>
        </div>
        <div class='bg'>
            <div class='bg-inner'></div>
        </div>
        <div class='text'>
            Save
        </div>
    </button>
    <div class='credits'>
    </div>
</form>
</html>

我的servlet代码

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<meta name=”viewport” content=”width=device-width,height=device-height initial-scale=1.0″/>
<link rel="stylesheet" href="style.css">
<form autocomplete='off' class='form' action="scrap" method="post">
    <div class='control'>
        <h1>
            Please fill details
        </h1>
    </div>
    <div class='control block-cube block-input'>
        <input name='Product link' placeholder='Product link' type='text'>
        <div class='bg-top'>
            <div class='bg-inner'></div>
        </div>
        <div class='bg-right'>
            <div class='bg-inner'></div>
        </div>
        <div class='bg'>
            <div class='bg-inner'></div>
        </div>
    </div>
    <div class='control block-cube block-input'>
        <input name='Email address' placeholder='Email address' type='text'>
        <div class='bg-top'>
            <div class='bg-inner'></div>
        </div>
        <div class='bg-right'>
            <div class='bg-inner'></div>
        </div>
        <div class='bg'>
            <div class='bg-inner'></div>
        </div>
    </div>
    <button class='btn block-cube block-cube-hover' type='sumbit'>
        <div class='bg-top'>
            <div class='bg-inner'></div>
        </div>
        <div class='bg-right'>
            <div class='bg-inner'></div>
        </div>
        <div class='bg'>
            <div class='bg-inner'></div>
        </div>
        <div class='text'>
            Save
        </div>
    </button>
    <div class='credits'>
    </div>
</form>
</html>
java servlets amazon-ec2
1个回答
0
投票

java.lang.UnsupportedClassVersionError的原因是编译时JDK较高而运行时JDK较低。>

@WebServlet(name="/scrap",urlPatterns={"/scrap"}) public class scrap extends HttpServlet { static String start="start"; public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String link = request.getParameter("Product link"); String email = request.getParameter("Email address"); //response.setContentType("text/html"); PrintWriter out = response.getWriter(); if(start.contentEquals("start")) { start="notsatrt"; Thread newthread = new Thread(new test()); newthread.start(); } database testing=new database(link,email); testing.verification(); testing.run(); request.setAttribute("verifyemail",email); request.getRequestDispatcher("/before.jsp").forward(request,response); out.close(); } public void destroy() { // do nothing. } }

© www.soinside.com 2019 - 2024. All rights reserved.