This month, we asked IBM WebSphere Studio tools development manager, Andy Philpotts, to answer your top questions on Web development using WebSphere® Studio Application Developer and WebSphere Studio Site Developer. WebSphere Studio Application Developer combines Java, Web, and enterprise development tools in a single integrated development environment. It is for Java and J2EE developers who need integrated, team development support for Web applications, servlets, JSPs, EJBs, XML, Web services, data access, and enterprise access. WebSphere Studio Site Developer is a visual development environment for creating dynamic Web sites quickly and easily. It is for Web developers who need team development support for JSPs, servlets, and XML, plus access to database and Web services wizards. If you want more information about WebSphere Studio, see WebSphere Studio Zone.
Andy received an overwhelming number of questions from our WSDD users, answering only the most popular questions. We appreciate and thank all the WebSphere developers who submitted questions.
Question: Could you please give detailed instructions on using STRUTS with WSAD 4.03? (submitted by FH)
Answer: In WebSphere Studio Application Developer (hereafter called Application Developer) 5.0, this process is automated, but in 4.03 you have to add a number of files from the struts distribution into your Web project.
The lib/struts.jar file goes into the WEB-INF/lib directory.
All of the lib/*.tld files go directly into the WEB-INF directory.
You also need to update the WEB-INF/web.xml file to include a <servlet> element to define the controller servlet, and a <servlet-mapping> element to establish which request URIs are mapped to this servlet. Here is an example:
<servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>config</param-name> <param-value>WEB-INF/struts-config.xml</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>2</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>2</param-value> </init-param> <init-param> <param-name>validate</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>application</param-name> <param-value>ApplicationResources</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> |
You should also define your taglibs. You can pick whatever URIs you need, but this is a good starting point. For example:
<taglib> <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri> <taglib-location>/WEB-INF/struts-bean.tld</taglib-location> </taglib> <taglib> <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri> <taglib-location>/WEB-INF/struts-html.tld</taglib-location> </taglib> <taglib> <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri> <taglib-location>/WEB-INF/struts-logic.tld</taglib-location> </taglib> <taglib> <taglib-uri>/WEB-INF/struts-template.tld</taglib-uri> <taglib-location>/WEB-INF/struts-template.tld</taglib-location> </taglib> |
The last file you need is the struts-config.xml file, which you need to write yourself, or copy from an existing struts project. Again, this goes directly into WEB-INF. Part of the new struts support in 5.0 is an editor for this file.
At the top of each JSP page that uses the struts custom tags, add lines declaring the struts custom tag libraries used on this particular page:
<@ taglib uri="/WEB-INF/struts-bean.tld" prefix="struts-bean" %> <@ taglib uri="/WEB-INF/struts-html.tld" prefix="struts-html" %> <@ taglib uri="/WEB-INF/struts-logic.tld" prefix="struts-logic" %> <@ taglib uri="/WEB-INF/struts-template.tld" prefix="struts-template" %> |
For more information, see Struttin' your stuff with WebSphere Studio.
Question: Is WSAD 5 going to have GUI support for developing JSP forms with STRUTS? (submitted by FH)
Answer: Yes, not just for the forms, but also for the application as a whole. Application Developer 5.0 includes a graphical tool to help build struts applications by stringing together JSPs, actions and beans on a canvas, and wizards and editors for the various struts artifacts. In addition, the page designer has a new feature called visual custom tags. Struts relies on a custom tag library to build the pages, and we "understand" how to render and edit these tags. This makes visual composition of struts JSP pages much easier. By the way, this visual tag feature is extensible so that you can enhance any custom tag with design time visualizations for the JSTL tag library. Building a struts application will be a breeze in Application Developer 5.0.
Question: We are currently using WebSphere 3.5 on OS/390. Our users are all purchasing WSAD. I've been told that they really should be using VAJ while we're on 3.5. Since more and more users are purchasing WSAD to write their web apps, are there parms etc that can be set to help guarantee that it will work when ported to OS/390? (submitted by Vickie Cooper)
Answer: I think you have been told correctly. Application Developer 4.0 and 5.0 do not specifically support WebSphere 3.5 so this is a largely manual process. Having said that, I know a lot of people are developing for 3.5 from Application Developer. This is a testament to the flexibility of the environment.
Question: The customer wants to develop a digital media development tool like VisuaAge for Java's Visual Composition Editor. Using this tool, developers could draw GUI and Java code is generated. Another requirement is only AWT code is generated, no swing.
Customer wants to cooperate with IBM and develop using VisualAge for Java's Visual Composition Editor. But, VisualAge for Java is not IBM's strategy tool offering in the future, I think we should not recommend this way.
Another possible way is to develop an Application Developer plugin. But it's hard to achieve such a GUI-intensive Java client IDE. I think what Application Developer plugin does is just add more functions through menus and wizards.
Is this possible by using any of IBM's tools? And the effort? If IBM's tools can't help currently, could you suggest a reasonable way? (submitted by YT)
Answer: In Application Developer 5.0 there is a new visual tool to build both AWT and Swing UIs. To get to it, pick New->Visual Class in a Java project. Unlike the old Visual Composition Editor, it focuses on the GUI elements, allowing flexible editing both visually and throughout the text with changes fully synchronized between the two. In my opinion, the new editor is much better than the older tool. I suggest you save a lot of effort and invest in WebSphere Studio Application Developer 5.0!
Question: Not web development based, but more thick client. Will there be a Visual Composition Editor in a future release of WebSphere Studio Application Developer which is compatible with the code developed using the VA Java VCE? If not, we will need to keep some of our projects in VA3. (submitted by AM)
Answer: Glad you asked this one! Yes, in Application Developer 5.0 we have a brand new successor to the old VCE. It will import VCE produced files and will let you continue to develop your GUIs using a visual tool. The new tool is a little different than the old VCE, so will take a bit of getting used to it. The new version is much more powerful and produces cleaner Java code. For more information, see Comparing WebSphere Studio Application Developer with VisualAge for Java -- Part 3: Using the New Visual Editor.
Question: When will WebSphere Studio Appplication Developer 5.0 become available for evaluation? (submitted by Igor Livshin)
Answer: We are looking to release early next year, although the date is not certain.
Question: Say an EJB Session Bean uses a JavaBean helper class and that this JavaBean helper class has been modified, does it mean that the entire EJB Session Bean needs to be re-deployed and WebSphere Application Server needs to be re-started? (submitted by Igor Livshin)
Answer: You do not need to re-deploy, but you do need to restart the server in order to reload your JavaBean class.
Question: I have business applications built from a framework (which is based on Servlet/JSP). Framework and applications are not developed by the same teams. How can I organize development resources (Java components and Web resources) in WSAD projects, assuming Framework and Application are not supposed to evolve in the same time and Configuration Management is made by the WSAD project (i.e. release is made from a project instead of a Java package or a Web resource)? (submitted by OV)
Answer: I would suggest you separate the Framework and Application into different projects. Without knowing more about the nature of your framework, a couple of options spring to mind. One is to separate into two Web projects, one for the framework, the other for the application, in a single Enterprise Application (EAR).
Another separation that you may find useful, especially if your framework is mainly Java code, including servlets, is to put your framework in a plain Java project and use the loose module support in Application Developer 5.0 to incorporate the framework jar into as many Web projects as you have applications.
Question: I was wondering if it is possible to have WSAD generate an ANT build script. I would like to have ANT stub out most of the script based on the project, then allow me to tweak it for automating the deployment of our client test system. Does WSAD create ANT scripts or can it be made to do so? (submitted by Joel Kosloski)
Answer: No, there is no documented, supported way to do this. We are looking at this as a possible feature for a future release. This request has appeared a number of times. We use ANT in-house all the time, so we certainly see the advantages. Take a look at Barry Searle's article on writing Ant scripts for Application Developer.
Question: I did development of a Web site using Host Publisher 3.5 on a Windows® 2000 server. I'm hosting in WebSphere 3.5 and my database server was an AS/400 by using the connection client access ODBC and it was working. Then I tried to migrate the application to Host Publisher 4, but it did not because it is not supporting the ODBC any more and also there is JSP code I did inside the application, which is not supported. How can I migrate my application without reconstructing it? And, if I want to change my operating system server to be UNIX instead of Win2000, what is the connection type between it and the AS/400? How can I migrate the same application into WebSphere 4 Unix version? (submitted by NA)
Answer: I think that Host Publisher has never claimed support for ODBC itself, just JDBC. There were no changes to that in V4. As for migration from prior versions, there is an application migration utility included with V4. For instructions on how to use this utility, see WebSphere Host Publisher Administrator's and User's Guide. To move the applications to a different server, the best approach is to re-deploy the application from WebSphere Studio.
Question: What should I put for the implementation class name for the Informix database when I'm setting the server configuration? I'm talking about the JDBC driver list configuration. (submitted by VS)
Answer: We support a number of versions of Informix and you don't mention which version you are using. The class name depends on the version. This is documented wherever you obtained the driver. Given that disclaimer, a pretty good bet is 'com.informix.jdbc.IfxDriver'. One way to determine this is to take a look in the jar file for the JDBC driver to see what the class naming is (it will correspond with the internal structure of the jar). Another possibility is to go to the Data perspective and create a new connection. Your version of Informix may well be understood by Application Developer, and if so, we will provide the class name.
In Application Developer 5.0, we have added online help to help users understand this topic. You can get to the online help from the database tools.
Question: In 4.0.3 using "Top Down" CMP EJB's after generating O/R mapping, I added new CMP fields or a new entity. How do I regenerate top-down mapping, schema, etc, for the new fields and entity? (submitted by RH)
Answer: After creating a top-down map and modifying your EJBs, you can update the map by re-executing the top-down mapping. This is done by opening the map editor on your map and clicking the toolbar button labelled Re-execute mapping commands.
In 4.03, re-execute only worked on existing beans, so additional attributes would get mapped. You can map new beans by "dragging" the bean onto the database icon in the mapping editor. This creates a corresponding table. For more information, see Testing Container Managed Persistence EJBs with the Table and Data Source Creator in WebSphere Studio Application Developer 5.0.
-
J2EE Class Loading Demystified
-
Developing and Testing a Complete "Hello World" J2EE Application with WebSphere Studio Application Developer, Part 1





