672329 members! Sign up to stay informed.

Sponsored Links


Resources

Enterprise Java
Research Library

Get Java white papers, product information, case studies and webcasts

News News News Messages: 12 Messages: 12 Messages: 12 Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML

Beyond the Java Server Pages

Posted by: Alex Serov on June 10, 2009 DIGG
HJ incorporates Java and HTML operators into a single formal grammar. We may consider the language as consisting of three parts – subset of Java, subset of HTML and all the rest. The latter serves for code factorization and reuse as well as for ‘gluing’ Java and HTML. Widgets are the units of code reuse.

The HJ code of an application is provided as a set of .page files (one per Web page) and a set of .widget files. A widget may define named attributes and/or named slots (or one anonymous slot). A slot is somewhat similar to the position between opening and closing a ‘library tag’. The code in HJ slots has Java context of the point of call of the widget, so widgets are transparent for Java context (same as HTML elements are by the way).

The rest of the .widget file is just ARBITRARY HJ code – no other programming support or configuration is necessary to define a widget.

Technology suggests a very natural framework that includes application, page and widget data persistent in the scope of HTTP session. Developer defines such data as members of ‘code-behind’ classes, which may contain handlers of those states called by the framework with a proper dispatching in case of widgets.

Compiler resolves the identifiers used in widgets and pages against Java definitions in Java blocks, definitions of widget attributes, in instances of widgets and page state classes. Widgets may send signals to parent and page.

FREE FOR NON-COMMERCIAL USE

Home: http://www.hybridserverpages.com/
Detailed Language Definition (informal):
http://www.hybridserverpages.com/HybridJava.doc
Running Sample Application:
http://hybridjava.com:8080/HJ_Sample
Download:
http://www.HybridServerPages.com/HybridJava_v0.94.zip

The aim was to develop something more-more convenient than ... you name it.

Please tell what you think, report bugs and advice missing features. It is just a beta. No question - ASK QUESTIONS!

Threaded replies

·  Beyond the Java Server Pages by Alex Serov on Wed Jun 10 07:25:09 EDT 2009
  ·  Re: Beyond the Java Server Pages by Olivier Croisier on Wed Jun 10 09:37:20 EDT 2009
    ·  Comparing with Wicket by Alex Serov on Sun Jul 26 01:49:20 EDT 2009
      ·  Re: Comparing with Wicket by Jonathan Locke on Sun Aug 02 13:29:11 EDT 2009
        ·  HybridJava versus Wicket by Alex Serov on Sat Aug 29 16:57:38 EDT 2009
  ·  Re: Beyond the Java Server Pages by Dushyanth Inguva on Wed Jun 10 10:18:48 EDT 2009
    ·  Re: Beyond the Java Server Pages by augustientje bloem on Wed Jun 10 14:56:00 EDT 2009
    ·  HJ by Alex Serov on Wed Aug 05 03:02:23 EDT 2009
  ·  Re: Beyond the Java Server Pages by jelmer kuperus on Thu Jun 11 02:11:59 EDT 2009
  ·  HybridJava version 0.96 available by Alex Serov on Sun Sep 13 17:26:08 EDT 2009
    ·  HybridJava version 0.97 released by Alex Serov on Mon Nov 30 15:40:48 EST 2009
      ·  HybridJava version 0.98 released by Alex Serov on Sat Dec 19 02:43:55 EST 2009
  ·  Principles of HybridJava Framework Component Model by Alex Serov on Tue Jan 26 03:22:30 EST 2010
  Message #309842 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Beyond the Java Server Pages

Posted by: Olivier Croisier on June 10, 2009 in response to Message #309786
I've read the (short) documentation, but I still fail to see how this framework could be better than, say, Wicket, with regards to ease of use, HTML/Java separation, or reusability/componentization.
Not to mention that it's not even free/opensource.

Did I miss some kind of secret feature that would make me think otherwise ?

  Message #309845 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Beyond the Java Server Pages

Posted by: Dushyanth Inguva on June 10, 2009 in response to Message #309786
He he. You said HJ

  Message #309858 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Beyond the Java Server Pages

Posted by: augustientje bloem on June 10, 2009 in response to Message #309845
He he. You said HJ


Well, doesn't this technology relieves us from the Hand Job of crafting our JSP pages manually? *lol*

  Message #309860 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Beyond the Java Server Pages

