Bean Scripting Framework.. What is Scripting Language Broader definition: all languages Narrower definition: those programming languages requiring no.

Slides:



Advertisements
Similar presentations
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 2 Getting Started with Java.
Advertisements

J0 1 Marco Ronchetti - Web architectures – Laurea Specialistica in Informatica – Università di Trento Java XML parsing.
JSP and Servelets.
Java GUI building with the AWT. AWT (Abstract Window Toolkit) Present in all Java implementations Described in (almost) every Java textbook Adequate for.
Servlets, JSP and JavaBeans Joshua Scotton.  Getting Started  Servlets  JSP  JavaBeans  MVC  Conclusion.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 2: IT Students.
Java Server Pages (JSP)
Java Server Pages Jeffrey Jongko. Introduction Java Server Pages (JSP) technology was created by Sun Microsystems and is built on top of Sun’s Java Servlet.
J2EE training: 1 Course Material Usage Rules PowerPoint slides for use only in full-semester, for-credit courses at degree-granting.
Chapter 51 Scripting With JSP Elements JavaServer Pages By Xue Bai.
Implementing Remote Procedure Calls Andrew Birrell and Bruce Nelson Presented by Kai Cong.
JSP: JavaServer Pages Juan Cruz Kevin Hessels Ian Moon.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
18-Jun-15 JSP Java Server Pages Reference: Tutorial/Servlet-Tutorial-JSP.html.
Apache Tomcat Server Typical html Request/Response cycle
Scripting Languages CS 351 – Programming Paradigms.
1 Java Server Pages Can web pages be created specially for each user? What part does Java play?
Chapter 6 DOJO TOOLKITS. Objectives Discuss XML DOM Discuss JSON Discuss Ajax Response in XML, HTML, JSON, and Other Data Type.
Java Server Pages (JSP) Presented by: Ananth Prasad & Alex Ivanov May 10, 2001.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Server Side Scripting Norman White. Where do we do processing? Client side – Javascript (embed code in html) – Java applets (send java program to run.
+ Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming.
4.1 JavaScript Introduction
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
M1G Introduction to Programming 2 4. Enhancing a class:Room.
A Simplified Approach to Web Service Development Peter Kelly Paul Coddington Andrew Wendelborn.
JSP Java Server Pages Softsmith Infotech.
Ruby! Useful as a scripting language – script: A small program meant for one time use – Targeted towards small to medium size projects Use by: – Amazon,
Java Server Pages Lecture July Java Server Pages Java Server Pages (JSPs) provide a way to separate the generation of dynamic content (java)
Chapter 8 Script-free pages. Problem with scripting in JSP When you use scripting (declaration, scriplet, expressions) in your JSP, you actually put Java.
1 HKU CSIS DB Seminar: HKU CSIS DB Seminar: Web Services Oriented Data Processing and Integration Speaker: Eric Lo.
JAVA SERVER PAGES. 2 SERVLETS The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
How Java becomes agile riding Rhino Xavier Casellato VP of engineering, Liligo.com.
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
Introduction to ASP.NET1. 2 Web applications in general Web applications are divided into two parts –The server part –The client part The server part.
Introduction to Client Side Scripting CS Client Side Scripting Client side means the Browser is interpreting the script Script is downloaded with.
JSP Fundamentals Elements of a JSP Using Beans with JSP Integrating Servlets and JSP.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
JavaScript Syntax, how to use it in a HTML document
Ruby on Java Luc Castera
Active Server Pages Server-Side Scripting and Client-Side Scripting.
JDBC - Connection The programming involved to establish a JDBC connection is fairly simple. Here are these simple four steps − Import JDBC Packages: Add.
CITA 310 Section 7 Installing and Testing a Programming Environment (Textbook Chapter 7)
Middleware 3/29/2001 Kang, Seungwoo Lee, Jinwon. Description of Topics 1. CGI, Servlets, JSPs 2. Sessions/Cookies 3. Database Connection(JDBC, Connection.
IMRAN DAUD FOUNDATION UNIVERSITY RAWALPINDI CAMPUS Imran Daud FURC Web Engineering Introduction.
Plug-in Architectures Presented by Truc Nguyen. What’s a plug-in? “a type of program that tightly integrates with a larger application to add a special.
Applets Java code is compiled into byte code instead of machine language –Languages like C, C++, Pascal and others are compiled into machine language so.
Introduction to JavaScript Fort Collins, CO Copyright © XTR Systems, LLC Introduction to JavaScript Programming Instructor: Joseph DiVerdi, Ph.D., MBA.
CSI 3125, Preliminaries, page 1 JSP (Java Server Pages)
Rich Internet Applications 2. Core JavaScript. The importance of JavaScript Many choices open to the developer for server-side Can choose server technology.
JAVA SERVER PAGES -by Rubeena Memon Deepti Jain Jaya Thakar Jisha Vettuventra.
Java Server Pages. 2 Servlets The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
Bayu Priyambadha, S.Kom. Static content  Web Server delivers contents of a file (html) 1. Browser sends request to Web Server 3. Web Server sends HTML.
Plug-In Architecture Pattern. Problem The functionality of a system needs to be extended after the software is shipped The set of possible post-shipment.
World Wide Web has been created to share the text document across the world. In static web pages the requesting user has no ability to interact with the.
Struts 2 Development. Topics  Roles in Struts Development  Control Flow  Actions  Struts 2 Views and Target  Struts 2 Custom Tags  Validation 
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Java Server Pages Can web pages be created specially for each user?
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
A Java Program: // Fig. 2.1: Welcome1.java // Text-printing program.
Java Primer 1: Types, Classes and Operators
Artūras Šlajus VS through eyes of Ruby programmer.
PHP / MySQL Introduction
JavaScript.
Java Server Pages (JSP)
Unit 6 part 3 Test Javascript Test.
Tutorial 10: Programming with javascript
Scripted Page Web Application Development (Java Server Pages)
Web Application Development Using PHP
Plug-In Architecture Pattern
Presentation transcript:

Bean Scripting Framework.

What is Scripting Language Broader definition: all languages Narrower definition: those programming languages requiring no compilation or with implicit compilation

For example: JavaScript source:

Why Scripting Languages? simplicity real time most scripting languages have good UI integration plenty of choices

Where to Use Scripting Languages? integrated with UI languages, e.x., html vs. JavaScript event-based scenarios, e.x., XSLT vs. xpath programming with less ability but more simplicity, e.x., JSP

Drawbacks Performance!!

Java + Scripting Language Background Java performs better, but more complicated in syntax and requires compilation Scripting languages (e.x., JavaScript) are much slower (almost 1000x), but much easier in syntax and requires no compilation

Java + Scripting language is a good compromise use java in major part use scripting language for some customizable parts but how?

JVM byte code script Scripting Engine load scripting engine with JVM, and pass scripting parts into the scripting engine. However, different scripting engines have different interfaces……

Bean Scripting Framework Actually, there is a plan to add common scripting interface into JVM with JavaSE 7.0 but when can we have JavaSE 7.0 ?! Now, we have apache bean scripting framework

BSFManager BSFEngine JRubyEngineJavaScriptEnginePythonEngine ……

Usage Register script engine to BSFManager BSFManager.registerScriptingEngine("ruby", "org.jruby.javasupport.bsf.JRubyEngine", new String[]{"rb"}); Create an instance of BSFManager BSFManager manager=new BSFManager(); Load registered script engine from the manager engine=manager.loadScriptingEngine("ruby");

Execute the scripting code, so it is kept in the memory engine.exec("ruby", 0, 0, ……script code……); Call target method declared in the scripting code engine.call(null, "actionPerformed", new java.lang.Object[]{self, arg0});

This is Ruby!!

Why use Ruby? Simple yet powerful exactly the same expressive power with java good bridging with jvm

Language Constructs require 'java' module Java include_package "java.lang" include_package "javax.swing" include_package "util.ws" include_package "java.util" end def actionPerformed(caller, actionEvent) if actionEvent.getActionCommand()=="HelloWorld" Java::JOptionPane.showMessageDialog(caller, "HelloWorld") elsif actionEvent.getActionCommand()=="HelloWS" response=Java::WebServiceClient.send(" " ") Java::JOptionPane.showMessageDialog(caller, response) elsif actionEvent.getActionCommand()=="HelloSoapHeaders" props=Java::HashMap.new props.put("{ns1}key1","value1") props.put("{ns2}key2",['_value1','_value2','_value3'].to_java) response=Java::WebServiceClient.send(" " ", props) Java::JOptionPane.showMessageDialog(caller, response) end load java support import java.lang.*; import javax.swing.*; import util.ws.*; import java.util.*; define function

require 'java' module Java include_package "java.lang" include_package "javax.swing" include_package "util.ws" include_package "java.util" end def actionPerformed(caller, actionEvent) if actionEvent.getActionCommand()=="HelloWorld" Java::JOptionPane.showMessageDialog(caller, "HelloWorld") elsif actionEvent.getActionCommand()=="HelloWS" response=Java::WebServiceClient.send(" " ") Java::JOptionPane.showMessageDialog(caller, response) elsif actionEvent.getActionCommand()=="HelloSoapHeaders" props=Java::HashMap.new props.put("{ns1}key1","value1") props.put("{ns2}key2",['_value1','_value2','_value3'].to_java) response=Java::WebServiceClient.send(" " ", props) Java::JOptionPane.showMessageDialog(caller, response) end load java support import java.lang.*; import javax.swing.*; import util.ws.*; import java.util.*; define function