Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp jstl sql strange behaviour with as in mysql

 
Pradyut Bhattacharya
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1784
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic