Copyright 2001 Michael Slinn JBrowCaps Open Source Browser Independent Page Rendering for Java Servlets Mike Slinn jbrowcaps.sourceforge.net/
Copyright 2001 Michael Slinn Incompatible Browsers Microsoft and Netscape browsers don’t speak the same language. Older browsers are at a disadvantage without style sheets. More browsers show up every day. The result is … Chaos! (and lots of extra work for nothing)
Copyright 2001 Michael Slinn Problem Not Going Away Microsoft has been successful in upgrading Internet Explorer users Netscape users tend not to upgrade New devices constantly appearing (WAP, i-mode cHTML, etc.)
Copyright 2001 Michael Slinn Browser Share at mslinn.com (as of March 2001)
Copyright 2001 Michael Slinn Netscape Distribution by Version
Copyright 2001 Michael Slinn Instead of This …
Copyright 2001 Michael Slinn 16% of Visitors See This!
Copyright 2001 Michael Slinn Problem Continues to Grow Increasingly expensive to maintain multiple versions of web site HTML
Copyright 2001 Michael Slinn What Makes JBrowCaps Special? Markup is defined in JSP file, not in Java code (unlike ECS) Stylesheet is the single source for markup definition for all browser types! Nice transition between HTML/XML page design tool and JSP Extensible (for cHTML, XML, etc.)
Copyright 2001 Michael Slinn Good CSS Source is Important Change look and feel of a web app by editing CSS, even for browsers that aren’t CSS aware JBrowCaps does not assume any defaults Baseline HTML definitions necessary
Copyright 2001 Michael Slinn CSS Terminology Bug {color:white; background-color:blue; display:block;} Selector Rule
Copyright 2001 Michael Slinn JBrowCaps CSS Parsing Multiple selectors per rule permitted: h1, h2 {color:red; display:block;} Selector redefinition permitted: h1, h2 {color:red; display:block;} h1 {font-size:20pt;} h2 {font-size:16pt;} Selectors are case sensitive! H1 is NOT the same as h1
Copyright 2001 Michael Slinn and breaks the marked up output flows the marked up output into the current line. JBrowCaps uses and according to type of CSS tag applied
Copyright 2001 Michael Slinn CSS display Attribute CSS display attribute is key to selecting or display:inline generates display:block generates
Copyright 2001 Michael Slinn CSS Enabled Browser Output StyleOn – – or StyleOff – – or
Copyright 2001 Michael Slinn CSS Challenged Browser Output StyleOn – StyleOff –
Copyright 2001 Michael Slinn Inside Tag Libraries Tomcat’s Jasper compiles JSPs into servlets. tld files are used by Jasper to verify taglib syntax At run time, tag library code uses PageContext class to access request, response and servletContext
Copyright 2001 Michael Slinn Tomcat’s Tag Library Problem TagExtraInfo() is called by Jasper at page translation time to define the tag library’s scripting variables Unfortunately, Tomcat’s current implementation does not provide TagExtraInfo() access to pageContext This means that parameters to tag libraries cannot use URLs or directory names that are relative to the web application
Copyright 2001 Michael Slinn JBrowCaps Work-Around Use absolute file names when pointing to CSS files (non-portable, unfortunately) I reported bug #75 in Apache’s Tomcat Bugzilla database, but no commitment was made to fix it
Copyright 2001 Michael Slinn JBrowCaps Custom Tag Optional attributes are shown in white If declare is not provided, all symbols in CSS file are defined in JSP
Copyright 2001 Michael Slinn Using JBrowCaps > JBrowCaps Custom Tag Test This is a test
Copyright 2001 Michael Slinn Internet Explorer 5.5 Output
Copyright 2001 Michael Slinn Netscape 4.7 Output
Copyright 2001 Michael Slinn Netscape 3.3 Output
Copyright 2001 Michael Slinn JBrowCaps Data Structures CSS Stylesheet File JBrowCaps (various classes) cssTrue HashMap cssFalse HashMap Each HashMap stores three kinds of tags, directed to different browser capabilities, for each CSS selector. Setting background color and image: Start of marked up text: End of marked up text:
Copyright 2001 Michael Slinn Future Browser Support CSS Stylesheet JBrowCaps cssTrue HashMap cssFalse HashMap i-mode cHTML HashMap
Copyright 2001 Michael Slinn JBrowCaps Classes JBrowCapsTag – tag library runtime JBrowCapsTagExtraInfo – translation time StyleSheet – main class; application bean HtmlFormat – translates between CSS tags and various flavors of markup CssRule – parses CSS selectors BrowserDetector – initialization only TurbineException – used by BrowserDetector
Copyright 2001 Michael Slinn To Do HtmlFormat is not complete. The matrix of browser version vs. tag support needs to be completed. More testing More sample pages and documentation Optimization Any volunteers for this open source project?