ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzatz_5.4.0.1/51/program/jspidp.htm

47 lines
2.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK rel="stylesheet" type="text/css" href="../../../rzahg/ic.css">
<title>&lt;tsx:userid&gt; and &lt;tsx:passwd&gt;</title>
</head>
<BODY>
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../../../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h5><a name="jspidp"></a>&lt;tsx:userid&gt; and &lt;tsx:passwd&gt;</h5>
<p>Instead of hardcoding the user ID and password in the &lt;tsx:dbconnect&gt; tag, you can use the &lt;tsx:userid&gt; and &lt;tsx:passwd&gt; tags to accept user input for the values and then add that data to the request object where it can be accessed by a JSP that requests the database connection.</p>
<p>The &lt;tsx:userid&gt; and &lt;tsx:passwd&gt; must be used within a &lt;tsx:dbconnect&gt; tag.</p>
<p>The &lt;tsx:userid&gt; and &lt;tsx:passwd&gt; must be used within a &lt;tsx:dbconnect&gt; tag. The &lt;tsx:userid&gt; and &lt;tsx:passwd&gt; syntax is:</p>
<pre>&lt;% String userID = request.getParameter(&quot;USERID&quot;); %&gt;
&lt;% String passWord = request.getParameter(&quot;PASSWD&quot;); %&gt;
&lt;tsx:dbconnect id=&quot;conn&quot; url=&quot;jdbc:db2:*local&quot; driver=&quot;com.ibm.db2.jdbc.app.DB2Driver&quot;&gt;
&lt;tsx:userid&gt;&lt;%=userID%&gt;&lt;/tsx:userid&gt;
&lt;tsx:passwd&gt;&lt;%=passWord%&gt;&lt;/tsx:passwd&gt;
&lt;/tsx:dbconnect&gt;</pre>
<p>This list describes the attributes and their values:</p>
<ul>
<li><p><strong>&lt;tsx:getProperty&gt;</strong>
<br>This syntax is a mechanism for embedding variable data. For more information, see <a href="jspget.htm">&lt;tsx:getProperty&gt;</a></p>
</li>
<li><p><strong>USERID</strong>
<br>This is a reference to the request parameter that contains the userid. The parameter must have already been added to the request object that was passed to this JSP file. The attribute and its value can be set in the request object using an HTML form or a URL query string to pass the user-specified request parameters.</p></li>
<li><p><strong>PASSWD</strong>
<br>This is a reference to the request parameter that contains the password. The parameter must have already been added to the request object that was passed to this JSP. The attribute and its value can be set in the request object using an HTML form or a URL query string to pass user-specified values.</p></li>
</ul>
</body>
</html>