Based on my experience, IBM's WebsSphere Studio and VisualAge for Java are excellent tools to rapidly develop Java...
Web applications and train new developers on Java Web development. Studio's Page Designer is an easy tool to learn for visually building JSP pages quickly. VisualAge for Java's WebSphere Test Environment is a productive way to do most of your testing. It supports interactive debug of BOTH the JSP page AND the generated Java servlet code simultaneously, making it easy to find errors.
I worked on a project building an interactive Java Web application to run with WebSphere on the iSeries. Below are some tips for both designing JSP pages and debugging runtime errors in the WebSphere Test Environment.
Try to make your application easy to use.
Add online help pages that are accessible from any page for the user. Provide Customer Service or Support line contact information that is also accessible from any page and include hours of operation, phone numbers and e-mail addresses. You would not believe how many "large" corporate sites fail to do this well. (Oh, wait. You would believe it.)
If a JSP fails to compile at runtime:
Review the error messages displayed in the Web browser first. Usually the error only tells you the page that failed to compile, not why.
Next, check the correct target directory or repository to find the Java-generated source code for the servlet that didn't compile as a Java class. Potential reasons for a failed compile include incorrect Java, HTML or JSP code in the page or a resource that wasn't accessible at compile time (e.g., a Java class not found on the classpath). If you started with WebSphere Test Environment servlet engine with the option to load servlets externally, the generated Java source code for a JSP is the latest file in a sub directory of the Test Environment (by default): temp/JSP1_0. If you select the option to load servlets externally, the generated Java source is in a Project in VisualAge: JSP compiled code. You can view the source from the VisualAge workbench.
If a runtime error occurs in a JSP:
Review the browser page for any error messages. In some cases you may see a default error page that doesn't include any specific error information. If that is the case, see if the JSP has a generated page directive for a default error page. If it does, comment this out by changing the prefix <% to <% // . Now, running the JSP, errors will be dumped to the current browser page and not handled by a default page. Since WebSphere Test Environment lacks good logging facilities compared with WebSphere (where logging is excellent), consider either putting the generated servlet in debug mode in VisualAge or using a scriptlet such as the one below to write messages to the generated browser page:
<% pageContext.getOut().println(" this shows a Java variable = " + myVariable); %>
Use JSP model for generating database wizard applications.
For simple applications, you can create a "similar" MVC (Model-View-Controller) concept in a JSP by creating a "before" block of control that executes before you do output in the JSP. I do editing of input, processing and error checking here before I produce output. Most of that work is typically done in Java beans so you don't have large JSPs with thousands of lines of code. (A very bad thing!) The reason I choose the JSP model with the resulting tsx database tags is because those tags are easier to maintain visually in Studio for new developers. Usually we are transferring an application to a customer who isn't experienced in maintaining Java applications.
Produce test use cases for any complex application function
You can easily build Java "tester" beans that test complex logic separately from the application as a whole. In our case, the NumericHelper bean that did mod 10 checking on input numeric values was tested in VisualAge using a "tester" bean we created with specific use cases. We were sure the bean worked perfectly before we added it to Studio as part of our application.
Get help to resolve networking problems
For our application, we received good support from the IT network staff to reconfigure how names were resolved using their DNS servers. Originally, our WebSphere Application Server just timed out whenever we sent a request to start the application from the browser. Running a test Java application I wrote, I could see that we could ping the WebSphere server by address instantly. When we attempted to connect using a configured DNS name through the firewall we timed out because the DNS request was forwarded to a corporate DNS server thousands of miles away. The network staff reconfigured the processing sequence for DNS servers to use the local server first and then our timeout problems ended. We could have reconfigured the application timeout value in WebSphere, of course, but that would not have solved the real problem.
Remember to remap your JDBC driver when deploying on WebSphere
If you develop and test your application in VisualAge's WebSphere Test Environment, you will use the AS/400 Java toolbox JDBC driver, which can remotely access the iSeries database. When you deploy to WebSphere on iSeries, you can change to use the native JDBC driver that comes the Java JSDK on the iSeries for better performance. The toolbox driver will work directly on the iSeries, but the native driver is faster.
Speed remote development
We have some automated tools we've built that help us rapidly reconstruct and modify customer's databases on our servers. In addition, we can easily check to see if supplied RPG and CL test programs have all the associated application objects we need for testing. This helped us setup our project on our server in an hour or two versus days.
About the authors: Jim Mason is president of Cape Cod Bay Systems, and he writes, consults, teaches, designs and develops AS/400 Web applications using Java, WebSphere, DB2, Lotus Domino and the WebSphere Development Tools for AS/400. Dave Slater is World Wide Market Manager of AS/400 Application Development at IBM Canada.
FREE EXPERT ADVICE
Do you have questions about WebSphere and Web development? Post it in our new .26RlaSVDeTg^1@.ee84637>WebSphere/Web Development Discussion Forum. Here you'll get advice from our site experts who monitor the forum, as well as ideas and suggestions from your peers.
You may also read the Web development advice our experts have given in our Ask the Expert section.
MORE INFORMATION ON THIS TOPIC
Have a WebSphere tip of your own? Send it in. You could win a great prize.