tsx:userid 和 tsx:passwd 标记 JavaServer Pages 语法(不推荐使用)
使用 <tsx:userid> 和 <tsx:passwd> 标记,您不必在 <tsx:dbconnect> 标识中对用户标识和密码进行硬编码。

使用 <tsx:userid> 和 <tsx:passwd> 标记接受用户输入值,然后将该数据添加到请求对象。可以使用 JavaServer Pages (JSP) 文件(如请求数据库连接的 JSPEmployee.jsp 示例)来访问请求对象。
您必须在 <tsx:dbconnect> 标记中使用 <tsx:userid> 和 <tsx:passwd> 标记。
本部分描述 <tsx:userid> 和 <tsx:passwd> 标记的语法。
<tsx:dbconnect id=“connection_id” <font color=“red”><userid></font> <tsx:getProperty name=“request” property=request.getParameter(“userid”) /> <font color=“red”></userid></font> <font color=“red”><passwd></font> <tsx:getProperty name=“request” property=request.getParameter(“passwd”) /> <font color=“red”></passwd></font> url=“protocol:database_name:database_table” driver=“JDBC_driver_name”> </tsx:dbconnect>
其中:
- <tsx:getProperty>
表示语法是一种用于嵌入变量数据的机制。
- userid
表示对包含用户标识的请求参数的引用。您必须将此参数添加到传递到此 JSP 文件的请求对象。可以使用 HTML 表单或 URL 查询字符串来传递用户指定的请求参数,以在请求对象中设置此属性及其值。
- passwd
表示对包含密码的请求参数的引用。将此参数添加到传递到此 JSP 文件的请求对象。可以使用 HTML 表单或 URL 查询字符串来传递用户指定的值,以在请求对象中设置此属性及其值。