Jeff Zohrab

Greenhorn
+ Follow
since Jul 24, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jeff Zohrab

Hello, I've searched for any text on Java packaging best practices, particularly with regard to program structure and minimizing dependencies, but can't find anything. I hope I can get some help.

I have a (fairly procedural) portion of a program to do some processing. The processing procedure is in its own package, as it has helper classes, etc, and I felt that this was a good way to express the intent of the program to maintenance/production support. This package also contains some subpackages, which handle moderately complicated subprocessing on their own. These subpackages have some common requirements (such as data source interfaces, and result collectors), so it made sense to pull these out of the subpackages ... but I wasn't sure where to put them: in the main package, or in yet another subpackage in the main package?

Example:



Question: Where should Helper go? In package process? Or in a third helper package, process.helpers? The former seems OK as it keeps the number of packages down, but it seems funny that there are package dependencies both ways (from the parent to the child, and from the child back to the parent). The latter seems potentially clearer, as there wouldn't be any circular package dependencies (even for nested packages), but there may be some drawbacks to this I'm not aware of, such as the explosion of packages.

Really the question boils down to dependencies and how to keep things obvious and clean. I can import everything, but it seems sloppy. Advice or references would be appreciated.

Thanks,

Jeff
17 years ago
Thanks so much, look forward to trying this out. I'm not familiar with some of the API calls you're making (such as the calls to exConfig), have to check those out. If this works, it's a big plus.

jz
17 years ago
Hello, I have a custom exception handler modeled after the handler described in "struts - the complete reference" chapter 8 (the EmailExceptionHandler).

This Handler can throw when it tries to send the email (alerting production support, e.g.). I'd like to be able to catch that error in the handler and add the failure message to the jsp the user sees, so the user knows to contact someone immediately by phone ... unfortunately, I can't figure out how to do this. I've tried the obvious (creating an ActionError message and storing it in the request), but it doesn't seem to get printed out on the JSP in the <html:errors> tag.

Any ideas or suggestions would be great.

Thanks,

Jeff
17 years ago
I second "Head First". Easy reading, running examples (if you take the time to get each code snippet to run!). Be aware there are errata ... but still I really liked it.
18 years ago
JSP
Hello, I have a question about general application control.

I'm building a very simple MVC Swing thick-client app for my own enlightenment -- relatively new to Java, working through the trails.

A bit of background: I have a very strong MS Access background (please don't hold it against me). Oversimplifying the story, Access practically forces the developer to adopt a particular development style ... forms directly bound to database tables. I'm interested in using MVC, since the model is quite complicated, and while I can get Access to do this, I'd like to try Java as a proof-of-concept, since I can then do all sorts of neat stuff (e.g., re-use some/most/all of the model code when upgrading to the inevitable web app, using Fitnesse to create nice user acceptance tests for the client, and other things).

The question: when building an MVC Swing app, what controls the whole application? In the Swing tutorial trails, each "Swing app" (GUI only) has a main() method, but I'm not sure what to do for a real app. Should main() create some central ApplicationManager, which creates the model, then some kind of controller (so GUIs can update the model)? Or should main() create some kind of form, and the application flow is handled by the form-to-form direct calls (this is the Access way)?

I hope this question makes sense -- if not, I'll do my best to clarify. Any help (or sample code!) would be appreciated.

Jeff
18 years ago
While going through the book, I'm implementing the examples in one big example website. For example, I have Pg382UsingParamValues.jsp, src/com/example/Pg356BeTheContainer.java, etc.

I have a single index.html that has links to every servlet/jsp example, and the web.xml just grows. I throw all examples into src/, and have a script that redeploys everything to Tomcat.

It works pretty well. I find that I hardly ever have to restart Tomcat, even if I change the web.xml (I thought I'd have to shutdown/restart all the time, but it's such a hassle).

I'm hoping that the "learn by doing" approach will stick. If I'm trying to implement an example after I've read a section, I'll do it without looking at the book, to see if I've kind of got it. The time it takes me to type stuff probably also gives my brain a rest. And I scribble all over the book, cross-referencing everything to/from earlier/later stuff.

Hope this helps,

Jeff

PS - take lots of breaks!
(I've seen a other few posts on this topic, but their solutions didn't help...)
I'm new to J2EE, and tried to run cloudscape.bat to look at an example, but the .bat file hangs on me when I try to run it:

...: [RmiJdbc] Starting Cloudscape RmiJdbc Server Version 1.7.2 ...
...: [RmiJdbc] COM.cloudscape.core.JDBCDriver registered in DriverManager
...: [RmiJdbc] Binding RmiJdbcServer...
...: [RmiJdbc] No installation of RMI Security Manager...
...: [RmiJdbc] RmiJdbcServer bound in rmi registry/* HANGS HERE */

Notes:
- The .bat files seemed to have some non-ascii chars in them... I pulled them into Notepad, got rid of the trash, resaved, and then all was fine.
- I've set the Environment Space to a large number, and I'm not getting an "Out of Env. Space" message
- netstat /a reveals the following local addresses in use: 1025, 1228, 427, 1089, 427, 1089 (I'm not sure if this has anything to do with this problem but I saw references to it in another post...)
Does anyone have any ideas?