"Build Database-Powered Mobile Applications on the Java Platform"

Michael J. Yuan and Ju Long

Why a JSP-based communication layer?

Michael and Ju,

In the article's architecture, why did you use JSP (JavaServer Pages) as the communication layer? I think a servlet is a more suitable option. According to what I know about JSP and servlets, JSP is best when you actually have to display something, and servlets play a good role when you want to do some sort of communication only, like object streams.


Ghulam, Yes, you are right. In a production system, servlets are probably better than JSP in the communication layer. However, the article's purpose was to illustrate the concepts and demonstrate how you access backend databases from the mobile device. JSP is easy to use and does not require compilation, packaging, and deployment. Just copy it to the right directory and it works. Once you understand how it works, you are free to use any architecture you want. The server side does not even have to be Java. Michael Yuan

Wireless Java

"Data Security in Mobile Java Applications"

Michael Juntao Yuan

Where does SIM fit in?


I feel that you failed to mention one of the most important factors of the security modules for future mobile devices: SIM (Subscriber Identity Module), which has its roots in security and authentication. Modern SIMs have RSA (Rivest, Shamir, Adelman) accelerators making PKI (public key infrastructure) possible and secure on these devices. The interface between the mobile device and SIM can be extended to include J2ME (Java 2 Platform, Micro Edition) requirements (which I believe is part of what JSR (Java Specification Request) 177 is all about). Not adding this information to the article was quite a serious omission.


Eric, The article's focus is cryptography toolkits on small devices. I did not mention SIM as a viable option for J2ME because JSR 177 has not been active for an entire year. None of the commercial crypto kits use special SIM acceleration. I do not know what's up with JSR 177, but unless the JCP (Java Community Process) releases at least a concrete community draft, I would like to avoid mentioning it. It is at least another year away from real-world phone implementation. In the meantime, if you are aware of any real-world SIM extension to CLDC (Connected Limited Device Configuration) and benchmark on the improved RSA performance, please feel free to email me. Michael Yuan


I actually exchanged emails with someone who claimed they were close to the JSR 177 workgroup. The group planned to issue a community release in Q1 this year, a deadline they already missed.

I should follow up a bit. I am currently contracting with an aggressive mobile operator in mobile commerce, which gave me the opportunity to meet with some handset manufacturers and SIM vendors who committed to push this hard. Alas, the results aren't there yet.

I notice that Microsoft is using this opportunity and is working on a similar SIM-based solution, something which J2ME is in a favorable position to address since Java Card could provide what SIM needs and most SIM vendors have a Java Card product.


"Big Designs for Small Devices"

Ben Hui

Help with Cascading Menu pattern


In my J2ME (Java 2 Platform, Micro Edition) project, I must implement a very complex menu system consisting of Lists, which are used to structure the hierarchy, and Forms, which are used for data input. How I can adapt the Cascading Menu pattern to incorporate the Form class as well. I use the Form class only at the end of the List hierarchy.

To give you an example:

  • List 1 (select option 3)
  •   List 1.3 (select option 4)
  •     List 1.3.4 (select option 1)
  •       List (select option 7)
  •         Form (data input)

List 1 is the main menu, and you select the appropriate option to reach the wanted Form.

Do you have any suggestions?

Ole Kristian Buseth

Ole, You can use the


interface to implement the


. Interface


allows you to implement your menu system's leaf node. Refer to my


source code as an example. In your case, you should implement a class similar to the following:

public class DataInputForm extends Form implements MDisplayable
  public void onDisplay( MenuElement e )
// e would be element in your example

Then, you need to register this


into your menu system, like so:

MenuElement menu_1_3_4_1 = new MenuElement( "Menu" );
menu_1_3_4_1.addChild( new MenuElement( "Menu"), new DataInputForm() );

Ben Hui

Java 101

"Classes Within Classes"

Jeff Friesen

Can one class access another class's nested class?


Is it good practice for a class A to access a class B's inner class C? If class B knowingly gives access to its inner class, is it a good idea to do that?


Ramya, My answer to your question is: yes and no: Yes, it is sometimes appropriate for one class to access another class's nested class. For example, suppose a class contains a nested top-level class (that is, a nested class prefixed by the keyword static). The nested top-level class serves as a utility—in much the same way that static fields and methods serve as utilities—and is exposed because it's not designed for objects. No, from an information-hiding perspective, it is often not appropriate to expose an instance inner class to outside classes—just as it is often not appropriate to expose instance fields and instance methods (designed as helper methods for other exposed methods). Look carefully at the JobIterator3 application in my article. Notice that Employee's JobIterator instance inner class is not private. I chose to expose that class to reduce the amount of code I needed to write. It would probably be best to hide that class, which means I'd need to attach additional methods to Employee for iteration purposes. And what would I end up with? Probably something similar to the Enumeration interface and methods in the Vector class that implement Enumeration's methods. (Note: I didn't want to introduce Enumeration and Vector this early in the column, so I kept JobIterator3 simple.) Jeff Friesen

"Dynamic User Interface Is Only Skin Deep"

Jason Briggs

How do you make a nonrectangular skin?


I have a question about nonrectangular skins. I am using JBuilder 5 to write a desktop application in Java that is supposed to sit in a cool, nonrectangular skin. Can you advise me what is the best way to do this?


Nechama, If you want a cross-platform nonrectangular window, then you're out of luck. There's nothing in any of Java's current versions to accomplish this in a way that will work across all the platforms. That said, there are some third-party tools—they're platform specific, of course. Check out http://www.l2fprod.com/ for one example that works on Windows; however, I'm not sure whether it works on other platforms. Jason Briggs