3 Replies Latest reply on Mar 23, 2005 7:09 AM by juggernaut

    storing JSPs in database

    atomray

      Hi,

      I'm making some modifications to a webapp that I've written for online surveys. I'd like it so that when I create a new survey in the database I can create a series of JSP files and store them in the DB - this way I can avoid redeploying the EAR that the webapp is stored in. After studying the issue for the afternoon one way to approach this seems to by to create a custom JspServlet extending the Tomcat one and loading the JSP code from the DB instead of the filesystem, but after looking through some code I started to think that there might be an easier/cleaner way to do it; in particular, there seems to be some support already for JNDI resources, and noting this thread:

      http://www.jboss.org/index.html?module=bb&op=viewtopic&t=52326

      I started to think that there might already be partial support for what I want to achieve.

      Does anyone have any pointers, suggestions or links they could share?

      Or perhaps another approach that would allow me avoid redeployment?

      Thanks very much,
      Adam

        • 1. Re: storing JSPs in database
          juggernaut

          Hi Adam!

          Maybe you should consider storing survey data ( questions, possible answers, type of answers ( textbox, radio, checkbox etc.)) in your db and then, depending on which survey user wants to take, generate survey pages using one and the same JSP for all cases? In this case, you will not need to extend JspServlet and do other non-obvious things. If you are interested in this kind of solution, PM me and I'll try to explain it in more details.

          take care,
          -- juggernaut

          • 2. Re: storing JSPs in database
            atomray

            Hi juggernaut, thanks for the response,

            We already store all the survey data in the database, as you describe, however we don't wish to use the same JSP for all surveys. We would like addional flexibility to deal with unforeseen requirements and storing the JSPs in a location that is easy to modify seems to achieve this.

            Adam

            • 3. Re: storing JSPs in database
              juggernaut

              For exmple? If you want to include some additional HTML code (for more banners/images/links etc. you can store them in db too). If you want to change page layouts, you should consider using some template engine (Velocity for ex.)/