Posted by: jelmer kuperus on June 11, 2009 in response to Message #309786
i used hybrid server pages with the jt framework

great succes!

  Message #312463 Post reply Post reply Post reply Go to top Go to top Go to top

Comparing with Wicket

Posted by: Alex Serov on July 26, 2009 in response to Message #309842
Hi Olivier!

Thank you for reading "short documentation". That is ALL the documentation HybridJava has and needs, so thank you for this compliment.

I agree that you missed something.

You suggest that the problem is in "HTML/Java separation" while we think that JSP was invented for combining HTML and Java in one source.

Next you missed that the problem is in generation of dynamic content. Which is not only about filling well known positions in a form with varying data but also about varying structure of page.

HybridJava cares about IDs of components even under loops and recursions. What I saw so far in Wicket is all around manual assigning IDs.

Did I miss something?

  Message #313158 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Comparing with Wicket

Posted by: Jonathan Locke on August 02, 2009 in response to Message #312463
Yes. But you would have to be looking to find it.

  Message #313427 Post reply Post reply Post reply Go to top Go to top Go to top

HJ

Posted by: Alex Serov on August 05, 2009 in response to Message #309845
When I submitted the article I defined HJ as HybridJava in the summary. I did not see that summary any more. Sorry for inconvenience.

  Message #320116 Post reply Post reply Post reply Go to top Go to top Go to top

HybridJava versus Wicket

Posted by: Alex Serov on August 29, 2009 in response to Message #313158
Hi!

Suggesting that the problem to be solved is in "HTML/Java separation" is a fundamental (though common) misunderstanding. The promise of initial JSP was about interlaying (which means combining, not separating) HTML markup and Java within the presentation layer code. Respecting the boundary between the Presentation Layer and the Business Layer is a must, but note that the former has logic of its own too. The JSP way of doing things is in using Java to code presentation logic.

To understand Wicket, I got the book “Pro Wicket” by Karthik Gurumurthy. What does this specific technology provide to express the component structure of the application? The book tells “You can liken Wicket development to Swing development” and also “the component hierarchy is specified explicitly through Java code” (p 9). In other words it is done the way it was some 15 years ago with Visual Basic and all the rest desktop UI development tools. There is nothing bad in such an approach, but alas, that is a pre-HTML presentation technology. Technically it is about manually coding endless “new” and “add” operations.

Reading further one finds out that the “component hierarchy” (structure) is simultaneously depicted in a form of markup. This duplication of information is a step back even compared to the Visual Basic. See Listings 4.19 to 4.22 pages 129-130 – MyBorder is the most compact example I found. If you code the same example in HybridJava all will look indeed very similar … except that there will be NO listings 4.20 and 4.22 at all. Actually HybridJava has a similar example running over here:
http://HybridJava.com:8080/HJ_Sample/?HJ_page=com.HybridJava.Sample.NiceFrame

By the way, what is the need for MyBorder to be a component if it does have neither state nor beheavior? A simple answer is that the Wicket framework has nothing of lighter weight than a component. HybridJava has.

HybridJava approach is that presentation components (in that they have place in the hierarchy) are nothing different from HTML elements and thus markup is sufficient. A clever enough framework may (and HybridJava does) figure out all the rest behind the scenes. In particular HybridJava framework performs all necessary “new” and “add” operations and assigns dynamic IDs.

More on IDs: page 216 states “This feature demonstrates Wicket’s excellent support for dynamic templates.” Actually, they probably meant to say that Tabbed Panel example (NOT a feature!) demonstrates something. What it demonstrates in reality is that the Wicket framework has completely failed to solve the dynamic IDs puzzle. This specific example works, but only because in the book’s own words “At any given point in time, only one Panel can be active or visible”. HybridJava has solved the dynamic IDs puzzle.

Another thing that the book shadows is the Wicket solution for loops. In the Wicket framework even a plain loop is a component, so the “Wicket way” of coding repetitions in presentation layer is (in ADDITION to markup!) something like:
Loop loop = new Loop( new LoopItem( …
// Lisp is immortal !!!

HybridJava is not that “revolutionary” and sticks to using traditional Java “while” keyword.

So what is the bottom line? Compare two things:
1) A compiler from some programming language
2) A printed instruction on how to manually “compile” from a similar language.
That is exactly how HybridJava compares to Wicket.

