简体   繁体   English

为什么仅在2种情况下out.println输出为空

[英]Why out.println output is null for just 2 cases

Everything is ok but mt & cat give me null... 一切都很好,但是山猫和猫给了我空...

<head>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <title>Video Club</title>

</head>

<body>

    <h1>Movie & Customer Info</h1>

     <%
    String name = request.getParameter("name");
    out.println("Όνομα: " + name); 
    %><br><br>
    <%
    String sur = request.getParameter("surname");
    out.println("Επίθετο: " + sur);
    %><br><br>
    <%
    String card = request.getParameter("card");
    out.println("Πιστωτική κάρτα: " + card);
    %><br><br>
    <%
    String mt = request.getParameter("MovieTitle");
    out.println("Τίτλος Ταινίας: " + mt);
    %><br><br>
    <%
    String cat = request.getParameter("category");
    out.println("Category: " + cat);
    %>

</body>

I'm using netbeans IDE 8.0.2 and this is finalResults.jsp linked with checkout.jsp 我正在使用netbeans IDE 8.0.2,这是与checkout.jsp链接的finalResults.jsp

<head>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <title>Video Club</title>

</head>
<body>
    <h1>Checkout</h1>
    <h3>Please Use Latin Characters</h3>
     <%
    String mt = request.getParameter("MovieTitle");
    out.println("Τίτλος Ταινίας: " + mt); 
    %>

    <form action ="finalResults.jsp" method="post">
        <br>
    Όνομα:<br>
        <input type="text" name="name">
        <br>
    Επίθετο:<br>
        <input type="text" name="surname">
        <br>
    Πιστωτική κάρτα:<br>
        <input type="text" name="card">
    <br><br>
        <input type ="submit" value ="Ολοκλήρωση"/>
    </form>


</body>

checkout.jsp has also a previous one named list.jsp and before that is index.jsp checkout.jsp也有一个以前的名字叫list.jsp的文件,在此之前是index.jsp

mate, you are missing the input in your form 队友,您缺少表格中的输入

<form action ="finalResults.jsp" method="post">
    <br>
Όνομα:<br>
    <input type="text" name="name">
    <br>
Επίθετο:<br>
    <input type="text" name="surname">
    <br>
Πιστωτική κάρτα:<br>
    <input type="text" name="card">
<br><br>
 <input type="text" name="MovieTitle">
 <input type="text" name="catagory">
    <input type ="submit" value ="Ολοκλήρωση"/>
</form>

I used session.setAttribute("SES_CAT",cat); 我使用了session.setAttribute(“ SES_CAT”,cat); in the second .jsp to store the value and String cat=(String)session.getAttribute("SES_CAT"); 在第二个.jsp中存储值和String cat =(String)session.getAttribute(“ SES_CAT”); in the last .jsp to call it.Thanks for the idea for the hidden fields but that worked better for me... 在最后一个.jsp中调用它。感谢隐藏字段的想法,但对我来说效果更好...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM