While version 2.3 of the servlet specification and version 1.2 of the JavaServer Pages (JSP) specification are supported by WebSphere Application Server Express, versions 1.1 and 1.2 of the JavaServer Pages (JSP) specification are compatible and the difference between versions 2.2 and 2.3 of the servlet specification are minor. There are behavioral differences between the Java 2 Enterprise Edition (J2EE) 1.2 and 1.3 specifications.
Servlet migration issues
Servlet migration might be a concern for your application if it has these characteristics:
It is migrated from WebSphere Application Server Version 3.5, and it uses ServletContext attributes. Such attributes are accessed via the ServletContext.getAttribute() API during servlet execution. Websphere Application Server Version 3.5 provided these ways of setting ServletContext attributes:
The second method of setting ServletContext methods is no longer available at WebSphere Application Server - Express, thus attributes can only be be set during servlet runtime using ServletContext.setAttribute( ) - the first method above. If your web application at Version 3.5 relied on setting ServletContext attributes using the second method, you should convert over to use getInitParameter( ) and getInitParameterNames( ), which are new servlet APIs as of v2.2.
The other internal servlets that are affected by the WebSphere Application Server - Express package name change are DefaultErrorReporter and AutoInvoker. Use the WebSphere Application Server - Express package name, com.ibm.ws.webcontainer.servlet.DefaultErrorReporter and com.ibm.ws.webcontainer.servlet.AutoInvoker for these servlets.
Web application migration tips
Some tips for migrating your Web applications include the following:
Set a content type if your servlet generates HTML output.
The default behavior of the Web container changed in WebSphere Application Server - Express. If the servlet developer does not specify a content type in the servlet then the container is forbidden to set one automatically. Without an explicit content type setting, the content type is set to null. The Netscape browser displays HTML source as plain text with a null content type setting.
To resolve this problem, do one of the following:
Set the Java environment variable, com.ibm.websphere.sendredirect.compatibility, to true if you want your URLs interpreted relative to the application root.
Import your classes if your application uses unnamed packages. According to the JSP 1.2 specification, and unnamed package should not be used unless the class is explicitly imported.
For example, if myServletClass is in the unnamed package, and you reference it in a <jsp:useServlet> tag, then you must explicitly import myServletClass with the page directive import attribute, as shown in the following example:
<%@page import="myServletClass" %> ... <jsp:useServlet id="myServlet" class="myServletClass" scope="session"/>
In WebSphere Application Server - Express, the JSP engine creates JSP page implementation classes in the org.apache.jsp package. If a class in the unnamed package is not explicitly imported, then the javac compiler assumes the class is in package org.apache.jsp, and the compilation fails.
Note: Avoid using the unnamed package altogether because in Java 2 SDK 1.4, the compiler does not accept simple names (or unnamed packages) in the import statements.
Issues concerning the migration of JSPs and Servlets
When you migrate from Version 3.5 to WebSphere Application Server - Express V5.1, servlets and JSPs that are installed in the default Web application (default_app) are not migrated by the WebSphere Application Server migration tools. Options to migrate application components that are installed in the default_app Web application are as follows:
If you use the IBM <tsx:dbquery> tag in any of your JSPs, you might need to make additional updates. In Version 5.0, the behavior of the tag's id attribute changed. In previous versions, the id attribute specified the object name of the bean, but now refers to the bean's key name that is stored in the page context. For more information, see <tsx:dbquery> in the Application Development topic.