PS. HybridJava version 0.95 is available.

Examples from the “Pro Wicket” Book:

// 4.19
<wicket:border>
<table width = "0%" border = "1" cellspacing = "0"
cellpadding = "1" bgcolor = "yellow">
<tr>
<td width = "100%" valign = "top">
<wicket:body/>
</td>
</tr>
</table>
</wicket:border>

// 4.20
package com.apress.wicketbook.layout;
import wicket.markup.html.border.Border;
public class MyBorder extends Border {
public MyBorder(String id) {
super(id);
}
}

// 4.21
<html>
<body>
<span wicket:id="myborder">
<span wicket:id="label">Label content goes here</span>
</span>
Back to Index
</body>
</html>

// 4.22
package com.apress.wicketbook.layout;
import wicket.markup.html.WebPage;
import wicket.markup.html.basic.Label;
import wicket.markup.html.border.Border;
import wicket.model.Model;
public class MyPage extends WebPage {
public MyPage() {
Border border = new MyBorder("myborder");
add(border);
border.add(new Label("label",
new Model(" Wicket Rocks 8-) ")));
}
}

  Message #321773 Post reply Post reply Post reply Go to top Go to top Go to top

HybridJava version 0.96 available

Posted by: Alex Serov on September 13, 2009 in response to Message #309786
http://www.HybridServerPages.com/HybridJava_v0.96.zip

  Message #329753 Post reply Post reply Post reply Go to top Go to top Go to top

HybridJava version 0.97 released

Posted by: Alex Serov on November 30, 2009 in response to Message #321773
http://www.hybridserverpages.com/HybridJava_v0.97.zip

  Message #330735 Post reply Post reply Post reply Go to top Go to top Go to top

HybridJava version 0.98 released

Posted by: Alex Serov on December 19, 2009 in response to Message #329753
This version supports multilingual web development

http://www.hybridserverpages.comHybridJava_v0.98.zip

  Message #331782 Post reply Post reply Post reply Go to top Go to top Go to top

Principles of HybridJava Framework Component Model

Posted by: Alex Serov on January 26, 2010 in response to Message #309786
1. The MVC paradigm

Web application components are reusable presentation layer modules that follow the MVC paradigm. So, each component may have its own View, Controller, and may be connected to a relevant part of the Model.

2. The One Touch principle

Using a component to build a page or another component must be as simple as using an HTML tag, and must not require any programming or configuration.

3. Independence

A page (or a containing component) doesn’t need to know anything about the contained component, and vice versa.

4. Session Scope Persistence

The framework has to keep the state of each component until the session expires. This behavior should not depend on the current page shown or on component’s actual visibility on its page.

5. In-page Reusability

A component may be used in a page (or containing component) more than once. For each use the framework must support an independent state.

6. Inter-page Sharing

A component may be declared as shared between several pages. Then, only one instance should be created by the framework for all the Views of that component.

7. Dispatching of Information

Framework should pass information about user actions (in particular about submit) to appropriate component instances. This should not require any additional programming, configuration or assigning of IDs to the components.

8. Inter-Component Communication

At the View phase a component/page should be able to pass information to contained components via widget parameters. At the Controller phase the framework API should support communication between a component and containing component/page.

QUESTION to the READERS: What is a meaning of the word "component" as it used in the context of JSF, Wicket, Struts and other frameworks. In which of those frameworks the component model is in fact a model of MVC components?

New content on TheServerSide.comNew content on TheServerSide.comNew content on TheServerSide.com

Dependency Injection in Java EE 6 - Part 2

Reza Rahman continues to explore the features of the proposed JSR 299, Contexts and Dependency Injection for Java EE (CDI). When approved, it promises to be a key feature of Java EE 6. (January 21, Article)

Ted Neward Q&A: What you must know about JavaScript, Scala and more

Ted Neward is an independent consultant specializing in high-scale enterprise systems, and an authority in Java and .NET technologies. He is the author and co-author of several books, including Effective Enterprise Java. At TheServerSide Java Symposium in March, he will be presenting sessions on pragmatic architecture, ECMAScript and Scala. (January 15, Article)

Developers split on open sourcing Java

