permaculture playing cards
The moose likes Other Application Frameworks and the fly likes Storing code in the database (yay! wooo!) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Storing code in the database (yay! wooo!)" Watch "Storing code in the database (yay! wooo!)" New topic

Storing code in the database (yay! wooo!)

Caden Whitaker

Joined: Jan 15, 2009
Posts: 24

We have a series of landing pages accessable to our clients. Our clients send emails out and the receivers can click on a link that sends them to a landing page.

This landing page could do multiple things, for example, our most entertaining landing pages do the following:

1) Hit a database to display information

2) Show a form

3) Open a PDF

4) Prompt the receiver to download an xls spreadsheet

Not only that our clients want the ability to design their own landing pages with their own logic. This may involve pages that hit the client's webservices or other 3rd party operations.

So I could do it this way:

1) Create a table called landing_page with columns like id/location, the location would point to a specific jsp, so data like this:

Which could point to a folder on our webserver, like this:

And when the email goes out, we would include the specific jsp in a link.

However, that means each new client request must require a code built on our end (or us giving hundreds of clients access to the web root). This is becoming painful.

I could store the jsp in the database, this would give me the power to allow clients to create their own "code", it could be forced throug a QA session (like they must present their code to our QA environment, and then when we approve it, it moves to production). This seems to be a well recived idea because our clients are asking for the ability to turn this over to their developers.

However, this means I am building yet another specific framework that some poor sap is going to complain about 3 years from now.

What does that leave me? Could I do something with groovy, groovy server pages, grails, is there something out there that is supportive of this idea/concept?
David Newton

Joined: Sep 29, 2008
Posts: 12617

FreeMarker, Velocity, any template language. As long as what's available on the page is defined by you, this approach works just fine.

You will suffer mightily regardless: pain and anguish are inevitable.

If they need access to arbitrary data and functionality you'd be better off using a wiki.
I agree. Here's the link:
subject: Storing code in the database (yay! wooo!)
It's not a secret anymore!