Version 7

    From the forums:

     

    To use JSPs, you have to unpack nukes.ear in a subdirectory of deploy called nukes.ear, then you do the same for the war archive. So you end up with :

     

    nukes.ear

     

    + nukes-lib.jar

     

    + nukes-ejb.jar

     

    + nukes.sar

     

    + nukes.war

     

    ++ WEB-INF

     

    +++ web.xml

     

    ++ test

     

    +++ test.jsp

     

     

    you can put your specific jsps in the nukes.war exploded archive.

     

     

     

    One way to use your JSP as a view, and the module as a controller. Define your operation methods on the module as per usual, and then to get the JSP going, do the following at the end of the operation method:

     

     

     

    There are several methods on Page,

     

       public void forward(String url)
    
       public void include(String url)
    
       public void sendRedirect(String url)
    

     

    which are useful in module operation methods.

     

     

    The forward and include methods expect URLs that are internal to Nukes, with a '/' at the start. sendRedirect does not need a '/'.

     

     

    forward does a classic servlet forward to a URL, preserving the values on the original request. In this case, it probably only be useful for full Nukes URLs, like:

     

     

    /index.html?module=mymodule&op=main

     

    More interesting for me is the include method, that includes the output of the request to the URL as part of the Page. This can be a JSP or whatever, and will appear as part of normal module output in the theme template.

     

     

    A usual operation method would be:

     

    public void operation(Page page) {
        doOperationAction(page);      // Do some work, possibly effecting the request and/or
                                      // response
                                      
        page.include('/myModule/display.jsp');   // Display the next page
    
        // or
    
        page.sendRedirect('test/test.jsp');
    }
    

     

    Using sendRedirect is a completely new request, avoiding any module, and does not allow you to do the operation as I outlined above. The URL of the resulting page from sendRedirect will appear as the full path to the JSP, rather than the requested Nukes URL.

     

     

    You can keep all generated links in the general form of the rest of Nukes, ie.

     'index.html?module=xxx&op=yyy' 

     

     

     

    To reach the JSP from the browser, you can do:

     

     

    http://localhost:8080/nukes/test/test.jsp

     

     

    This will have the output of the JSP appear in the main content area of Nukes.

     

     

     

    In terms of packaging, right now the JSPs need to be a part of the Nukes WAR. The URLs you will use for the JSPs are relative to the root of the Nukes WAR. There has been some work done to allow WARs, or WARs in EARs deployed in the server/default/nukes directory become part of nukes, but at the moment, they have a different ServletContext and therefore a different servlet Session than core Nukes, which causes problems.