Search Results

Search found 4 results on 1 pages for 'slavko'.

Page 1/1 | 1 

  • Where to store a DataSource resource in a Java web app?

    - by Slavko
    This is a rookie question. What's the best place to put @Resource private DataSource ds; in a web application? Do I put it in a servlet, context listener or maybe there's a better place for it? Also, do I create a new Connection object in my doGet()/doPost() or should I do it somewhere else? What's the best practice for stuff like this? Thank you!

    Read the article

  • Passing DataSource object from a servlet to a JavaBean

    - by Slavko
    I like the ease of using @Resource annotation to get a DataSource, but as far as I know, it's not possible to use it in a regular JavaBean. Would it be considered a bad practice if I pass the DataSource object from a servlet to a bean along with the other data to avoid having that lookup code in the bean?

    Read the article

  • PreparedStatement.setString() method without quotes

    - by Slavko
    I'm trying to use a PreparedStatement with code similar to this: SELECT * FROM ? WHERE name = ? Obviously, what happens when I use setString() to set the table and name field is this: SELECT * FROM 'my_table' WHERE name = 'whatever' and the query doesn't work. Is there a way to set the String without quotes so the line looks like this: SELECT * FROM my_table WHERE name = 'whatever' or should I just give it up and use the regular Statement instead (the arguments come from another part of the system, neither of those is entered by a user)?

    Read the article

  • Path to a file in a webapp under GlassFish

    - by Slavko
    How do I specify the path to a file in a web application? I have a folder named 'templates' under WEB-INF, I've been told that under GlassFish v3 the path should look like this: ./WebContent/WEB-INF/templates but this way I'm getting a file not found exception. What do I have to change in order to make it work?

    Read the article

1