I'm relatively new to J2EE.
I want to build a client with a lots of financial charts. I'd like to understand what architecture to use regarding the client site of my J2EE application. Either :
- either a Java client calling EJB session beans (3-tier)
- or a Web application using Servlets/JSPs (n-tier)
The question I have deals with the kind of graphs I could use if I chose Servlet/JSPs for the prestation tier.
I wonder if I can have custom-built graphs (like applets) on my client interface with Servlets/JSPs. I need graphs that deal with events (like on a traditional user interface) that allow the end-user to do some kind of drawing for instance. How can I have "java beans" on the client using Servlets/JSPs and enjoy the advantages of Web applications ?
For the moment, the only think I understood is that I can mainly generate HTML pages with Servlets/JSPs that produce traditional forms (buttons, text fields, images, etc).; that's far ways from the kind of graphical user interface I want to offer to my client.
Any idea ?
Kava charts can be an option
If your users are going to be draw in the graph, you are going to need to use some kind of Fat Client. With a servlet/JSP UI, your client is basically HTML and static images.
BTW, if you have direct applet to Session Bean communication, you will ultimate run into trouble with things like firewalls. You might consider using Web Services as an intermediary between your applet and server-side components:
Applet ---------------------> Web Service -> EJBs
Here's my recommendation and this provides flexibility, enabling you to share the same business/data tier with different presentations.
1. Use Session beans for business logic, DAO to deal with database ...
2. Build a controller servlet to produce the desire data based on your client and this can be set in HTTP Request Header when the client request the data. Essentially, all requests are intercepted here and routed to the appropriate handler.
- If it's a JSP client,Perform any necessary operations to get the data and return it as a JSP page.
- If it's an applet client, delegate to a handler that produces either one of the following:
A. Serialized Object (JavaBean) and send it back to the applet
B. XML data,but this will require the applet to do XML parsing.
This is not as complicated as it sounds, there are Open Source Frameworks like Struts that lets you quickly implement this type of MVC patterns. I have applied this pattern successfully for a few pharmaceutical applications.