RE: Hello, and need help
On Wed, 30 Jan 2002, Brady Moritz wrote: This jstl looks a bit interesting, was not really aware of it. Will this do away with the Jakarta project or will they remain parallel projects? JSTL is the JSP Standard Tag Library. It's essentially a standard add-on to JSP. Its reference implementation is distributed through the Jakarta Taglibs project. For more information on JSTL, I've posted an article at Manning's web site describing its role and future: http://www.manning.com Best, -- Shawn Bayern Author, JSP Standard Tag Library (Manning, upcoming) http://jstlbook.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Hello, and need help
The execute tag is meant for updates, inserts and deletes. What you probably want to use is the resultSet tag. sql:resultSet id=myRS % for( int i = 0; i val.size(); i++ )// What is val??? { % sql:getColumn position=%=i%/ % } % /sql:execute I think you're trying to print all the values that are returned from your query. I'm unsure of the origin of the variable 'val'. The resultSet tag will loop through all the rows by default, I assume the 'for loop' is meant to loop through all the fields in each given row in the result, thus val.size() should return the number of fields you're selecting in your where clause. -Original Message- From: Brady Moritz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 2:15 AM To: 'Tag Libraries Users List' Subject: RE: Hello, and need help Sorry to repeat, but does anyone have a clue on this or should I go about this a different way? Brady Moritz -Original Message- From: Brady Moritz [mailto:[EMAIL PROTECTED]] Sent: Monday, January 28, 2002 6:01 AM To: 'Tag Libraries Users List' Subject: Hello, and need help Hi everyone, Im new to the list so good to meet you. Any pointers on why the following code is disallowed, and a quick way to code around it? Apparently prepared statements do not allow run-time resolution of the query string. sql:query select * from orders where %= where % //where contains the where clause, with columnname=? repeated. //this build a dynamic query with varying number of elements /sql:query sql:execute % for(int i = 0; i val.size(); i++){ % sql:setColumn position=% out.write(String.valueOf(i)); % %= val.elementAt(0) %/sql:setColumn % } % /sql:execute Brady Moritz -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Hello, and need help
What im actually trying to accomplish is two things: - create a dynamic prepared statement each time so I can add where clauses to it. - use of the stmt instead of a normal query because I don't want to mess with figuring out if the where clause item needs to be quoted or not etc. val is a vector with all the values want to populate the preparedstament with... but apparently it doens tlike you to have variables ere and wants this data to b static. I didn't show the full tagset earlier, it is encompassed by a preapredstatement tag. sql:preparedStatement id=stmt1 conn=conn1 %-- set the SQL query. note the lack of quotes around the name value --% sql:query select * from orders where %= where % /sql:query sql:execute %for(int i = 0; i val.size(); i++){ % sql:setColumn position=%= i % %= val.elementAt(0) %/sql:setColumn %} % /sql:execute /sql:preparedStatement Brady Moritz -Original Message- From: Mader, Steve [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 7:39 AM To: 'Tag Libraries Users List' Subject: RE: Hello, and need help The execute tag is meant for updates, inserts and deletes. What you probably want to use is the resultSet tag. sql:resultSet id=myRS % for( int i = 0; i val.size(); i++ )// What is val??? { % sql:getColumn position=%=i%/ % } % /sql:execute I think you're trying to print all the values that are returned from your query. I'm unsure of the origin of the variable 'val'. The resultSet tag will loop through all the rows by default, I assume the 'for loop' is meant to loop through all the fields in each given row in the result, thus val.size() should return the number of fields you're selecting in your where clause. -Original Message- From: Brady Moritz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 2:15 AM To: 'Tag Libraries Users List' Subject: RE: Hello, and need help Sorry to repeat, but does anyone have a clue on this or should I go about this a different way? Brady Moritz -Original Message- From: Brady Moritz [mailto:[EMAIL PROTECTED]] Sent: Monday, January 28, 2002 6:01 AM To: 'Tag Libraries Users List' Subject: Hello, and need help Hi everyone, Im new to the list so good to meet you. Any pointers on why the following code is disallowed, and a quick way to code around it? Apparently prepared statements do not allow run-time resolution of the query string. sql:query select * from orders where %= where % //where contains the where clause, with columnname=? repeated. //this build a dynamic query with varying number of elements /sql:query sql:execute % for(int i = 0; i val.size(); i++){ % sql:setColumn position=% out.write(String.valueOf(i)); % %= val.elementAt(0) %/sql:setColumn % } % /sql:execute Brady Moritz -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Hello, and need help
Change the section of dbtags.tld for the setColumn tag to have the value yes in the rtexprvalue tag, and restart your server. tag namesetColumn/name tagclassorg.apache.taglibs.dbtags.preparedstatement.SetColumnTag/tagclass bodycontentJSP/bodycontent attribute nameposition/name requiredyes/required rtexprvalueyes/rtexprvalue /attribute /tag rtexprvalueyes/rtexprvalue was rtexprvalueno/rtexprvalue I think this what you're looking for. Hope it helps. -Original Message- From: Brady Moritz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 12:03 PM To: 'Tag Libraries Users List' Subject: RE: Hello, and need help What im actually trying to accomplish is two things: - create a dynamic prepared statement each time so I can add where clauses to it. - use of the stmt instead of a normal query because I don't want to mess with figuring out if the where clause item needs to be quoted or not etc. val is a vector with all the values want to populate the preparedstament with... but apparently it doens tlike you to have variables ere and wants this data to b static. I didn't show the full tagset earlier, it is encompassed by a preapredstatement tag. sql:preparedStatement id=stmt1 conn=conn1 %-- set the SQL query. note the lack of quotes around the name value --% sql:query select * from orders where %= where % /sql:query sql:execute %for(int i = 0; i val.size(); i++){ % sql:setColumn position=%= i % %= val.elementAt(0) %/sql:setColumn %} % /sql:execute /sql:preparedStatement Brady Moritz -Original Message- From: Mader, Steve [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 7:39 AM To: 'Tag Libraries Users List' Subject: RE: Hello, and need help The execute tag is meant for updates, inserts and deletes. What you probably want to use is the resultSet tag. sql:resultSet id=myRS % for( int i = 0; i val.size(); i++ )// What is val??? { % sql:getColumn position=%=i%/ % } % /sql:execute I think you're trying to print all the values that are returned from your query. I'm unsure of the origin of the variable 'val'. The resultSet tag will loop through all the rows by default, I assume the 'for loop' is meant to loop through all the fields in each given row in the result, thus val.size() should return the number of fields you're selecting in your where clause. -Original Message- From: Brady Moritz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 2:15 AM To: 'Tag Libraries Users List' Subject: RE: Hello, and need help Sorry to repeat, but does anyone have a clue on this or should I go about this a different way? Brady Moritz -Original Message- From: Brady Moritz [mailto:[EMAIL PROTECTED]] Sent: Monday, January 28, 2002 6:01 AM To: 'Tag Libraries Users List' Subject: Hello, and need help Hi everyone, Im new to the list so good to meet you. Any pointers on why the following code is disallowed, and a quick way to code around it? Apparently prepared statements do not allow run-time resolution of the query string. sql:query select * from orders where %= where % //where contains the where clause, with columnname=? repeated. //this build a dynamic query with varying number of elements /sql:query sql:execute % for(int i = 0; i val.size(); i++){ % sql:setColumn position=% out.write(String.valueOf(i)); % %= val.elementAt(0) %/sql:setColumn % } % /sql:execute Brady Moritz -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Hello, and need help
Very cool, ill give it a try. Thanks! Brady Moritz -Original Message- From: Mader, Steve [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 11:30 AM To: 'Tag Libraries Users List' Subject: RE: Hello, and need help Change the section of dbtags.tld for the setColumn tag to have the value yes in the rtexprvalue tag, and restart your server. tag namesetColumn/name tagclassorg.apache.taglibs.dbtags.preparedstatement.SetColumnTag/tagc lass bodycontentJSP/bodycontent attribute nameposition/name requiredyes/required rtexprvalueyes/rtexprvalue /attribute /tag rtexprvalueyes/rtexprvalue was rtexprvalueno/rtexprvalue I think this what you're looking for. Hope it helps. -Original Message- From: Brady Moritz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 12:03 PM To: 'Tag Libraries Users List' Subject: RE: Hello, and need help What im actually trying to accomplish is two things: - create a dynamic prepared statement each time so I can add where clauses to it. - use of the stmt instead of a normal query because I don't want to mess with figuring out if the where clause item needs to be quoted or not etc. val is a vector with all the values want to populate the preparedstament with... but apparently it doens tlike you to have variables ere and wants this data to b static. I didn't show the full tagset earlier, it is encompassed by a preapredstatement tag. sql:preparedStatement id=stmt1 conn=conn1 %-- set the SQL query. note the lack of quotes around the name value --% sql:query select * from orders where %= where % /sql:query sql:execute %for(int i = 0; i val.size(); i++){ % sql:setColumn position=%= i % %= val.elementAt(0) %/sql:setColumn %} % /sql:execute /sql:preparedStatement Brady Moritz -Original Message- From: Mader, Steve [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 7:39 AM To: 'Tag Libraries Users List' Subject: RE: Hello, and need help The execute tag is meant for updates, inserts and deletes. What you probably want to use is the resultSet tag. sql:resultSet id=myRS % for( int i = 0; i val.size(); i++ )// What is val??? { % sql:getColumn position=%=i%/ % } % /sql:execute I think you're trying to print all the values that are returned from your query. I'm unsure of the origin of the variable 'val'. The resultSet tag will loop through all the rows by default, I assume the 'for loop' is meant to loop through all the fields in each given row in the result, thus val.size() should return the number of fields you're selecting in your where clause. -Original Message- From: Brady Moritz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 2:15 AM To: 'Tag Libraries Users List' Subject: RE: Hello, and need help Sorry to repeat, but does anyone have a clue on this or should I go about this a different way? Brady Moritz -Original Message- From: Brady Moritz [mailto:[EMAIL PROTECTED]] Sent: Monday, January 28, 2002 6:01 AM To: 'Tag Libraries Users List' Subject: Hello, and need help Hi everyone, Im new to the list so good to meet you. Any pointers on why the following code is disallowed, and a quick way to code around it? Apparently prepared statements do not allow run-time resolution of the query string. sql:query select * from orders where %= where % //where contains the where clause, with columnname=? repeated. //this build a dynamic query with varying number of elements /sql:query sql:execute % for(int i = 0; i val.size(); i++){ % sql:setColumn position=% out.write(String.valueOf(i)); % %= val.elementAt(0) %/sql:setColumn % } % /sql:execute Brady Moritz -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Hello, and need help
Sorry to repeat, but does anyone have a clue on this or should I go about this a different way? Brady Moritz -Original Message- From: Brady Moritz [mailto:[EMAIL PROTECTED]] Sent: Monday, January 28, 2002 6:01 AM To: 'Tag Libraries Users List' Subject: Hello, and need help Hi everyone, Im new to the list so good to meet you. Any pointers on why the following code is disallowed, and a quick way to code around it? Apparently prepared statements do not allow run-time resolution of the query string. sql:query select * from orders where %= where % //where contains the where clause, with columnname=? repeated. //this build a dynamic query with varying number of elements /sql:query sql:execute % for(int i = 0; i val.size(); i++){ % sql:setColumn position=% out.write(String.valueOf(i)); % %= val.elementAt(0) %/sql:setColumn % } % /sql:execute Brady Moritz -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]