Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parameters thru hyperlink

Status
Not open for further replies.

sweng

Programmer
Jun 2, 2003
10
IN
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= &quot;hday.jsp?title= <%= rs.getString(1) %> &cdid=hai&quot;

if somebody finds a soln ... pls inform me..

My code is pasted below: file name hday.jsp

<html>
<body>
<%@ page import=&quot;java.lang.*&quot; %>
<%@ page import=&quot;java.sql.* &quot; %>
<%@ page import=&quot;java.util.*&quot; %>

<script language=&quot;javascript&quot;>

function funSubmit(strval)
{
var strBool = false
var st=&quot;&quot;
var strHDate,strHDay

strHDate = document.frmHDay.txtHDate.value
strHDay = document.frmHDay.txtHDay.value
strHDay = trimWhitespace(strHDay)

if (strval== &quot;mod&quot;)
{

document.frmHDay.action = &quot;hdaydb.jsp?state=&quot;+strval+&quot;&quot;
document.frmHDay.submit()
}

}
</SCRIPT>
<form name=&quot;frmHDay&quot; method=&quot;post&quot;>
<BR><BR><BR><BR><BR><BR><BR><BR>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;50%&quot; align=&quot;center&quot;>

<tr>
<td colspan=&quot;2&quot;>
<table cellpadding=&quot;1&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; align=&quot;center&quot; bgColor=&quot;GRAY&quot; width=&quot;100%&quot;>
<tr>
<td>
<table border=&quot;0&quot; cellPadding=&quot;5&quot; cellSpacing=&quot;0&quot; width=&quot;100%&quot; align=&quot;center&quot; bgColor=&quot;GRAY&quot;>
<tr>
<td align=&quot;left&quot; width=&quot;30%&quot; ><b>Cdkey</b></td>
<td align=&quot;left&quot; colspan=&quot;2&quot;><b>Title</b></td>
</tr>
<tr>



<td align=&quot;left&quot; width=&quot;20%&quot;><input type=&quot;text&quot; name=&quot;txtHDate&quot; value=&quot;<%=request.getParameter(&quot;cdid&quot;)%>&quot; maxlength=&quot;50&quot; disabled style=&quot;width:70&quot;></td>
<td align=&quot;left&quot; width=&quot;30%&quot;><input type=&quot;text&quot; name=&quot;txtHDay&quot; value=&quot;<%=request.getParameter(&quot;title&quot;)%>&quot; maxlength=&quot;22&quot;></td>
<td align=&quot;right&quot; width=&quot;40%&quot;><input type=&quot;submit&quot; name=&quot;butMod&quot; value=&quot; Modify &quot; class=&quot;searchb&quot; Onclick=&quot;&quot;javascript:funSubmit('mod')&quot;&quot;>&nbsp;&nbsp;
<input type=&quot;button&quot; name=&quot;butCanc&quot; value=&quot; Cancel &quot; class=&quot;searchb&quot; Onclick=&quot;&quot;></td>
<input type=&quot;hidden&quot; name=&quot;hidDate&quot; value=&quot;&quot;>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan=&quot;2&quot;>
&nbsp;
</td>
</tr>


<tr>

<td colspan =&quot;2&quot;>
<table cellpadding=&quot;1&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; align=&quot;center&quot; bgColor=&quot;LIGHTGRAY&quot; width=&quot;100%&quot;>
<tr>
<td valign=&quot;top&quot;>
<table border=&quot;0&quot; cellPadding=&quot;5&quot; cellSpacing=&quot;0&quot; width=&quot;100%&quot; align=&quot;center&quot; bgColor=&quot;GRAY&quot;>
<% String flg;
Class.forName(&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;);
String url = &quot;Jdbc:eek:dbc:newslms&quot;;
Connection cd = DriverManager.getConnection(url,&quot; &quot;,&quot; &quot;);
Statement sm = cd.createStatement();
String str = &quot;SELECT CDId,Title FROM dbo_tb_CDDetails&quot; ;
ResultSet rs = sm.executeQuery(str);
ResultSetMetaData rsmd = rs.getMetaData();
int coloumn = rsmd.getColumnCount();


while(rs.next())
{ %>

<tr>

<td colspan =&quot;2&quot;> <a href= &quot;hday.jsp?title= hello&cdid=hai&quot;><% out.print(rs.getString(1));%></a></td>
<td colspan =&quot;2&quot;> <% out.print(rs.getString(2));%></td>

<td align=&quot;right&quot; width=&quot;30%&quot;>
<input type=&quot;checkbox&quot; name=&quot;chk&quot; >
</td>

</tr>
<%}

%>

</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
 
the rpoblem may be spaces in the link.

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top