Is it possible to perform lazy evaluation in a JSP script
I am developing a library that will be used a JSP page at multiple points. So essentially, there is like some code to be dynamically inserted in some part of the page similar to:

    Hello <% out.println("World"); %>

Now, this may be used at a lot of places and to actually fetch these resources, I have to make a network call. So what I was wishing to do is something like this (in the lower row, I'm mentioning the offsets):

    Hello <% mylib.call(this, "some_param"); %>
    0     5                                    37

So, with the `this` object (I'm guessing it is a JSPServletWrapper?), I could do this:

    void mylib.call(JSPServletWrapper wrapper, String param) {
        int pos1 = wrapper.getCodeStart(); //Returns 5
        int pos2 = wrapper.getCodeEnd(); // Returns 37
        mylist.push(new CodePosition(pos1, pos2, param);
    }

And then if there was a hook like this, which would run after the entire JSP was rendered (allowing me to further modify the outgoing JSP document):

    void onJSPRender() {
        // Run through the entire list and inject the required code
    }

I know this is a long shot.. but is this, by any chance possible?
Is it possible to perform lazy evaluation in a JSP script
===

I am developing a library that will be used a JSP page at multiple points. So essentially, there is like some code to be dynamically inserted in some part of the page similar to:

    Hello <% out.println("World"); %>

Now, this may be used at a lot of places and to actually fetch these resources, I have to make a network call. So what I was wishing to do is something like this (in the lower row, I'm mentioning the offsets):

    Hello <% mylib.call(this, "some_param"); %>
    0     5                                    37

So, with the `this` object (I'm guessing it is a JSPServletWrapper?), I could do this:

    void mylib.call(JSPServletWrapper wrapper, String param) {
        int pos1 = wrapper.getCodeStart(); //Returns 5
        int pos2 = wrapper.getCodeEnd(); // Returns 37
        mylist.push(new CodePosition(pos1, pos2, param);
    }

And then if there was a hook like this, which would run after the entire JSP was rendered (allowing me to further modify the outgoing JSP document):

    void onJSPRender() {
        // Run through the entire list and inject the required code
    }

I know this is a long shot.. but is this, by any chance possible?