Search the OSCAR Documentation
< All Topics

Developer’s Corner

Coding Pointers


OSCAR depends on the browser locale to signal which language to serve labels. Thus OSCAR is extensively i18n tagged with keys kept in resource files based on the language. For English we use to keep the key and its value. Both new and reworked code should avoid English UI labels and instead add values to the English language resource file.

UI Look and Feel

UI we try to keep it consistent with an older Bootstrap. You will note that the blue raised buttons for indicating the primary button class=”btn btn-primary” is a convention used throughout OSCAR to make the interface more intuitive.

Font awesome should be used for icons and they are already in OSCAR

The icons are black and can be styled whatever colour and size you want
Treat them as fonts for CSS

To link Bootstrap and Font awesome in an OSCAR JSP to use, add the following:

<link href="<%=request.getContextPath() %>/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="<%=request.getContextPath() %>/css/datepicker.css" rel="stylesheet" type="text/css">
<link href="<%=request.getContextPath() %>/css/DT_bootstrap.css" rel="stylesheet" type="text/css">
<link href="<%=request.getContextPath() %>/css/bootstrap-responsive.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="<%=request.getContextPath() %>/css/font-awesome.min.css">
<link rel="stylesheet" href="../css/helpdetails.css" type="text/css">

When possible entertain using Data-tables (also embedded in OSCAR) for displaying tabular output.

UI Security

Don’t assume that the end user of OSCAR is benign or can’t be tricked to save malicious content into the database. Even with the login data is transfered to OSCAR potentially to be displayed (with malicious code being run) when a log file is displayed. You must assume that the database has untrustable content and escape it. OSCAR is using the OWASP library to prevent arbitrary injection.

Rather than

document.forms[0].notes.value = "<%= apptObj.getNotes() %>";

Include the library in the JSP and escape the content

<%@page import="org.owasp.encoder.Encode" %>

document.forms[0].notes.value = "<%= Encode.forHtmlAttribute(apptObj.getNotes()) %>";

TIP: do this at the last step before it becomes visible in the browser. If you don’t you risk missing bits or double encoding.


Try to compile your code without unit testing to have the stylecheck plugin examine your code. Certain forms and approaches are deprecated (eg Vectors) to ensure consistency.


Everything from Angular to Jquery to Bootstrap to Apache Commons libraries moves through a series of versions. For ease of maintenance please use EXISTING libraries in OSCAR unless they don’t work or are insecure.

Linking Master Record in Developed JSP
<%=request.getContextPath() %>/demographic/demographiccontrol.jsp?demographic_no=<%=patient.getDemographicNo()%>&displaymode=edit&dboperation=search_detail)

TIP: use <%=request.getContextPath() %> to link various items in OSCAR in a developed JSP.
<%=request.getContextPath() %> is the oscar folder: /var/lib/tomcat9/webapps/oscar

Copyright Copy Paste Block for JSP

    Copyright (c) 2001-2002. Department of Family Medicine, McMaster University. All Rights Reserved.
    This software is published under the GPL GNU General Public License.
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

    This software was written for the
    Department of Family Medicine
    McMaster University
    Ontario, Canada

Table of Contents