Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 3rd, 2005, 01:01 AM
Registered User
 
Join Date: May 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Howtouse QueryString parameter in a <sql:query>tag

Hi,
   I have to make a link which lets you display data from the data base.On clicking that link there are various textboxes which are populated with data and are editable.

Now what i want is that how should i know in the target page that which link was clicked so that i can display the corresponding data in the textboxes..I am also using ............
request.getQueryString() function but now i dont know how to use this query sring parameter in the query...my code is this way.

<%@page import="java.util.*,java.lang.*" %>
<%! String str;
     int t;
     %>
<HTML>
<BODY bgcolor="cyan">
<h3>Rule details:</h3>
<% str= request.getQueryString();
    out.println(str);
  %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql_rt"%>
<sql:setDataSource var="datasource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/fcs"
/>
<sql:query var="rule" dataSource="${datasource}">
SELECT id,rule_name,condition,flag
FROM rulelist
where id="'+str+'"
</sql:query>
<title>Rule List Page</title>
<center>
<form method="POST" action="NewRule.jsp">
<c:forEach items="${rule.rows}" var="row">
<TABLE border="1">
<TR VALIGN=TOP ALIGN=LEFT>
<TD><B><I>Ruleid:</I></B></TD>
<TD><INPUT TYPE="text" NAME="RULEID" VALUE="${row.id}"><BR></TD>

<TD><B><I>Rule name:</I></B></TD>
<TD><INPUT TYPE="text" NAME="RULENAME" VALUE="${row.rule_name}"></TD>
</TR>
<TR VALIGN=TOP ALIGN=LEFT>
<TD><B><I>Priority:</I></B></TD>
<TD><INPUT TYPE="text" NAME="PRIORITY" VALUE="${row.condition}"></TD><TD><B><I>Rule Flag:</I></B></TD><TD><INPUT TYPE="text" NAME="RULEFLAG" VALUE="${row.flag}">
</TR>


</TABLE>
<table border="1">
<TR VALIGN=TOP ALIGN=LEFT>
<TD><B><I>Rule description:</I></B></TD>
<td><textarea cols="38" rows="5" name="myname">

</textarea></td></tr>
</TABLE>

</c:forEach>
<br>
<INPUT TYPE="submit" NAME="Submit" VALUE="Update rule">
<INPUT TYPE="submit" NAME="Submit" VALUE="Save rule">
<INPUT TYPE="submit" NAME="Submit" VALUE="Delete rule">
<br><br><br><br><br>
</center>

</BODY>
</HTML>


I have even seen using
<sql:param> tag buts it not working either....
Can anyone suggest me how to do it..........
I am a starter in JSP n not experienced........









Similar Threads
Thread Thread Starter Forum Replies Last Post
VB: Insert <p> tag Rich57 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 October 12th, 2007 05:19 AM
<a> tag in XML sani723 XSLT 5 March 27th, 2007 04:16 AM
Problem with <span> tag tclotworthy XSLT 2 February 18th, 2007 03:48 PM
<Form> tag within <form> tag rit01 ASP.NET 2.0 Basics 3 April 23rd, 2006 08:12 AM
Convert back from tag [] to <> android66 Javascript 9 August 10th, 2004 11:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.