LING 408/508: Programming for Linguists Lecture 17 October 21 st.

Slides:



Advertisements
Similar presentations
JSP1 Java Server Pages (JSP) Introducing JavaServer Pages TM (JSP TM ) JSP scripting elements.
Advertisements

Java Servlet & JSP © copyright 2005 SNU OOPSLA Lab.
Chapter 31 Basic Form-Processing Techniques JavaServer Pages By Xue Bai.
JSP: JavaServer Pages Juan Cruz Kevin Hessels Ian Moon.
A simple PHP application We are going to develop a simple PHP application with a Web interface. The user enters two numbers and the application returns.
18-Jun-15 JSP Java Server Pages Reference: Tutorial/Servlet-Tutorial-JSP.html.
JSP Java Server Pages Reference:
Apache Tomcat Server – installation & use Server-side language-- use Java Server Pages Contrast Client-side languages HTML Forms Servers & Server-side.
PZ15A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ15A - The Internet Programming Language Design and.
Multiple Tiers in Action
Apache Tomcat Server Typical html Request/Response cycle
Dynamic content 1WUCM1. 2 Basic architecture of the web.
Java Server Pages Russell Beale. What are Java Server Pages? Separates content from presentation Good to use when lots of HTML to be presented to user,
Contrast with JavaScript HTML Formsto invoke Java Server Pages Structure of Forms Query strings Java Server Pages Sent From Browser To Serverfor JSP.
LING 408/508: Programming for Linguists Lecture 16 October 16 th.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
CSCI 6962: Server-side Design and Programming History and Background.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Java Server Programming Jeff Schmitt Towson University October 15, 1998.
Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
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.
1 ‘Dynamic’ Web Pages So far, we have developed ‘static’ web-pages, e.g., cv.html, repair.html and order.html. There is often a requirement to produce.
CS 1704 Introduction to Data Structures and Software Engineering.
JAVASCRIPT HOW TO PROGRAM -2 DR. JOHN P. ABRAHAM UTPA.
Chapter 9 Using Perl for CGI Programming. Computation is required to support sophisticated web applications Computation can be done by the server or the.
1 Homework / Exam Exam 3 –Solutions Posted –Questions? HW8 due next class Final Exam –See posted schedule Websites on UNIX systems Course Evaluations.
Java Server Pages CS-422. What are JSPs A logical evolution of java servlets –most servlets dynamically create HTML and integrate it with some computational.
Introduction to PHP and Server Side Technology. Slide 2 PHP History Created in 1995 PHP 5.0 is the current version It’s been around since 2004.
CP3024 Lecture 3 Server Side Facilities. Lecture contents  Server side includes  Common gateway interface (CGI)  PHP Hypertext Preprocessor (PHP) pages.
Web Servers Installation and Configuration May 24, 2001 CIS System Administration Problem Statement The class topic is setting up a Linux server to support.
Dynamic Web Sites Chris North cs3724: HCI. Presentations matt ketner, sam altman, mike gordon Vote: UI Hall of Fame/Shame?
Chapter 33 CGI Technology for Dynamic Web Documents There are two alternative forms of retrieving web documents. Instead of retrieving static HTML documents,
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
A little PHP. Enter the simple HTML code seen below.
Java Server Pages Lecture July Java Server Pages Java Server Pages (JSPs) provide a way to separate the generation of dynamic content (java)
 Embeds Java code  In HTML tags  When used well  Simple way to generate dynamic web-pages  When misused (complex embedded Java)  Terribly messy.
JAVA SERVER PAGES CREATING DYNAMIC WEB PAGES USING JAVA James Faeldon CS 119 Enterprise Systems Programming.
Fall CIS 764 Database Systems Design L8. Web ….
Website Development with PHP and MySQL Saving Data.
Introduction to JavaServer Pages. 2 JSP and Servlet Limitations of servlet  It’s inaccessible to non-programmers JSP is a complement to servlet  focuses.
DAT602 Database Application Development Lecture 16 Java Server Pages Part 2.
JSP Fundamentals Elements of a JSP Using Beans with JSP Integrating Servlets and JSP.
CS 4720 Dynamic Web Applications CS 4720 – Web & Mobile Systems.
1 Java Server Pages Allows the embedding of Java commands in a page of HTML. Popular for UI heavy solutions. These commands are then interpreted by a JSP.
Jsp (Java Server Page) Is a server side program.
Java server pages. A JSP file basically contains HTML, but with embedded JSP tags with snippets of Java code inside them. A JSP file basically contains.
Chapter 11 Invoking Java Code with JSP Scripting Elements.
LING 408/508: Programming for Linguists Lecture 17 October 28 th.
LING 408/508: Programming for Linguists Lecture 18 November 2 nd.
 Previous lessons have focused on client-side scripts  Programs embedded in the page’s HTML code  Can also execute scripts on the server  Server-side.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 1COMP9321, 15s2, Week.
CSI 3125, Preliminaries, page 1 JSP (Java Server Pages)
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
 Java Server Pages (JSP) By Offir Golan. What is JSP?  A technology that allows for the creation of dynamically generated web pages based on HTML, XML,
CS 330 Class 8 Homework A pattern that contains a word with an optional period A pattern that contains Fred with a space (not Freddy) See regexp.txt guest4.htm.
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.
Java Server Pages Yes it is Java. What you should know HTML Java.
1 The Internet Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
JSP Based on
Introduction to Dynamic Web Programming
JSP (Java Server Page) JSP is server side technology which is used to create dynamic web pages just like Servlet technology. This is mainly used for implementing.
Scripted Page Web App Development (Java Server Pages)
Server-Side Application and Data Management IT IS 3105 (Spring 2010)
Invoking Java Code from JSP
LING 408/508: Computational Techniques for Linguists
LING 408/508: Computational Techniques for Linguists
LING 408/508: Computational Techniques for Linguists
Presentation transcript:

LING 408/508: Programming for Linguists Lecture 17 October 21 st

Administrivia No class all next week

Last Time We enabled our first Web server: –sudo apachectl –k start Do we all have our webservers up and running?

Last Time Client: ~sandiway/Desktop/form.html Server: /Library/Webserver/CGI- Executables/program.cgi Content-type: text/plain $QUERY_STRING sudo chmod 755 program.cgi

Sending information: GET program.cgi: #!/bin/bash echo "Content-type: text/plain" echo #echo $QUERY_STRING origIFS=$IFS IFS='=&' set -- $QUERY_STRING IFS=$origIFS echo "1: 2: 3: 4: " In bash: IFS = internal field separator (for arguments) default: space newline tab set – String -- option: positional parameters are set after parsing String

Sending information: POST HTML form: First: Last: bash accesses the URL-encoded string on standard input via read

Sending information: POST bash accesses the URL-encoded string on standard input via read Example read.cgi: #!/bin/bash echo "Content-Type: text/plain" echo read input origIFS=$IFS IFS='=&' set -- $input IFS=$origIFS echo " "

Other webservers Perl module PHP module Tomcat (Java)

mod_perl Apache webserver module with Perl – not enabled by default /etc/apache2/httpd.conf (on OSX) #LoadModule perl_module libexec/apache2/mod_perl.so Add to httpd.conf: – PerlModule Apache2::Status – – SetHandler perl-script – PerlHandler Apache2::Status –

mod_perl

Registry Scripts Add to httpd.conf: SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI Order allow,deny Allow from all

Registry Scripts perl/test.pl(/Library/WebServer/Documents/) #!/usr/bin/perl print "Content-type: text/plain\n\n"; print "Test Perl program works!\n"; URL:

Other webservers Perl module PHP module Tomcat (Java)

Tomcat JSP = JavaServer Pages (HTML with embedded Java code) Apache Tomcat: a JSP webserver from Apache – (8.0) Install: – /usr/local/apache-tomcat / Subdirectories: – webapps/(put app.war files here – like a bundle) – webapps/ROOT/(.jsp.html files can go directly here too) – logs/catalina.out(log output from java, – e.g. print statements) – lib/(common.class files can go here) – bin/startup.sh(start webserver) – bin/shutdown.sh(stop webserver)

class files Class Loader HOW-TO – common unpacked classes and resources in $CATALINA_BASE/lib – loader-howto.html

mixing Java and html Tags: – Scriptlets: – Java code – evaluate expression – declarations – include directive – page directive, e.g. import="java.util.*" Predefined variables: – out.println() – request.getRemoteHost() – response.sendRedirect()

forms and sessions Webpage (client side): process.jsp (server side): <% String name = request.getParameter( "username" ); session.setAttribute( "yourName", name ); %> Some other.jsp file (server side):

beans class with methods for setting and getting field names of forms Form field: Define a class with standardized naming: public class UserData { String username; public void setUsername( String value ) { username = value; } public String getUsername() { return username; } } Storage: Retrieval:

Example Stanford Parser:

Homework 5 Use cgi-bin to implement your BMI shell script Use both GET and POST methods Send me your code next week Hard to evaluate: – Demonstrate in it class