<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>
提交按鈕,我想更換錨標記提交按鈕,併發送結果集值數據庫jsp.please告訴是怎麼回事錯..錨對於ResultSet值在HREF
這裏是完整的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.
。這樣我可以把結果集值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>
是'submit_this'表單嗎? – Satpal
爲什麼不使用提交按鈕? –
你的表單ID應該是'id =「submit_this」',表單裏面不應該有'name =「submit」',並且在你的'a'標籤中替換href,使用'href =「javascript:void (0)「' – CodeBird