aspose file tools*
The moose likes JSP and the fly likes jsp jstl sql strange behaviour with as in mysql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp jstl sql strange behaviour with as in mysql" Watch "jsp jstl sql strange behaviour with as in mysql" New topic
Author

jsp jstl sql strange behaviour with as in mysql

Pradyut Bhattacharya
Ranch Hand

Joined: Aug 12, 2004
Posts: 63
Hi
In mysql i m having a stored procedure which has a sql like:


I m using a jstl code to get the values: -


But this code does not return anything but when the replace the above code ${rows.i_firstname} with ${rows.firstname} i get the correct values.

Anything wrong with jstl, is this replicable or my fault here...

Question also posted here: - http://stackoverflow.com/questions/4998749/jsp-jstl-sql-strange-behaviour-with-as-in-mysql

thanks


Pradyut
http://pradyut.tk/
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 515
Hi,
You are selecting i_firstname as firstname(i.e. using aliases in SQL) and that is the reason why it works when you access "rows.firstname".
It is working as expected. Is there any other reason that you think it has strange behaviour?

regds,
Amit
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
amit punekar wrote:Hi,
You are selecting i_firstname as firstname(i.e. using aliases in SQL) and that is the reason why it works when you access "rows.firstname".
It is working as expected. Is there any other reason that you think it has strange behaviour?


I would suggest you take a closer look.
What I see is: select firstname as i_firstname

So it is coming back with the column name rather than the alias specified.
Of course that sql is embedded in a stored procedure in some fashion. I'm not entirely certain how a stored procedure is expected to return a result set.

What does the stored procedure you are using look like?
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 515
Hello,
Yeah that's right. Thanks for pointing this out.
Apologies for not reading the SQL properly..assumed that the query is correct...:-|

regards,
Amit
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp jstl sql strange behaviour with as in mysql