how find out the form is submit in JSP?
Posted
by user261002
on Stack Overflow
See other posts from Stack Overflow
or by user261002
Published on 2010-04-18T18:06:44Z
Indexed on
2010/04/18
18:13 UTC
Read the original article
Hit count: 391
I am trying to create a an online exam with JSP. I want to get the questions one by one and show them on the screen, and create a "Next" button then user is able to to see the next question, but the problem is that I dont know how to find out that the user has clicked on the "Next" button, I know how to do it in PHP : if($_SERVER['REQUEST_METHOD']=='GET') if($_GET['action']=='Next')
but I dont know how to do it in JSP. Please help me this is piece of my code: String result = ""; if (database.DatabaseManager.getInstance().connectionOK()) { database.SQLSelectStatement sqlselect = new database.SQLSelectStatement("question", "question", "0"); ResultSet _userExist = sqlselect.executeWithNoCondition(); ResultSetMetaData rsm = _userExist.getMetaData();
result+="<form method='post'>";
result += "<table border=2>";
for (int i = 0; i < rsm.getColumnCount(); i++) {
result += "<th>" + rsm.getColumnName(i + 1) + "</th>";
}
if (_userExist.next()) {
result += "<tr>";
result += "<td>" + _userExist.getInt(1) + "</td>";
result += "<td>" + _userExist.getString(2) + "</td>";
result += "</tr>";
result += "<tr>";
result += "<tr> <td colspan='2'>asdas</td></tr>";
result += "</tr>";
}
result += "</table>";
result+="<input type='submit' value='next' name='next'/></form>";
}
© Stack Overflow or respective owner