100 likes | 204 Views
Richard Schmidt hangstrap @ gmail . Com Metservice. Service Side Ajax. Our Situation / Requirement. Rich(ish) Application. Easy to deploy / standard browser. Not many users. Max 50 sessions Very little concurrency Hardware costs are not important. Main cost is developer salaries.
E N D
Richard Schmidt hangstrap @ gmail . Com Metservice Service Side Ajax
Our Situation / Requirement • Rich(ish) Application. • Easy to deploy / standard browser. • Not many users. • Max 50 sessions • Very little concurrency • Hardware costs are not important. • Main cost is developer salaries.
Some Web Frameworks • JSF (yea right!) • Ajax? • Tapestry, Wicket • Component based. • Flex • Another language • GWT • Scaled down Java • Java client (applet / web start) • Will the client have JAVA installed? • Something else?
Server Side Ajax • Server downloads a javascript app. to browser. • Server then sends list of components that javascript app. renders in the browser. • User events are sent back to server using Ajax. • Server processes events and then send changes to components back to client...
Advantages • Only one language • Can use full features of Java • not like GWT • No writing of HTML or Javascript! • Write using components that fire events. • Swing like. • KISS: One less physical layer • All code runs on one VM, easier to debug, test etc.
Disadvantages • Each user has a large session variable. • Not going to work for Google! • More network traffic to / from server. • (but not much more!) • Not mainstream technology. • 'Stuck' with the basic components supplied by the framework. • Set of components – still have to write a application framework! • Different browsers.
Players • Thinwire • Stable, not much development. • Echo2/3 • Well known. • Wing-S • Based on Swing components. • J-Seamless • Uses Flex as a renderer. • ULC Canoo • Commercial, Java proxy on client • Test framework, visual editor, support, rich functionality.
Code Example public static void main(String[] args) { //Create and set initial position for components final Dialog dialog = new Dialog("Hello World, ThinWire Style!"); Label label = new Label("Hello, what is your name?"); final TextField input = new TextField(); Button button = new Button("Ok"); //When button is clicked, close modal dialog and say hello button.addActionListener("click", new ActionListener() { public void actionPerformed(ActionEvent ev) { MessageBox.confirm("Hello " + input.getText() + "!"); dialog.setVisible(false); } }); //Add components to dialog dialog.getChildren().add(label); dialog.getChildren().add(input); dialog.getChildren().add(button); //Show dialog and wait for "OK" press dialog.setVisible(true); }
ATestBean bean = new ATestBean(); Property<ATestBean, Boolean> pt1Client = BeanProperty.create("enabled"); TextField tf = new TextField(); Property<TextField, Boolean> tfProp = BeanProperty.create("enabled"); Binding<ATestBean, Boolean, TextField, Boolean> binding = Bindings.createAutoBinding(UpdateStrategy.READ_WRITE, bean, pt1Client, tf, tfProp); binding.bind(); Using Beans Binding
Demos • Echo2 • Wing-S • Canoo ULC • Our App