ben munoz

Greenhorn
+ Follow
since Jul 24, 2001
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 ben munoz

Are the JSP and the servlet part of the same web-app? If they are, they should share the same session variables.
-Ben
21 years ago
To avoid setting this every time you login, you can also set this in your login script. If you have Redhat, you most likely use bash. Do this:
>cd ~
>ls -al
(there should be a .bash_profile file)
Edit the .bash_profile file to set your classpath environment variable, there will probably be a $PATH variable you can use as an example.
-Ben
21 years ago
How to get the primary key is most likely implementation specific. You can disable autogenerated primary keys for a table and insert your own primary key. Then you know what the primary key will be before you insert it. This method is cross-database, gives you more control, but is slightly more work to implement.
If your primary key is autogenerated you can 1) use vendor specific syntax to return the last inserted primary key like @@identity in TransactSQL or 2) use a select statement based on a 'date_added' column with other values just inserted.
Then set the primary key of your value object and return that.
I can tell you how I use file based logging for my servlets. I use Log4J from http://jakarta.apache.org/log4j
There are several ways to use this package. First, import the necessary classes.

Then create a class variable for this logging object.

In your servlet's init() method, configure the logger.

In your doPost() and doGet() methods, you can send very detailed debug or error messages.

The log4j classes are well documented and easy to use. They are a valuable tool for servlet/DB developers and well worth learning.
-Ben
21 years ago
Jason Hunter has devoted several chapters in Java Servlet Programming (O'Reilly) to template engines.
Template Engines Listing can be found here half way down the page: http://www.servlets.com/tools/index.html
22 years ago