Wednesday, January 1, 2014

HybridJava Challenge

The HybridJava Challenge


Comparison of Web frameworks is a difficult task. Even if we limit ourselves to the Java world server-side presentation layer we find dozens of frameworks. But what is a good framework? A freshman student and a software company may have different criteria.


Let me introduce a small example of a dynamic page implemented using HybridJava framework. The challenge is for other frameworks (JSF, Spring, etc.) to implement the same page AND demonstrate same convenience, conciseness and performance.   


In HybridJava adding components to a page or to another component is as simple as inserting tags and requires no programming or configuration. So in our example we create a simple component that has a Submit button and counts the number of times the button was pushed. The framework supports server-side event propagation trough the component tree. We insert 12 such components into the page (file :





            <table border="3" cellpadding="5"> 

                <ForI n=3>            


                        <ForJ n=4>







    </EventLog>  // renders events from inner components      



The screenshot of this page:



And here is the component which is a pair of markup + Java class:




       <widget name=Component>

    <div align="center"><HJRadio checked=${!flag} verb="toggle" value="off"/>

        <HJRadio checked=flag verb="toggle" value="on"/></div>




package com.HybridJava.Challenge;

import com.HybridServerPages.BaseComponent;

public class Component_WS extends BaseComponent {

int count;

boolean flag = false; // current state

private boolean prev_flag = false;

@Override protected void $handleComponent(String h1,String h2){

    String value = $getParam("toggle",flag ? "on" : "off");


         flag = true;


         flag = false;

    if(flag != prev_flag){

        $send(2,"Flag " + flag, null);      


    prev_flag = flag;








As a matter of fact – file Challenge.war is 34 kilobytes.

1 comment: