• Post Reply Bookmark Topic Watch Topic
  • New Topic

jstl sql action  RSS feed

 
Bindesh Vij
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

I was trying the following using sql action tag in jstl



<s:setDataSource url="jdbc dbc sn1" var="dsname"
driver="sun.jdbc.odbc.JdbcOdbcDriver"
user="sa" password="sqlpass"/>


<s:query var="queryResult"
sql="select firstname,lastname from Employees"
dataSource="${dsname}" />

<c:forEach items="queryResult.rows" var="r">
<tr>
<td><c ut value="${r.firstname}"/></td>
<td><c ut value="${r.lastname}"/></td>
</tr>
</c:forEach>


But when i run this it shows me the following error

javax.servlet.ServletException: Unable to find a value for "firstname" in object of class "java.lang.String" using operator .

What is wrong here ...

pls. help

thnx in advance
[ October 28, 2004: Message edited by: Bindesh V. ]
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is not encouraged to use JSTL sql tags. i know this is not the answer, but its something you should know.

thanks
 
Bindesh Vij
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm just a beginner in JSTL . So if sql actions are discouraged can you also pls. suggest the reasons.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
download servlet & jsp book from theserverside.com. its a nice book for beginners, and you will also find best practices in that.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Bindesh V.",

We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Bindesh Vij
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx for the link..I have downloaded the PDF...

But I'm really eager to know what went wrong in the code
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Bindesh V.",

The request for you to modify your display name was not optional. Be advised that accounts with invalid display names are subject to removal. Please change your display name prior to your next post.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bindesh V.:
Thanx for the link..I have downloaded the PDF...

But I'm really eager to know what went wrong in the code


now you can try out the the book examples and after getting success get back to your previous code. i am sure you will make it to work.

cheers
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!