hi,
I have a problem with passing parameters thru hyperlink, I get an error called no data found..
the program works fine as the parameters I have passed are hello and hai.
But if I try to pass the value retrieved from the database as parameter
then I get an error.
<a href= "hday.jsp?title= <%= rs.getString(1) %> &cdid=hai"
if somebody finds a soln ... pls inform me..
My code is pasted below: file name hday.jsp
<html>
<body>
<%@ page import="java.lang.*" %>
<%@ page import="java.sql.* " %>
<%@ page import="java.util.*" %>
<script language="javascript">
function funSubmit(strval)
{
var strBool = false
var st=""
var strHDate,strHDay
strHDate = document.frmHDay.txtHDate.value
strHDay = document.frmHDay.txtHDay.value
strHDay = trimWhitespace(strHDay)
if (strval== "mod"
{
document.frmHDay.action = "hdaydb.jsp?state="+strval+""
document.frmHDay.submit()
}
}
</SCRIPT>
<form name="frmHDay" method="post">
<BR><BR><BR><BR><BR><BR><BR><BR>
<table border="0" cellpadding="0" cellspacing="0" width="50%" align="center">
<tr>
<td colspan="2">
<table cellpadding="1" cellspacing="0" border="0" align="center" bgColor="GRAY" width="100%">
<tr>
<td>
<table border="0" cellPadding="5" cellSpacing="0" width="100%" align="center" bgColor="GRAY">
<tr>
<td align="left" width="30%" ><b>Cdkey</b></td>
<td align="left" colspan="2"><b>Title</b></td>
</tr>
<tr>
<td align="left" width="20%"><input type="text" name="txtHDate" value="<%=request.getParameter("cdid"%>" maxlength="50" disabled style="width:70"></td>
<td align="left" width="30%"><input type="text" name="txtHDay" value="<%=request.getParameter("title"%>" maxlength="22"></td>
<td align="right" width="40%"><input type="submit" name="butMod" value=" Modify " class="searchb" Onclick=""javascript:funSubmit('mod')"">
<input type="button" name="butCanc" value=" Cancel " class="searchb" Onclick=""></td>
<input type="hidden" name="hidDate" value="">
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td colspan ="2">
<table cellpadding="1" cellspacing="0" border="0" align="center" bgColor="LIGHTGRAY" width="100%">
<tr>
<td valign="top">
<table border="0" cellPadding="5" cellSpacing="0" width="100%" align="center" bgColor="GRAY">
<% String flg;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"
String url = "Jdbcdbc:newslms";
Connection cd = DriverManager.getConnection(url," "," "
Statement sm = cd.createStatement();
String str = "SELECT CDId,Title FROM dbo_tb_CDDetails" ;
ResultSet rs = sm.executeQuery(str);
ResultSetMetaData rsmd = rs.getMetaData();
int coloumn = rsmd.getColumnCount();
while(rs.next())
{ %>
<tr>
<td colspan ="2"> <a href= "hday.jsp?title= hello&cdid=hai"><% out.print(rs.getString(1));%></a></td>
<td colspan ="2"> <% out.print(rs.getString(2));%></td>
<td align="right" width="30%">
<input type="checkbox" name="chk" >
</td>
</tr>
<%}
%>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
I have a problem with passing parameters thru hyperlink, I get an error called no data found..
the program works fine as the parameters I have passed are hello and hai.
But if I try to pass the value retrieved from the database as parameter
then I get an error.
<a href= "hday.jsp?title= <%= rs.getString(1) %> &cdid=hai"
if somebody finds a soln ... pls inform me..
My code is pasted below: file name hday.jsp
<html>
<body>
<%@ page import="java.lang.*" %>
<%@ page import="java.sql.* " %>
<%@ page import="java.util.*" %>
<script language="javascript">
function funSubmit(strval)
{
var strBool = false
var st=""
var strHDate,strHDay
strHDate = document.frmHDay.txtHDate.value
strHDay = document.frmHDay.txtHDay.value
strHDay = trimWhitespace(strHDay)
if (strval== "mod"
{
document.frmHDay.action = "hdaydb.jsp?state="+strval+""
document.frmHDay.submit()
}
}
</SCRIPT>
<form name="frmHDay" method="post">
<BR><BR><BR><BR><BR><BR><BR><BR>
<table border="0" cellpadding="0" cellspacing="0" width="50%" align="center">
<tr>
<td colspan="2">
<table cellpadding="1" cellspacing="0" border="0" align="center" bgColor="GRAY" width="100%">
<tr>
<td>
<table border="0" cellPadding="5" cellSpacing="0" width="100%" align="center" bgColor="GRAY">
<tr>
<td align="left" width="30%" ><b>Cdkey</b></td>
<td align="left" colspan="2"><b>Title</b></td>
</tr>
<tr>
<td align="left" width="20%"><input type="text" name="txtHDate" value="<%=request.getParameter("cdid"%>" maxlength="50" disabled style="width:70"></td>
<td align="left" width="30%"><input type="text" name="txtHDay" value="<%=request.getParameter("title"%>" maxlength="22"></td>
<td align="right" width="40%"><input type="submit" name="butMod" value=" Modify " class="searchb" Onclick=""javascript:funSubmit('mod')"">
<input type="button" name="butCanc" value=" Cancel " class="searchb" Onclick=""></td>
<input type="hidden" name="hidDate" value="">
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td colspan ="2">
<table cellpadding="1" cellspacing="0" border="0" align="center" bgColor="LIGHTGRAY" width="100%">
<tr>
<td valign="top">
<table border="0" cellPadding="5" cellSpacing="0" width="100%" align="center" bgColor="GRAY">
<% String flg;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"
String url = "Jdbcdbc:newslms";
Connection cd = DriverManager.getConnection(url," "," "
Statement sm = cd.createStatement();
String str = "SELECT CDId,Title FROM dbo_tb_CDDetails" ;
ResultSet rs = sm.executeQuery(str);
ResultSetMetaData rsmd = rs.getMetaData();
int coloumn = rsmd.getColumnCount();
while(rs.next())
{ %>
<tr>
<td colspan ="2"> <a href= "hday.jsp?title= hello&cdid=hai"><% out.print(rs.getString(1));%></a></td>
<td colspan ="2"> <% out.print(rs.getString(2));%></td>
<td align="right" width="30%">
<input type="checkbox" name="chk" >
</td>
</tr>
<%}
%>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>