Visually create web database apps with WDSC |
Author: Jim Mason
Want to learn to create iSeries e-business applications quickly and affordably? We'll look at using a new approach to building iSeries Java web applications: Visual Development Method© (VDM). Using IBM's WebSphere Development Studio Client toolset (WDSC), we'll see how to build a simple web application that updates Employee data following the VDM process.
We fit the IBM e-business roadmap to your needs and skills
The IBM iSeries developer roadmap for Java and a lot of the IBM training materials focus on learning the language first. Using the IBM model, most RPG developers DON'T quickly and productively get to the point they are able to build Java web applications.
Based on ebt-now's iSeries WDSC training workshops, I created the Learning Java Skills Pyramid to focus learning on specific skill levels for faster payback. The VDM approach is used in the Entry skill level to fit the needs and skills of RPG developers who want to build Java web applications for the first time.
Table 1 - the ebt-now Learning Java Skills pyramid
||VDM and WDSC toolset
||Basic Java coding in WDSC using parts frameworks
||Create and extend parts frameworks
||6 moths or more
||Design intelligent network services for users and applications
||1 year or more
- Entry level
New developers begin at the entry level using VDM. This is comparable to learning Query/400, DFU, Screen Design Aid, SEU and some basic CL commands. It typically requires about a week of effort. The shorter training curve to produce web applications = quick business payback.
- Intermediate level
AFTER you have built and delivered a variety of basic Java web applications using VDM, you can go to the intermediate level where you actually learn how to use Java as a scripting language to write business logic. This IS much more difficult because NOW you are programming in Java USING objects. This IS similar to learning to develop simple programs in RPG. It didn't happen in 1 week either.
- Advanced level
Developers learn how to CREATE (and design) new object-oriented applications and frameworks. This is MORE advanced (and productive ) than RPG development can be. It also has a longer learning curve than RPG normally.
- Architect level
Here you rethink WHAT an application really is. You create intelligent network-based services that dynamically adapt at runtime to the user's requests and the environment. Little application coding is needed in this environment. You may never reach this level OR NEED to in your job!
The Java skills pyramid focuses developer training clearly on a specific skill level with faster payback. The example we'll cover in this article uses only the VDM skills in the Entry level to build our web application with WDSC. Pyramid skills are applied cumulatively as developers learn new levels. For developers at the intermediate level, they can use both Entry and Intermediate skills in building applications.
The VDM approach for web applications defines build plans
With VDM, we leverage all the strengths of IBM's WDSC generators, wizards and visual tools. We also add other visual parts from the ebt-now Visual Parts Toolkit (VPT) where needed to make development even easier. A VDM build plan defines what tools to use in the correct sequence to create a specific type of application. This pattern-based approach to learning WDSC application development works well for new developers.
IBM's WebSphere Development Studio Client for iSeries ( WDSC ) toolset offers several key features that can speed web database application development when used properly in combination:
- SQL statement wizards to create SQL statements
- Web database pages wizard to create basic database web applications
- IBM JSP database tag library ( jspsql.jar) to access databases using SQL
- Page Designer web page editor to visually create and edit web pages
- WebSphere test environment to test your applications WITHOUT using WebSphere!
The VDM build plan for our Employee Update web application covers:
VDM has advantages over normal Java and JDBC development
You CAN build web pages writing Java code and using regular JDBC support. Why is VDM better?
- Higher productivity and faster web development for new developers
- MUCH shorter learning curve - RPG developers can learn to build web database apps in 1 day
- Less debugging because there's limited development
- No need to build custom database frameworks reusing the IBM frameworks and VPT
- Flexibility to run the applications against any database manager using JDBC drivers on ANY server
- No expensive tools to buy if you already own WDSC. The ebt-now Visual Parts Toolkit is included with the training workshop
Need more reasons to like this approach? I don't.
With VDM, you do web development just like you do iSeries development now:
- Using web database wizards to generate web database applications instead of Query/400 and DFU
- Using Page Designer to create web pages instead of SDA and SEU to create display files
- Using JSP tags to access data from your web pages (imagine if CL commands could be embedded in your DDS to read and write data!!!)
You understand the concepts used in the VDM build plan very well even if the specifics are slightly different than what you're used to. And they are clearly faster than writing applications in a programming language like Java or RPG.
What about custom business logic? Yes. You'll need to write some at some point. With WDSC and VDM you have a choice. You can continue to write in any version of RPG you choose and call your logic easily using WDSC program call beans OR you can choose to create simple Java beans using the Java language. Most of this work falls into the Intermediate level on the skills pyramid, not the Entry level.
An example of a simple web application to update a record in a table
The VDM build plan for our simple web application didn't involve ANY Java coding! The build plan for the Employee Update web application:
- Import data model for the Employee table from iSeries using a Database wizard
- Create SQL update statement for the Employee table using an SQL wizard
- Create the basic Employee Update Database Web Pages application using the Database Web Pages wizard that generates JSPs (Java Server Pages)
- Enhance the Employee Update application using the Page Designer editor and IBM JSPSQL tags to add a record selection page and display the existing data to the user for update
- Test the web application in WDSC with 1 click!
Could we SKIP step 4 above using Page Designer and create our application faster? The Good news: yes. The web database pages wizard generates a simple web database update application that has an input page to enter information and a simple results page that shows the update worked.
The Bad news is the basic generated application in step 3 works AND is essentially useless. You get a blank input form to manually enter all the correct information to update the record by hand AND if you mess up a key field, the update blows up!!!
Enhanced Employee Update application using JSPSQL tags
Given the limitations of the database web pages wizard to generate a useful update application, I needed to "enhance" the application to make it usable. Below is the customized version of the application. It has:
Figure 3 - A record selection page
Figure 4 - The customized input page that shows the existing data
Figure 5 - simple results page
This version of the application takes less than an hour to build in the workshop!
Creating the Enhanced Update application with Page Designer
We used the Page Designer editor to create the new record selection page using the visual design view. We added HTML heading, form, input field, label and submit button parts to our Selection page using Page Designer's HTML parts library.
To add the existing data to our Employee Update Input Form, we used Page Designer again to visually add the parts we needed for data access. We used the parts from the IBM JSPSQL tag library and some standard JSP scriptlets and expressions. To reference the JSPSQL tags, we added a tag library descriptor to the JSP page. Next we added JSPSQL tags to:
- create a database connection
- set a SELECT Query string: "SELECT * FROM JEM.EMPLOYEE WHERE EMPNO = :empno" with a host variable (:empno)
- set value of the :empno variable from the employee number input on the selection page
- run the query
- set the value of the each input field on the form from the matching column in the Employee record
Figure 6 - a sample of the design view for the Input Form JSP from Page Designer
More complete example from the ebt-now WDSC workshop
Based on experience, an average RPG developer can typically learn how to build customized web database applications like this (and more) in about 1 day in the WDSC workshop. The lab exercises build full web database maintenance applications that include: navigation, selection, creation, deletion and editing of database records WITHOUT having to become a skilled Java programmer first!
Here's a sample database selection page that allows users to view, edit and delete a selected record or go back and search again:
Figure 7 - sample web database selection page
www.ebt-now.com), is an iSeries WebSphere trainer and developer. ebt-now provides iSeries WebSphere, WebFacing engineering, development and training services. Jim's creating a self-study course for RPG programmers that teaches "hands-on" rapid visual development with WDSC for all types of iSeries and e-business applications without the need to become a Java expert. The course will be published by Rochester Initiative later this Spring. You can reach Jim at: email@example.com