View RSS Feed

Recent Blogs Posts

  1. Reading files from JSP

    by , 05-24-2011 at 02:44 PM (My Java Tips)
    Working in Servlets/JSP, you might have encountered The javax.servlet.ServletContext API. It provides methods to access resources in general.

    • getResource(String resource): will returns a URL for the resource in the web application.
    • getResourceAsStream(String resource): will returns an InpuStream for the resource in the web application
    • getResourcePaths(String path): will a directory-like listing of all the paths to resources within the web application.


    An example ...
    Categories
    JSP
  2. Using Java Beans in JSP

    by , 05-24-2011 at 02:42 PM (My Java Tips)
    JavaBeans are classes written in the Java programming language conforming to a particular convention.

    Consider the scenario: you are writing a JSP and you wish to write pure Java code in it. You may use scriptlets within JSP.

    Java Code:
    <%
    // Java code goes here
    %>
    Using scriptlets means that your JSP will contains business logic as well which is not a good design approach. Ideally you would like to keep business logic separately ...
    Categories
    JSP
  3. Fetching parameters from web.xml

    by , 05-24-2011 at 02:30 PM (My Java Tips)
    The file named web.xml is part of your web applications. You may use it for different purpose. Sometimes you wish to define some parameters for your web application in it. Obviously, you need to use this in your application. I will briefly tell you how to do this.

    At first, let me give you an example. We have a web application that needs to send its id and license code to some authentication server before doing some business operation. The id and license code are static and you may ...

    Updated 05-24-2011 at 02:34 PM by Java Tip

    Categories
    JSP , Servlet , XML