XSL and Java in ICS

Document Sample
XSL and Java in ICS Powered By Docstoc
					A to J
Moving from ASP to JSP

Jim Bell
Prologue
Real world Blueprints
Portable, Scaleable, and Robust
Roadmap for JSP and more
Leverage ASP experience
Custom Tag Libraries
XML Parallel
Designers and Developers
 cooperate
Blueprints
 J2EE supports Numerous Scenarios
 Creativity and Diversity Fostered
 Learn about Web & EJB Container

 Some Scenarios
  – Multitier
  – Stand-alone
    • EJB
    • Java application
    • Foreign with Web Service
Blueprints – Web Centric
Blueprints – Standalone
Blueprints – Web Container
   What do you call a
       boomerang
that doesn’t come back?
An ASP Epidemic
ASP Temptation
Everybody’s Doing It


  – Easy Access
  – Quick Solution
  – Scripting Experience
  – IIS in Configuration
  – Uncertain about Java
  – No Proof of Concepts
ASP Avoidance
Reasons to Avoid ASP Transformations

  – Reduce Technology Count
  – Reduce Failure Points
  – Reduce Subsystem Handoffs
  – Increase Maintainability
  – Increase Speed
  – Follow J2EE Standards
ASP Complications
Exacerbated By…

  – Mixed ASP code
     • Some logic in JScript (non-standard)
     • Some logic in VBScript
  – Cluttered Code
     • Tags and Code Combined
     • Lack of OO Approach
Commonality
Interactive Pages
Can Separate Logic & Page Design
Use Components
Alternative to CGI
Faster and Easier than CGI
Combination of Tags and Scripting
ASP Issues
 Not Scalable
 ActiveX implies “Wintel” platforms
 Essentially only IIS support
 Porting Products
 Must Colocate Components
 Proprietary process
 Solo initiative
 Mixed, interpreted languages
 Susceptible to crashes
 Memory leaks & Pointer problems
    What do you
        sit on,
      sleep on,
and brush your teeth
         with?
JSP Advantages
Program in Java
XML and JavaBeans ( No COM )
Extensible Tags
Better Cooperation
Rapid Prototyping
Easy Reuse
Not Copy-and-Paste Reuse
JSP Advantages – More!
WORA
  – Any web server
  – Any OS Broader Participation (JCP)
Leading Products
Reference Implementation
Definitely Scalable
Infrastructure Independence
Concepts
Actions = Tags
Tag Variations
Participants
  – programmer
  – designer
  – hybrid
Proper Use
Development Steps
Standard Actions
Starting JSP 1.0
  – useBean
  – setProperty
  – getProperty
  – include
  – forward
  – plugin
Extensibility Added in JSP 1.1
Custom Tags
 Simple to Create
  – Tool Support
  – Doable Manually
 Object Oriented
  – More Maintainable
  – Readily Reusable
  – Encapsulated Logic
 Portable
  – Common concepts and syntax
  – Multiple Vendors
Source of Libraries
 Departmental
  – better maintenance
  – easy handoff
 Corporate
  – consistent approach
  – best practices
 Suppliers
  – ISP
  – Web Services
 Application Servers
  – E.g. BEA WebLogic
Pieces to the Puzzle
Bean
Handler
  – simple
  – nested
  – iterative
Tag Library Descriptor
web.xml
WAR (optional)
javax.servlet.jsp.tagext

Interfaces

  – BodyTag
  – IterationTag
  – Tag
  – TryCatchFinally
javax.servlet.jsp.tagext

Classes

  – TagSupport
  – BodyTagSupport
  – BodyContent
  – TagData
  – PageData
  –…
Do You Know TLD?

XML Document

 – Tag Names
 – Valid attributes
 – Links Tags to Handlers
Handler
Per Request
Processes Tag
Communicates with other objects
Can Alter BodyContent
Implements one interface
  – Tag
  – BodyTag ( for more power )
Some Interface Methods
doInitBody
doStartTag
getBodyContent
setBodyContent
doEndTag
doAfterBody
Some Interface Constants
EVAL_BODY_INCLUDE
EVAL_PAGE
SKIP_BODY
SKIP_PAGE
Sample : Looping
Snippet
    <jrb:myLoop i=“10”>
           <jrb:doStuff/>
    </jrb:myLoop>
myLoopHandler
  – doStartTag()
  – doAfterBody
doStuffHandler
  – a bit more work
     JSP Snippets
<%@ taglib uri=“where” prefix=“jrb” %>

<jrb:myHelloWorld />
<jrb:myValue myAtt=“myField” />
<jrb:myWrap>Plain Text</jrb: myWrap>
<jrb:myLoop>
<jrb:myNest /></jrb:myLoop>
       TLD ( page 1 )
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE taglib PUBLIC "-//Sun
 Microsystems, Inc.//DTD JSP Tag Library
 1.1//EN" "http://java.sun.com/j2ee/dtds/web-
 jsptaglibrary_1_1.dtd">

<taglib>
 <tlibversion>1.0</tlibversion>
 <jspversion>1.1</jspversion>
…
      TLD ( page 2 )
<shortname>MyTagLibShortName</shortname>
<uri></uri>
<info>My Very Own Tag Library</info>

<tag>
  <name>MyTag</name>
<tagclass>sparcplug.MyTagHandler</tagclass>
   <info>My Own Tag</info>
</tag></taglib>
      web.xml ( page 1 )
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun
 Microsystems, Inc.//DTD Web Application
 2.2//EN" "http://java.sun.com/j2ee/dtds/web-
 app_2.2.dtd">
      web.xml ( page 2 )
<web-app>
 <taglib>

  <taglib-uri>MyTagLibShortName</taglib-uri>

  <taglib-location>/WEB-INF/MyTagHandler.tld
  </taglib-location>

</taglib></web-app>
We Are Not Alone
 Adobe           K&A
 Allaire         Macromedia
 ATG             NetObjects
 BEA             Netscape
 Bluestone       New Atlanta
 Caucho          Oracle
 Exoffice        Visual Care Group
 Jakarta (ASF)   Orion
 IBM             Turbine (ASF)
 Gefion          Sun Microsystems
 KL Group        SilverStream
Conclusion
Tag Libraries are a Key to JSP 1.1
Providing Encapsulation
Generating Widespread Interest
  – User Community
  – Industry Participation
Future Developments Evolving
Knowledge Levels

          Specialty




          Utility


      Familiarity
Online References
           –e-docs.bea.com
           –java.sun.com/products/jsp
           –www.jspinsider.com
           –jsptags.com/tags
           –jakarta.apache.org
           –java.sun.com
              •   /apm
              •   /j2ee/blueprints
              •   /products/servlet
              •   /products/jsp
           –jsp-interest@java.sun.com
           –servlet-interest@java.sun.com
Online Reference Sampling
Demonstration…
    Questions
       &
    Answers


JimBell@aximal.com