Now that Oracle is absorbing Sun Microsystems, there mixed views on what should come of the Java Community Process (JCP). While some say Oracle should become the new steward of Java and keep the JCP much as it was, others argue that it may be time to open-source this widespread language. (November 24, Article)

Dependency Injection in Java EE 6 - Part 1

Reza Rahman explores the features of the proposed JSR 299, Contexts and Dependency Injection for Java EE (CDI). When approved, it promises to be a key feature of Java EE 6. (November 2, Article)

SAML: It's Not just for Web services

SAML is an XML-based standard for exchanging authentication and authorization data between security domains. The single most important problem that SAML was created to solve is the Web browser Single Sign-On problem. Many organizations are debating whether to stay with version 1.1 or move to 2.0. This article makes observations about both options. (September 28, Article)

Programming is Also Teaching Your Team

Joe Ottinger takes a look at how people learn, and applies it to the practice of programming. He notes that understanding how people learn is an essential part of working in a programming team. (September 22, Article)

Can Java EE Deliver The Asynchronous Web?

Stephen Maryka gave us an article about the Asynchronous Web and posed a number of questions that get examined like an approach to delivering Asynchronous Web capabilities through extensions to existing Java EE technologies. (July 14, Article)

JSF Flex

JavaServer Faces Flex goal is to provide users capability in creating standard Flex components, part of flexSDK which is open sourced through MPL license, as normal JSF components. This article by Ji Hoon Kim will provide an overview of creating a simple multilingual JSF page consisting of JSF Flex tags. (June 29, Article)

The Rules of SOA - A Road to a Successful SOA Implementation

In this session Jeff explores the key characteristics of successful SOA projects. He covers some of the patterns, and anti-patterns, tool sets, and strategies that he himself learned the hard way. Last, he provides a strategy and blueprint for achieving a high likelihood of success in your SOA project. (June 23, Tech Talk)

Ari Zilka Talks About Terracotta 3.1

Ari Zilka, CTO of Terracotta, Inc., talks about the new features in Terracotta 3.1, announced during JavaOne and available now. (June 15, Tech Talk)

Enterprise Application Integration, and Spring

In this Tech Talk, Josh Long explores an integration challenge using Spring Integration and walks through the implementation, employing and expanding on the basic patterns of Enterprise Application Integration to tie together components into a function integration solution, and then demonstrates how Spring Integration helps address the integration requirements. (June 15, Tech Talk)

Google Web Toolkit: An Introduction

In this Tech Talk, David Geary teaches you: The basics of Google Web Toolkit; How to implement Ajax-enabled applications in Java; Internationalization; Hooking into the browser history mechanism; Remote procedure calls. (June 4, Tech Talk)

Just Enough Early Architecture to Guide Development

Jon Kern discusses the best architecture/technical solutions and ensure that they are repeated by all developers. By tackling the architecture up-front in a serial manner, subsequent parallel development will be much more manageable and predictable. (May 28, Tech Talk)

Productive Programmer: On the Lam from the Furniture Police

This keynote describes the frustrations of modern knowledge workers in their quest to actually get some work done, and solutions for how to guard yourself against all those distractions. Neal Ford talks about environments, coding, acceleration, automation, and avoiding repetition as ways to defeat the misguided attempts to sap your ability to produce good work. (May 26, Tech Talk)

Auto-Scaling Your Existing Web Application

Gil demonstrates how new, aggressive uses of already abundant compute capacity by common applications offer competitive value for application designers. (May 21, Tech Talk)

Automating Hibernate Mapping and Queries For Java Web Development

Chris Keene introduces WaveMaker as a new way to automate the ability to generate Hibernate classes in order to more quickly bring OR mapping into an application. (May 19, Article)

Free Book: Jakarta-Struts Live

Download the entire book of Jakarta-Struts Live and learn about Struts MVC, Tiles, the Validator, DynaActionForms, plug-ins, internationalization, and more.
(Book PDF Download)

Application Server Matrix

The Application Server Matrix is a detailed listing of J2EE vendors and their application server products, with information on latest version numbers, J2EE spec support and licensing, pricing, platform support, and links to product downloads and reviews.
(Application Server Comparison Matrix)

News | Blogs | Discussions | Tech talks | Patterns | Reviews | White Papers | Downloads | Articles | Media kit | About
Java Solutions
All Content Copyright ©2007 TheServerSide Privacy Policy
Site Map