Integrating Javascript and JBoss Seam

seedjaggedInternet και Εφαρμογές Web

12 Νοε 2013 (πριν από 3 χρόνια και 11 μήνες)

96 εμφανίσεις

Integrating Javascript & JBoss Seam
1
1
Integrating Javascript
and JBoss Seam
Mike Burton
www.mycosystems.co.uk
mb@myco.ws
2
Integrating Javascript & JBoss Seam
Outline

Introduction

The requirement

The technologies

Javascript facilities

Detect screen width

Force a page-refresh

Richfaces mechanisms

Pass js object to a server method

Server method invokes some js code
3
Integrating Javascript & JBoss Seam
The Technologies

JBoss Seam

Web framework based on JSF

Facelets

View technology for JSF, replaces JSP

Richfaces

Ajax component library for JSF

From JBoss. Was Exadel Ajax4Jsf (“a4j”)

Javascript

But using a4j as gloves!
4
Integrating Javascript & JBoss Seam
Javascript Facilities

Detect screen settings

screen.width

Force browser to refresh page

window.location.reload()
5
Integrating Javascript & JBoss Seam
Richfaces Mechanisms

Pass Javascript object to server

<a:jsFunction>

name= “storeWidth”

- Now js can call:
storeWidth(x)

<a:actionParam assignTo=”#{bean.scrWid}”

- js fn call causes
Bean.setScrWid(x)


to be called on the server
6
Integrating Javascript & JBoss Seam
Richfaces Mechanisms

Allow server to invoke some js code

<a:poll>

onsubmit= window.location.reload()

( or any other js, to execute every <interval> )

enabled= “#{bean.resChanged}”

Will only “poll” if this expression evaluates as true!

interval= (millis)

How often to “poll”

(
reRender= <component id>
)

Could use this to redisplay some data every n millis if
changed
7
Integrating Javascript & JBoss Seam
Demo

Demo

Pass
screen.width
into
Visit.screenWidth

Cause browser to refresh when ^ changes

- but only once (one-shot)

Questions?
8
Integrating Javascript & JBoss Seam
References

Richfaces download, documentation, ...

www.jboss.org/jbossrichfaces

JBoss Seam:

www.jboss.com/products/seam/

seamframework.org

More info

e: mb@myco.ws