Announcement Announcement Module
No announcement yet.
A real POJO based web framework... Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • A real POJO based web framework...

    Hi everyone!

    I'm currently developing a simple webframework that is intended to be a real POJO based web framework, in the sense that your java classes don't have to extended framwork specific classes. As i think that it really can be done i would appreciate a feedback from anyone of you. I am writing this here because i want the framework to very closely connected with spring. So, let me describe what i have now:

    First, the basic idea is to have an clean xhtml page, with no special tags and a coresponding java class. I inspired from the existing framework, Tapestry.
    This inspiration comes in the form of special html attributes that provide the information to the framework. By the way, the framework is called Kalia, wich means "beauty" in ancient greek.

    However, Kalia should be less restrictive about components like Form, Body, Shell etc...

    Next, Kalia will make the connection between the java class and xhtml file simply in order to put data, i.e. strings, url, in the html text, and to get data from there, and to do the action flow.

    Speaking of action flow, Kalia, should definetly be a component centric framework.

    Now, let me show a little bit of code:

    1. We have a configuration file, named appName-application.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    	<component id="componentName" class="org.kalia.test.TestComponent" file="component.html" />
    	<page id="firstBean" class="org.kalia.test.TestBean" file="index.html" />
    	<page id="secondBean" class="org.kalia.test.TestSecondBean" file="second.html" />
    Use of spring would come in the form:

    <page ...>
          <service name="classPropertyName"   springBean="myService"  />
    The connection to the spring application context can be done easily trough web context. Other way are possible too!

    What's next is similar to tapestry way of injecting java properties into html pages through ognl expressions.

    What i have succeded until now is:

    1. Fill up forms with data from java, and take it back to java, even without having a Form component.

    2. A link to another page or, mode specific, any method from that page that accepts parameters that have a good String representation. I think is not a problem to limit our self to sending only this kind of information on request, and not having advance parameters like tapestry does, for the aim of simplicity(POJO classes and no need for rewinding). In general is sufficient to send only the id of the item you're editing, deleting etc.

    3. "For" cycles on a list of objects, just like tapestry has, with a java.util.List, a current item, and, eventually, an index.

    4. An "if" is very easy to optain, but haven't got time yet to do that.

    5. A important problem is that of the components. I think i got the solution, as i put a little bit of into code, and it works. I was able to have a component with a separate class and html file, and insert it into a page. We should see what are the issues when thinking about links from components, where their shoud lead and the connection with the containing bean/class etc.

    6. Optionally, a class can implement an interface to listen on events like begin render, end render etc. An idea i had is put the information into
    a framework's custom implementation of a java.util.Map and pass it to the methods of this interfaces. This way the depency to the framework is reduced, and make the classes even easier to test.

    7. A last point, (more if i have any feedback from you) are some of the advantages:

    - very easy to test. I mean, extreamly easy to test. Having nothing more than pojo's the is no problem to test them however you want to.

    - the fact that Kalia is a web framework doesn't stop us to make an extension in order to test it as s stand alone application, with no interfaces.
    More ideas are welcomed here.

    Please tell me what you think, and those of that have more experience in web development, please tell me what are the issues that shoul be taken care of in a web framework.

    Cristian Pascu