<html><a id="fakeanchor" href="3.jsp?id=<%=request.getParameter("id")%>" >id</a>
</html>
<script>
$("a#fakeanchor").click(function()
{
$("#submit_this").submit();
return false;
});
</script>
Я пытаюсь заменить кнопку отправки тегом привязки, а также отправить значение resultet в базу данных jsp.please, сообщив, что здесь происходит неправильно.
Вот полный код страницы jsp.
<form method="POST" id="submit_this" action="3.jsp" name="form1">
<br><br><br><br><br>
<TABLE border="10" width="1250">
<CAPTION><EM>A test table with merged cells</EM></CAPTION>
<TR><TH rowspan="2">Parameters
<TH rowspan="2">Excellent <TH rowspan="2">Fair <TH rowspan="2">Good
<TR><TH>Poor
<TR><TH height="100">Presentation Content <TD ><input type="radio" name="r" value="Excellent"/><TD w width="150">
<input type="radio" name="r" value="Fair"/><TD width="100"><input type="radio" name="r" value="Good"/>
<TD width="100"><input type="radio" name="r" value="Poor"/>
<TR><TH height="100">Communication and Presentation Skills<TD>
<input type="radio" name="a" value="Excellent"/><TD><input type="radio" name="a" value="Fair"/><TD>
<input type="radio" name="a" value="Good"/><TD><input type="radio" name="a" value="Poor"/>
<TR><TH height="100">Depth of Knowledge<TD><input type="radio" name="d" value="Excellent"/><TD>
<input type="radio" name="d" value="Fair"/><TD><input type="radio" name="d" value="Good"/><TD>
<input type="radio" name="d" value="Poor"/>
<TR><TH height="100">Time utilization<TD><input type="radio" name="i" value="Excellent"/><TD>
<input type="radio" name="i" value="Fair"/><TD><input type="radio" name="i" value="Good"/><TD>
<input type="radio" name="i" value="Poor"/>
<TR><TH height="100">Involving Audience<TD><input type="radio" name="o" value="Excellent"/>
<TD><input type="radio" name="o" value="Fair"/><TD><input type="radio" name="o" value="Good"/>
<TD><input type="radio" name="o" value="Poor"/>
</TABLE>
<br><br><br><br>
<b><font size="4">Feel Free to add any comments aur suggestions</font></b><br><br>
<textarea name="text" rows=4 cols=100></textarea>
<br>
<br
<a id="fakeanchor" href="3.jsp?id=<%=request.getParameter("id")%>" >id</a>
</form>
i am getting an ID number from first.html and showing it on jsp page through
ResultSet resultset =
statement.executeQuery("select * from register where id = '" + id + "'") ;
if(!resultset.next()) {
String site = new String("http://localhost:8888/Feedback/error.html");
response.setStatus(response.SC_MOVED_TEMPORARILY);
response.setHeader("Location", site);
} else {
%>
<center><b>
<font size="4">WELCOME
<%= resultset.getString(2) %>
that ID number should be saved along with the corresponding radio buttons,the user (same ID)clicks on.
how do i save the resultset value to the database.
I am sending the resultset value to other jsp which contains my database connections etc. through href.
.thats why i want this href link to behave same like submit button.
так что я могу отправить значение resultet в 3.jsp и отправить форму.
HTML page
<form method="GET" action="2.jsp" name="form1" target="_blank" onsubmit="setTimeout(function ()
{ window.location.reload(); }, 10)">
<p>
<center>
<b><font size="6">Welcome to the feedback page</font></b>
</center>
</p>
<p align="center"><br><br><br><br>
<center>ENTER YOUR SAP ID : <input type="text" name="id"/></center><br><br>
<center><input type="submit" name="" value="Submit" onClick="return (verify());"/></center>
</p>
</form>
Прежде всего, я думаю, вы хотите установить 3.jsp?id=..
вашей формы, поэтому в вашей функции вам также понадобится
$("a#fakeanchor").click(function()
{
$("#submit_this").action($(this).href());
$("#submit_this").submit();
return false;
});
Эта новая линия, которую я добавил помещу href
значения ссылки в action
значения формы.
Вот рабочий пример: http://jsfiddle.net/u5Fwt/2/
.action
до. .submit
submit_this
это форма?