=============================================== SEARCH400.COM WEBSPHERE STRATEGIES TIP August 23, 2001 More WebSphere Strategies tips at http://search400.techtarget.com/tipsIndex/0,289482,sid3_tax2f9,00.html =============================================== SPONSORED BY: Storage Decisions =============================================== **STORAGE DECISIONS 2001** Storage Decisions 2001 brings together top storage analysts such as Gartner's VP Nick Allen and Steve Duplessie of ESG and expert technologists such as best- selling author Jon William Toigo. This exclusive conference is FREE to members who qualify. Apply today. http://www.StorageDecisions2001.com. =============================================== Building, deploying JSPs with WebSphere Studio By Jim Mason and Dave Slater 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 or Web development? Post them in our 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. Post it now at http://search400.discussions.techtarget.com/WebX?[EMAIL PROTECTED]^[email protected] You may also read the Web development advice our experts have given in our Ask the Expert section: http://search400.techtarget.com/ateAnswers/0,289620,sid3_tax285218,00.html ================================ MORE INFORMATION ON THIS TOPIC ================================ Best Web Links on Web Development http://search400.techtarget.com/bestWebLinks/0,289521,sid3_tax2f2,00.html Featured Topic: Web Development http://search400.techtarget.com/featuredTopic/0,290042,sid3_gci753487,00.html Have a WebSphere tip of your own? Send it in. You could win a great prize. http://search400.techtarget.com/tipsSubmit/1,289485,sid3,00.html ================================ SEARCH400 DAILY NEWS E-MAIL ================================ "Dot-coms were "da bomb" for iSeries salaries" "IBM, DOE to partner on supercomputer" Did you see these headlines yesterday? You would have if you received search400's Daily News e-mail. Not only do we give you the latest IBM and iSeries news, but we also link you to choice articles and Web sites specific to the iSeries in our Daily Best Web Links. Sign up to receive search400's free news e-mail at http://search400.techtarget.com/register/1,,sid3,00.html. ------------------------------------- FEATURED BOOK ------------------------------------- Title: Enterprise Java Programming with IBM WebSphere Author: Kyle Brown This hands-on guide delves into the most exciting parts of Java 2 Enterprise Edition (J2EE), servlets, JavaServer Pages, and Enterprise JavaBeans. These technologies are examined in the context of the IBM WebSphere Application Server and the IBM VisualAge for Java, Enterprise Edition and development environment. This book provides techniques for maximizing your use of the Java technologies and IBM products to deliver effective and efficient e-commerce solutions. http://www.digitalguru.com/dgstore/product.asp?isbn=0201616173&ac_id=55 ======================================================== If you would like to sponsor this or any techtarget newsletter, please contact Gabrielle DeRussy at mailto:[EMAIL PROTECTED]. ======================================================== If you no longer wish to receive this newsletter simply reply to this message with "REMOVE" in the subject line. Or, visit http://search400.techtarget.com/register and adjust your subscriptions accordingly. If you choose to unsubscribe using our automated processing, you must send the "REMOVE" request from the email account to which this newsletter was delivered. Please allow 24 hours for your "REMOVE" request to be processed.
