Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2011
    Posts
    62
    Rep Power
    0

    Default Question regarding application initialisation

    Normally there shouldn't be any Java Code in a JSP, but I couldn't find a better way to initialise the application than doing this:

    Java Code:
    <%!public void jspInit() {
    		........
    	}
    
    	public void jspDestroy() {
    		........
    	}
    %>
    Is there maybe a better option?
    Last edited by noodle_variation_187-X; 06-08-2012 at 02:17 PM. Reason: typo

  2. #2
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,808
    Rep Power
    19

    Default Re: Question regarding application initialisation

    What are you trying to do?
    Why do you feel you need these init() and destroy() methods?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    Join Date
    Aug 2011
    Posts
    62
    Rep Power
    0

    Default Re: Question regarding application initialisation

    I need the init() method to call some methods with default values. The destroy() method isn't actually needed.

  4. #4
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,808
    Rep Power
    19

    Default Re: Question regarding application initialisation

    Why do you feel you need some default values?
    Where are they coming from?
    I've never in almost 12+ years in Java web development encountered a need to use that for a JSP.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    Join Date
    Aug 2011
    Posts
    62
    Rep Power
    0

    Default Re: Question regarding application initialisation

    I've read that jspInit() is useful to acquire resources. However, I don't know if it's good practice to write the initialisation code directly into the jsp.

  6. #6
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,808
    Rep Power
    19

    Default Re: Question regarding application initialisation

    See my post on your other thread.
    It will cure you of this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. JavaDB application question
    By drimades in forum JDBC
    Replies: 1
    Last Post: 03-12-2012, 10:58 AM
  2. [Question] MVP with GWT application
    By Heba123 in forum GWT
    Replies: 1
    Last Post: 09-13-2010, 06:52 AM
  3. Replies: 1
    Last Post: 03-26-2010, 10:41 PM
  4. Replies: 1
    Last Post: 08-05-2009, 02:43 AM
  5. [SOLVED] Chat Application question
    By ChrisMayhew in forum New To Java
    Replies: 5
    Last Post: 01-09-2009, 08:44 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •