从jsp更新数据

时间:2016-12-31 16:04:06

标签: java html sql jsp

我的网站代码存在问题。是人们可以买票的在线票激活系统。我有更新部分的问题。人们可以看到他们的预订,他们可以使用名为update的按钮进行更新,他们的票数将根据所选人数来改变。当我执行网站时,我遇到的错误是“遇到'空'”有什么问题?我怎样才能做到这一点。 enter image description here

myreservations.jsp

Simply add this code in your theme’s functions.php file.
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );
This code tries to increase upload maximum filesize, post maxiumum size, and maximum execution time limits for your WordPress site. However, this may not work for some WordPress websites.
In that case, you can try adding this code to your .htaccess file in your site’s root folder.
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

If both of these methods fail, then you can try adjusting these values using php.ini file.

Ref: http://www.wpbeginner.com/beginners-guide/how-to-upload-large-images-in-wordpress/

update.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import ="java.sql.*" %>




<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Book Ticket</title>
</head>

<body background="http://www.teamarking.com/barcode/bar_background.jpg"> 
<form method="post" action="reservations.jsp">


    <center>    
        <form action='cancel.jsp'><input type='hidden' name='cancel' value='Cancel Reservation'></form>

        <table border="1" width="30%" height="30%">
            <tr>
                <th><font color='#D18603'>ActivityID</font></th>
                <th><font color='#D18603'>Username</font></th>                  
                <th><font color='#D18603'>Ticket</font></th>
                <th><font color='#D18603'>Cancel</font></th>
                <th><font color='#D18603'>Update</font></th>

            </tr>




            <%
                Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
                Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/users", "users", "123");
                String username = (String) request.getSession().getAttribute("username");
                Statement st = con.createStatement();
                ResultSet rs;
                rs = st.executeQuery("select * from reservation where username='" + username + "'");
                while (rs.next()) {

                    String ActivityID = rs.getString("id");
                    username = rs.getString("username");
                    String buy = rs.getString("buy");

                    out.println("<tr>");
                    out.println("<td>" + ActivityID + "</td>");
                    out.println("<td>" + username + "</td>");
                    out.println("<td>" + buy + "</td>");
                    out.println("<td><b><form action='cancel.jsp'><input type='submit' name='cancel' value='Cancel Reservation'><input type='hidden' name='activityID' value='"+ActivityID+"'></form></b>");
                    out.println("<td><b><form action='update.jsp'><select name='update'><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option></select><input type='submit' value='Update'><input type='hidden' name='buy' value='"+buy+"'></form></b>");

                    out.println("</tr>");

                }

                st.close();

            %>

    </center>
</table>


<br><a href='success.jsp'>Back</a>

<br><br><a href='logout.jsp'>Log out</a>


</form>
</body>
</html>

这是错误enter image description here

0 个答案:

没有答案