• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using JSTL in scriplets - compile error

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am learning JSTL and find useful using c:sql tag. But if I use it in
JSP pages that have function declaration like below I get comiple error. Are we not allowed to use JSTL in Java code. Reallyn when I look at java fiel in work directory it seems compile error.:

<%!
String convertResultsToSelect () throws SQLException
{
<sql:setDataSource var="example" scope="application"
driver="oracle.jdbc.driver.OracleDriver"
url="jdbc racle:thin:@locathost:8080 rcl"
user="scott"
password="tiger"
/>
<sql:query dataSource="${example}" var="empList" scope="request">
SELECT * FROM test_object

</sql:query>

return "sb";
}
%>
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just like any other tags, you cannot embed JSTL tags in scriptlet code.
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moreover, JSTL meant to avoid the use of scriplets. Use as less scriptlets as you can. Most of the time we dont need those classic scriplets.
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rajesh

Infact JSTL was developed to make the view (JSP) make it readable and also to keep it clean from the usual scriplet logic for that they provided some tag-libs for doing normal if,for and also logical operations along with sql operations infact i found out that it is still evolving and we can expect some more useful tags.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic