Cse 190 internet e commerce
Download
1 / 15

CSE 190: Internet E-Commerce - PowerPoint PPT Presentation


  • 233 Views
  • Updated On :

CSE 190: Internet E-Commerce. Lecture 9: Application Tier Programming. App Tier Languages. Language paradigms, declarations, control flow, domain objects JSP -> Java ASP -> VB, C++ PHP -> PHP, Java, COM. JSP. Java paradigms

Related searches for CSE 190: Internet E-Commerce

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'CSE 190: Internet E-Commerce' - medwin


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Cse 190 internet e commerce l.jpg

CSE 190: Internet E-Commerce

Lecture 9: Application Tier Programming


App tier languages l.jpg
App Tier Languages

  • Language paradigms, declarations, control flow, domain objects

    • JSP -> Java

    • ASP -> VB, C++

    • PHP -> PHP, Java, COM


Slide3 l.jpg
JSP

  • Java paradigms

    • All functionality encapsulated in objects; functionality provided through methodspublic Classname { instance-variables-block; Type functionOne() { …. } Type2 functionTwo() { …. }}

    • Static typing

    • Garbage collection

    • Language reference: Java in a Nutshell, http://java.sun.com

    • Namespaces: major components located in hierarchical namespaces (e.g. com.sun.net.*)

    • Methods accessible outside of the class must be prefixed with ‘public’ token

    • Essentially C-like syntax (including // and /* … */ comments )

  • Variables

    • TypevariableName [= initial-value];

      • E.g. String auctionTitle = “BMW motorcycle”;

    • Array syntax: variableName[ index ]

    • Overloaded “+” for string concatenation

      • “one “+”two” == “onetwo”

    • Visibility: variables within methods visible until end of method

    • Visibility: variables within class are visible to all methods of class

    • Lifetime: intrinsic variables (e.g. int, float) have auto scope

    • Within page declaration: <jsp:useBean id=“variableName” class=“ClassName” scope=“[request | session | application | page]”>

    • Property initialization: <jsp:setProperty name=“variableName” property=“[propertyName | *”>


Jsp control flow l.jpg
JSP Control flow

  • Sequence

    • statement1;statement2;

    • All statements terminated by semicolon

  • Selection

    • if( boolean-value ) block

      • block ::= statement or { block }

    • switch( integral-type ) {case integral-value1: statement-list; break;default: statement-list; break;}


Jsp control flow5 l.jpg
JSP Control Flow

  • Iteration

    • for( int i = 0; i < 10; i ++ ) block;

    • while( boolean-condition ) block;

    • do { statement-list; } while( condition );

  • No goto

  • Method invocation

    • object.actOnArguments( arg1, arg2, arg3 );

  • Multithreading explicit

    • Use synchronized( variable ) to avoid raceconditions; may ignore this issue for DB calls


Jsp types l.jpg
JSP Types

  • Intrinsics

    • int, float, boolean, char, String

      • String is an intrinsic object, with methods length(), etc.

  • User defined types are always classes

  • No enum, structs, typedefs


Jsp domain objects l.jpg
JSP domain objects

  • Request

    • getParameter(), getCookies()

  • Response

    • addCookie(), encodeURL(), setStatus(), sendError()

  • Out

    • print, println

  • Session

    • getId(), getAttribute(), invalidate(), setAttribute(), removeAttribute()

  • in

  • pageContext

  • config

  • exception

  • Overview: http://jakarta.apache.org/tomcat/tomcat-4.0-doc/servletapi/overview-summary.html


Jsp review l.jpg
JSP Review

  • How would I create a class accessible to my JSP page that would provide access to a list of Auction objects, each with a small set of attributes?


Jsp review9 l.jpg
JSP Review

import java.util.*;

public class Auctions {

Vector _auctions;

public Auctions() {

reset();

}

public int getNumAuctions() {

return _auctions.size();

}

public Auction getAuction( int num ) {

return (Auction) _auctions.elementAt( num );

}

public void reset() {

_auctions.clear();

Auction auction = new Auction();

auction.setTitle( "BMW motorcycle" );

auction.setDescription( "Never used. Motivated seller moving to "+

"new location. Cash only." );

auction.setHighBidder( "southcorner17" );

_auctions.add( auction );


Jsp review10 l.jpg
JSP Review

auction = new Auction();

auction.setTitle( "LOTR hobbit doll!!" );

auction.setDescription( "Limited edition cloth doll showing all "+

"Frodo's features, including leaf clasp." );

auction.setHighBidder( "(none)" );

_auctions.add( auction );

auction = new Auction();

auction.setTitle( "Automatic labeler" );

auction.setDescription( "The Brother X7 creates labels on demand "+

"through a simple keyboard. No waiting"+

" for the computer to boot up!" );

auction.setHighBidder( "compulsive_collector" );

_auctions.add( auction );

}

}


Jsp review11 l.jpg
JSP Review

public class Auction {

Properties _properties;

public Auction() {

_properties = new Properties();

}

public String getTitle() {

return _properties.getProperty( "title" );

}

public void setTitle( String title ) {

_properties.setProperty( "title", title );

}

public String getDescription() {

return _properties.getProperty( "description" );

}

public void setDescription( String description ) {

_properties.setProperty( "description", description );

}


Jsp review12 l.jpg
JSP Review

public String getHighBidder() {

return _properties.getProperty( "highbidder" );

}

public void setHighBidder( String bidder ) {

_properties.setProperty( "highbidder", bidder );

}

}


Slide13 l.jpg
PHP

  • PHP paradigms

    • Perl-inspired syntax (mix of C, shell, and more)

    • Functionality provided through functions or less commonly through methodsfunction printPage( $arg1, $arg2 ) { statement-list;}class MyClass { function foo() { … } }

    • Dynamically typed

    • Garbage collection

    • Language reference: http://www.php.net

    • Shell style comments: # this is a comment

  • Variables

    • $auctionTitle = “BMW motorcycle”;

    • Arrays: $arrayName[ $index ]. Are associative arrays! Created with array().

    • String concatenation (dot operator): “one” . “two” == “onetwo”

    • Visibility: Auto scope


Php control flow l.jpg
PHP Control Flow

  • Sequence

    • statement1;statement2;

  • Selection

    • if( condition ) [ statement | { statement-list } ] [else …. ]

    • if( condition ) block elseif [ statement | block ]

    • switch()


Php control flow15 l.jpg
PHP Control Flow

  • Iteration

    • for(), while(), do {} while()

    • foreach( $arrayname as $val ) { … }

    • No goto

  • Method invocation:

    • $object->actionToPerform( $arg1, $arg2 );

  • Persistent DB connections built in


  • ad