Sagewire Logo

java developer RSS Feed

Recent Posts View Recent Posts | View Archived Posts

Message from gachsaran
Most recent post: 5/3/2007
3 authors and 3 replies.

I use linux and Eclipse IDE to develop a JDBC based application. But
Eclipse can not see mysql-connector. If I use a editor like Gedit I can
compile and run the application.Mysql-connetor is in my CLASSPATH but
Eclipse doesn't see it. It means every times I create a JAVA project
that use Jdbc I need to include muysql-connectorXXX.jar into JAVA project.
Any help will be appriciated.

Tanks
gachsaran read more about Eclipse And JDBC Driver settings


Message from Mike Kamermans
Most recent post: 3/7/2007
5 authors and 6 replies.

A good day to all,

I was looking at the visibility levels for variables in JAVA, and
realised that the current approach to variable visibility is incomplete:
while an object oriented programming langauge, the visibility issue has
been defined from a class oriented perspective. While class definition is
an aspect of object definition, it's not the whole story, leading me to
conclude that a proper object-level visibility definition is missing.

How much animo'd there be for a fourth visibility marker that marks a
variable as accessible by "this" object only, rather than objects that
share the same class as "this"? It'd basically lead to the following
"hierarchy":

public - full visibility
protected - visible to any object being or extending "this" class type.
private - visible to any object being of "this" class type
restricted - visible only to the object in which it is defined

I ran across this when I was making copy constructors and realised that
if I'm really programming object oriented I shouldn't be able to
directly access variables from a sibling object. From a design point of
view it shouldn't be possible for any object to mess with the internals
of another object if these internals are to be truly considered
"private" in the linguistic sense of the word.

I picked the word "restricted" mostly because "owned" seemed an odd word
to use (especially given its meaning in the coder community), but any
word that in some way implica read more about additional visibility restriction for variables?


Message from Ken
Most recent post: 11/21/2005
3 authors and 3 replies.

Is there a difference in the following blocks of code?

if ( true ) {
new UserScreen();
}

/==============================

if ( true ) {
Object o = new UserScreen();
}//end

There seems to be an issue with disposing of the UserScreen object under the
first scenario. To me, the two blocks of code have the same effect.

k read more about Object scope....


Message from No-Spam at No-Spam.com
Most recent post: 11/11/2005
8 authors and 18 replies.

At the risk of a religious war, I'm trying to get feedback on the [longer
term] viability of using Sun's Web Start to facilitate JAVA on the desktop.

Years back, we were heavily invested in Applets, which obviously have fallen
out of vogue. When Web Start technology became main-stream, we had no cause
to use it for commercial solutions. We now are looking seriously at several
option for multi-platform desktop / client support ... prefering the richness
of a traditional GUI over the web but cannot overlook AJAX as a viable option.

Googling leads to countless unrelated posts. Is it possible to get quality
feedback on this; that is traditional GUIs vs Web for application interfaces.
Obviously everyone wants web, but given the responsive nature of traditonal
GUI apps, I / we suspect that these'd be welcomed over HTML.

Hoping to get feedback without rat-holes.

Thanx in advance.

Phi
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com read more about Web Start anyone?


Message from Charter
Most recent post: 9/20/2005
3 authors and 3 replies.

Hello all,

I am new to JAVAmail. I was working on a project in C++ under Microsoft Windows
(I know, boo) and decided to switch to JAVA. Most things are going well,
except the mail part. I need to send and receive E-Mail with POP3 and SMTP
running on SSL. I need to use authorization and alternate port numbers. It
should be simple, but I do not seem to be able to figure it out. Could
someone out there that knows a lot more than me about JAVAmail (that won't
be hard) send or post a simple example of doing this?

TIA,
Adam read more about Example of JAVAmail with SMTP and POP3 on SSL


Message from nospam
Most recent post: 8/20/2005
4 authors and 9 replies.

Hi..All,

In one of our application, we developed/complied a JAVA code which
uses couple of 3rd party JAR files. Since last couple of years we've
been getting the new/updated JAR files from the 3rd party, but we never
complied our code with the new JAR files till now.
Recently we made some small enhancement to the JAVA code & are trying to
compile it with the latest JAR files. The compilation is throwing lot of
errors due to the deprecated methods we are calling.

I am wondering how did it work earlier i.e the same class file with new
3rd PARTY JAR files.

Regards,

P read more about Using old classes with new helper JAR


Message from AnonymousFC3
Most recent post: 8/11/2005
3 authors and 3 replies.

Hello:
for interfacing with code, mostly written in C.

Which one of the two is best suited (easy, fast, etc...) to develop a GUI
interface:
JAVA or Qt... or something else (WxWidgets, Renaissance etc...)?

Portability may be an issue: portable code is useful, but mosrt portable
libraries do quite well by now. Is assertion valid?

Thanks.
AFC3, comp read more about RAD GUI, Is JAVA the best answer? or QT ?


Message from Wojtek Bok
Most recent post: 8/11/2005
2 authors and 2 replies.

If I set up a class definition with:

------------------------------
public static final int SORT_FIRST_NAME = 0;
public static final int SORT_LAST_NAME = 1;
public static final int SORT_BIRTHDAY = 2;
------------------------------

then use this in a switch clause:

------------------------------
switch(sortOrder)
{
case SORT_FIRST_NAME:
// do work
case SORT_LAST_NAME:
// do work
case SORT_BIRTHDAY:
// do work
}
------------------------------

all is well. But, if I use dynamic allocation:

------------------------------
private static int cvCounter = 0;
public static final int SORT_FIRST_NAME = cvCounter++;
public static final int SORT_LAST_NAME = cvCounter++;
public static final int SORT_BIRTHDAY = cvCounter++;
------------------------------

then the switch/case statements show errors (in Eclipse 3.02).

Why? Eclipse accepts the value assignment. And the values ARE final, yet
the switch/case shows an error that "case expressions must be constant
expressions". read more about constant values in a switch clause


Message from Al Koch
Most recent post: 8/11/2005
2 authors and 2 replies.

How do I use the Java API (application programming interface)in a Thread-Safe Manner?

Hello,

I am writing a JAVA servlet and am new to coding for thread synchronization.
I suspect that there must be an "obvious" solution to the following problem
but after sevearl days of research I can not find it!

It is my understanding that, in general, the J2SE 1.4 API (application programming interface)is *not*
thread-safe. There are some APIs where the Sun documentation states that a
Class's methods are thread-safe (such as StringBuffer) but in general, most
of the text and web search references I've found have stated that the API (application programming interface)
in general isn't thread-safe. That means that there must be at least one
(and it's probably most) API (application programming interface)that isn't thread-safe and let me just call
such an unsafe method "UnsafeAPI()". My question is, how do I use
UnsafeAPI() and write code to make my code thread-safe?

For example, if I've the following code:

public final class MyClass {
private int i;
private int j;
private int k;

public finale void MyMethod(int i, int j, int k)
{
this.i = i;
this.j = j;
this.k = k;
}
}

I've a thread safety issue here. Assignement to an int is atomic so no
one of the three assignment statements in MyMethod() can be interrupted by
another thread. However, the *sequence of all three assignments* certainly
can be interrupted so I am vulnerable to a synchronization is read more about How do I use the Java API (application programming interface)in a Thread-Safe Manner?


Message from Lucky
Most recent post: 7/25/2005
2 authors and 2 replies.

hi I have JAVAscripts file validations.js. and I want to use these JAVAscript
functions in my jsp pages which use struts html tags..
i do not know how to invoke these functions from <html:form...(struts html
tag).
if it is a ordinary html form I would have done like below
<form name="myform" action="xxxx.jsp" onsubmit="return validate()">

wrote in message the same with the struts html tag.....it is giving error the is
no attribute like "name" in html tag lib..
can any body tell me how to user external JAVAscript functions in the struts
html tags read more about how to use JAVAscript functions in struts html:form


Message from kk_oop
Most recent post: 7/20/2005
5 authors and 5 replies.

Hi. I'm looking for advice on using keys for a HashMap.

Is it typical to just use a string as a key, e.g., "Item A", "Item B",
etc.? Or are other approaches better? Since the key is just an
Object, I thought there might be some other approach commonly used
that is more efficient/effective.

Thanks for any advice!

Ken read more about HashMap Keys?


Message from Jay Canale
Most recent post: 5/14/2005
2 authors and 2 replies.

Hello,
I am not sure if this is the right forum to post this, so I am sorry if
it is not.

I am knew to JAVA software development using the Sun JAVA plugins. My
company has released a beta version of some software that is targeted for
the 1.5 version of the JAVA plugin. A company who is beta testing the
software is having trouble with the fact that their software that runs in
the 1.4.0_02 version of the plugin doesn't work with the 1.5.
Now my question is how do we as a company handle this? Should we target
the software for the 1.4? This company is only a small percentage of the
people who will use the software. Should not the 1.4 software work with the
1.5? Or what will happen to our 1.5 software when the plugin goes up to 1.6
or version 2?

What should we do?

Jay read more about JAVA Software Dev Question


Message from Lucky
Most recent post: 5/7/2005
2 authors and 2 replies.

Hi
In oracle, if I need to get the sysdate, I'd do some thing like this
select sysdate from dual;
And if I need , the difference between sysdate and a specific date ,say
"pdate" ,I'd do,
select sysdate - pdate from dual
This'd give me the difference in days ,so for ex
select sysdate -to_date('01-JAN-2005') from dual
would give me 125 as the number of days.
---
Now what I want to know is that in JAVA how do I this. I tried to play
around with the Date and Calendar objects.
These objects are giving me individual feilds like day,month and year etc,
but not date as a whole. So my question is

1. How do I get the date in JAVA in a specific format (in any format I
choose). What is the best object for this.
2. How do I get the difference in 2 dates, which should give me in number of
days.

Your quick responses are appreciated.

Thanks,

PS. By the way how do we do the same in JAVAScript. read more about Getting Date Difference in JAVA.


Message from Chris Miller
Most recent post: 5/1/2005
3 authors and 4 replies.

Has anyone tried to monitor 50000 socket connections in JAVA?
I've an application that needs to do just that.

I can open 50000 sockets with no problems, but things get unstable when
I try to listen to 5000 to 6000 of them.

My configuration is a combination of 50 threads to listen to 1 socket
each, 500 threads pooled and waiting for the ServerSocket.accept(), and
2500 listening for data on 20 sockets each. Tested on Red Hat Enterprise
up to 6000 sockets. I am pretty sure there no deadlocks, or anything
strange.

Has anyone done something similar? Is this idea even sane?

Thanks. read more about JAVA networking, 50000 sockets


Message from Jack
Most recent post: 4/12/2005
3 authors and 3 replies.

Hi,

Is it possible to set a timeout when opening a connection to an
HttpURLConnection?

For example, is it possible to make the connection call and limit it to 5
seconds before a response is generated?

That is, I do not want to have to wait for the "default" timeout.

Thanks for any info.

Jack read more about HttpURLConnection timeout?


Message from Danny
Most recent post: 1/9/2005
2 authors and 3 replies.

Hi folks,

I'm a undergraduate. After picking up JAVA from one of my course Unit, I
would like to move on JSP development.

I'd appreciate if anyone could recommend some good books on the topic?

Thanks in advance.

Regards,
Danny read more about Books Recommendations on JSP & servlet development


Message from Chris
Most recent post: 1/7/2005
4 authors and 4 replies.

Hi, I was wondering what a beginner needed to start programming in JAVA such
as what software, what books you recommend, etc.

Thanks! read more about New to JAVA


Message from rsatdb
Most recent post: 11/7/2004
3 authors and 3 replies.

Hi all.

I have got servlets running in a chain. This works fine if users access
the servlets and JSPs. Now I'm trying to write a JAVA class that can
emulate the browser, so that the applications runs without user
interaction.
I got the connection to work with authentification and I can access
the InputStream I get back, but I could not figure out how to access my
objects that I pinned to the session in my servlet chain.
(Startpage.jsp-->servlet-->output.jsp) The output.jsp accesses the
objects that were pinned to the session by the servlet.
I'd now like to connect(better POST) to the servlet like the
Startpage.jsp does but from a JAVA class. That'd make my
application run without a browser having to connect...

------------JAVA class code-----------------
String authString = "admin" + ":" + "admin";
String auth = "Basic " + new
sun.misc.BASE64Encoder().encode(authString.getBytes());
URL url = new URL("http://localhost:8080/Dummy");
URLConnection conn = url.openConnection();
conn.setRequestProperty("Authorization", auth);
System.out.println(conn.getInputStream().toString());
BufferedReader in = new
BufferedReader(new
InputStreamReader(conn.getInputStream()));
String line;
while((line = in.readLine()) != null) {
// process line
System.out.println(line);
}
----- read more about Accessing http session objects from a JAVA class


Message from Franklin Barths
Most recent post: 11/6/2004
3 authors and 4 replies.

It seemed when I first installed J2SE SDK and the Tomcat
server, that it did not get along with MS's Visual Studio and
IIS server. That was in Windows 98. Now I'm running
WinXP Pro, and I'm getting tired of maintaining two
versions of the operating system - one Win XP running my
JAVA stuff, and another WinXP running my C# stuff (I'm a
student). I'd like to put the two development environments
on the same operating system. Can it be done so that the Microsoft Visual Studio.NET and IIS does not interfere my JAVA
SDK and Tomcat development software?

--->Barths read more about J2SE SDK & Tomcat coexist w/Visual Studio.NET & IIS?


Message from System User
Most recent post: 11/4/2004
3 authors and 5 replies.

Hello,

I've searched to no avail on this question.

Does anyone know how to view the grapical (menu) output of a JAVA class
file?

I am not interested in the code behind the scene, but rather the
executed/parsed output.

I've some JAVA class files that create various menus and I need to take
screen captures of those menus.

Please excuse any apparent ignorance with JAVA.

Any assistance will be very much appreciated.

Thanks,

Jim read more about How to "VIEW" JAVA Class files?


Message from Wojtek Bok
Most recent post: 10/6/2004
2 authors and 2 replies.

Is there a reference somewhere which lists which classes are in which
.jar files?

For instance, if I want to use HTTPServlet, which jar file is it in (I
know where it is, just an example...)?

All the API (application programming interface)docs give the package name, but where is the package?

TKS!! read more about Class, Class, where is the Class


Message from Me
Most recent post: 9/22/2004
3 authors and 3 replies.

How do I get the actual Calendar time out of a Calendar object?

I am trying to save UTC time to a table column. However the Calendar
object always returns the current time, not the UTC time from its
utility methods. The get() method does return the actual Calendar time.

----------------
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
String actual = "";
actual += cal.get(Calendar.YEAR );
actual += "-";
actual += (cal.get(Calendar.MONTH ) + 1);
actual += "-";
actual += cal.get(Calendar.DAY_OF_MONTH );
actual += " ";
actual += cal.get(Calendar.HOUR_OF_DAY );
actual += ":";
actual += cal.get(Calendar.MINUTE );
actual += ":";
actual += cal.get(Calendar.SECOND );
actual += ".";
actual += cal.get(Calendar.MILLISECOND );
JAVA.sql.Timestamp ts = new JAVA.sql.Timestamp(cal.getTimeInMillis());
System.out.println( actual ); // this is right
System.out.println( ts.toString() ); // this is wrong
------------------

The above will alwys print the UTC time, then the current time, yet they
should be the same. read more about Calendar Problem


Message from tungchau81
Most recent post: 9/16/2004
2 authors and 2 replies.

Hi,
I am using session variable for checking user validity among the
pages. That is, After logging in, I am getting the user's name from
the session. If the name value is empty or null, I am redirecting the
page to login page. Is there any other way to check the user validity?
Can anybody help me in this issue?

Thanks in advance.
Tung Chau read more about User authentication


Message from tungchau81
Most recent post: 9/16/2004
2 authors and 2 replies.

Hi,
I've been using <jsp:forward> alot in my application for
authentication to forward back to login page if the user did not log in
or to forward to a new or parent page after hitting Submit button on a
current page.

I read somewhere that we shouldn't use <jsp:forward> standard action
in JSP since it makes page behavior hard to comprehend. Forwarding
violates the principle that a JSP is a view.

Does a MVC framework will help me avoid using <jsp:forward> ? And how?
I've never used any MVC framework. What is a good one out there? I
had a brief look at Struts before and it seemed so complicated. I
hesitated to use it because it mite double the development time and I
am not sure if Struts will last long. Which framework should I use
then?

Is there anyway to avoid using <jsp:forward> without using any
existing MVC framework. My application is not using any framework,
only JSP, JAVABean models using Hibernate, no controlling Servlet at
all. I am still struggling for a better design to make the application
more scalable, reusable.
Any help is appreciated.
Tung Chau read more about How to avoid using [code][/code] standard action without using MVC framework? What good MVC framework outthere?


Message from ken
Most recent post: 9/13/2004
2 authors and 2 replies.

In some open source I have looked at recently the author always used the
equals method rather than the equals operator. For objects defined
from user-defined classes is there some reason why the method is
preferred?

Ken read more about == vs equals


Message from neil.benn
Most recent post: 9/11/2004
3 authors and 3 replies.

Hello,

I'm developing a JAVA app which will need to be installed by a
non-computer expert at severla remote locations (commercial). I have
dug around and am looking for either a free/cheap installer for JAVA
based apps or some decent documentation on how to fire up ActiveSync
to do the job for me (google searches get blogged out by comments on
eVB/.NET CF).

Does anyone have any advice as to a suitable solution?

Thanks, in advance for you help.

Cheers,

Neil read more about Installer for JAVA app


Message from andy9654
Most recent post: 9/11/2004
2 authors and 2 replies.

Hi

I am considering to use Struts or Xml/Xslt in the presentation
layer tier. I like the possibilities to verify form values and
error handling of form values with Struts tiles.

I wonder if there are the same possibilities to use the same features
in Xml/Xslt, as when you are using Struts tiles? Or what are the main
differences in using Xml/Xslt compared to Struts?

Thanks,
Andy read more about Struts and xslt


Message from usguest
Most recent post: 9/11/2004
2 authors and 2 replies.

Hi,

I am using Servlet and Tomcat to build a web application. I understand
that whenever there is a http request, a Servlet thread is created to
handle it. However, I want to have my own scheduler to handler those
event. Basically, I want to queue all the incoming http request, and
execute as my order. Any advice on how to do that?

I'll appreciate any response. Thank you.

Stephen read more about handling event in Tomcat


Message from joscardoso
Most recent post: 9/3/2004
5 authors and 18 replies.

Hi,

I've developed a JAVA application that interacts with a database.
Now i have the folowing problem:

- I've a list retrieved from the database(about 200 records);
- for each, I do a Jlabel constructed from an html String;
- for each JLabel I construct a JPanel e add it to the main panel.

this works fine, but when there's an inactivity in the application
(about 30 minutes), the main panel disapear and the application
freeze. i do not know the reason for that (perhaps a lack of memomy
???).The application runs in a PIII 600mhz with 256 mb of ram.

Somebody can help me???

Thanks. read more about JAVA performance problem


Message from kenosis
Most recent post: 9/1/2004
2 authors and 2 replies.

Greetings JAVA Lovers,

Can anyone advise me on an effective way to employ JUnit with a
servlet? (I'm developing the servlet on Apache and JServ.)
Specifically, the test cases I intend to develop will require access
to back office services only accessible via the servlet which is of
course managed by JServ. Its not clear to me how to drive th servlet
(or JServ) via the Junit test runner. Any thoughts?

Ken Hilton
Kenosis LLC.

PS. If this isn't the most appropriate subgroup for this question
please kind and feel free to direct me to the correct one, should you
know better. Thanks in advance for any help you can lend. read more about Junit and JAVA Servlets.


Message from Timberline
Most recent post: 8/29/2004
2 authors and 2 replies.

Hi All

Does anyone know where I can get an example showing how to develope a
Multi-Document Interface application? I am trying to develope a system
where I can have multiple data entry screens open at the same time.

Thanks
Ron Troyer read more about Multi-Document Interface program example


Message from sameergn
Most recent post: 8/29/2004
3 authors and 4 replies.

Hello All,

I've a simple JSP which looks like this
This page accesses the session every time it is invoked. The session timeout
is set to 60 seconds. What I've observed is that, If the page refresh
interval is set to less than 30 seconds, then session lives for a long time,
but if it is longer then session is dropped frequently.

Does this mean, it isn't sufficient to access session only once during
timeout period to avoid timeout? I was under the impression that tomcat 4
'd restart the 60 seconds timer after every access to session.

Thanks,
Sameer. read more about tomcat 4 session timeout


Message from chris.marko
Most recent post: 8/27/2004
2 authors and 2 replies.

Hi to all!

I want to use the comm package to access RS-232 ports over a PCMCIA
card (4 serial ports are linked to one PCMCIA card, which is put into
the PCMCIA slot), put the ports are not found with the appropriate
class of the comm package. Normally the RS-232 ports should be found
with the port numbers COMn, COMn+1, COMn+2 and COMn+3, but I see none
of the four.

If this does not work with the COMM API, are there any alternatives to
the COMM API (application programming interface)to access RS-232 ports?

Regards
Chris read more about COMM API (application programming interface)and RS-232 Serial PCMCIA Card


Message from Me
Most recent post: 8/25/2004
2 authors and 3 replies.

Is there a class somewhere which will sanitize user input?

I want to allow things like <b>, <i>, and <a href>, but disallow
<script> etc.

I've found a utility, but it is in PHP
http://linux.duke.edu/projects/mini/htmlfilter/

It allows the programmer selection of tags, does tag completion (ie:
will close an open <b>) and so forth.

I'v done the google thing, but what you get is a lot of discussion about
the importance of sanitizing input :-( read more about Sanitizing User Input


Message from big_tiger
Most recent post: 8/25/2004
2 authors and 3 replies.

Hi,

I've a Nokia 6100 phone and I'm develoiping application that stores
data via RecordStore class. The problem is I'd like to have those
data on my PC (i.e. via infrared link).

Ideas:
1) Use infrared API (application programming interface)- probably not possible :(
2) not to use RecordStore but other class (if exists) that allows me
to create file (in Gallery folder maybe?). The I could access the file
from Nokia PC Suite.
3) Access file there RecordStore records are stored (RMS.rms?) - but
how?

Is it any of those possible? Any other ideas?
Marcin read more about accessing RecordStore


Message from AIK
Most recent post: 8/24/2004
2 authors and 2 replies.

I've the following two classes:

package birdpack;

public class Bird {

Bird() {}

protected int nFeathers;

}

in bird.JAVA

and

package duckpack;
import birdpack.Bird;

public class Duck3 extends Bird {

Duck3() {}

void foo() {
Bird b = new Bird();
int temp;
temp = b.nFeathers;
}

}

in Duck3.JAVA

When I compile Duck3 I get this error: nFeathers has protected access in
birdpack.Bird. Why is this? I thought the point of a protected modifier is
to allow children of a class to access parent's protected feature even if
the child class is in a different package? read more about Question about protected modifier


Message from dba_222
Most recent post: 8/14/2004
5 authors and 5 replies.

Dear experts,

I'm trying to learn JAVA on my own. I picked up a
sample online, but it isn't compiling right:------------------------------------------------

import JAVA.io.*;public class FileInfo { public static void main(String[] args) {

for (int I = 0; I < args.length; i++) {
File f = new File(args[i]);
if (f.exists()) {
System.out.println("getName: " + f.getName());
System.out.println("getPath: " + f.getPath());
System.out.println("getAbsolutePath: " + f.getAbsolutePath());
try {
System.out.println("getCanonicalPath: " + f.getCanonicalPath());
}
catch (IOException e) {
}
System.out.println("getParent: " + f.getParent());
if (f.canWrite()) System.out.println(f.getName() + " is writable.");
if (f.canRead()) System.out.println(f.getName() + " is readable.");
if (f.isFile()) {
System.out.println(f.getName() + " is a file.");
}
else if (f.isDirectory()) {
System.out.println(f.getName() + " is a directory.");
}
else {
System.out.println("What is this?");
}
if (f.isAbsolute()) {
System.out.println(f.getName() + " is an absolute path.");
}
else {
System.out.println(f.getName() + " isn't an absolute path.");
}
try {
System.out.println("Last Modified" + f.lastModified());
System read more about What's wrong with this try/catch/finally?


Message from jw697569
Most recent post: 8/11/2004
2 authors and 3 replies.

I've an application running in Tomcat 3.3. When I request a JSP
within Tomcat, Tomcat establishes a session and each subsequent JSP I
visit uses the same session. I do not remember doing anything special
with Tomcat 3.3 -- it seemed like default Tomcat behaviour to
establish and maintain a session. This works properly in both IE6 and
Netscape 6. From a bit of reading, I understand that Tomcat sends a
session cookie to the browser and that's how it tracks the ongoing
session.

Now I am trying to migrate the application to work in Tomcat 4.1.30
(just trying to get the first set of 3 related JSPs working for now).
I am finding that every JSP page that I visit, Tomcat establishes a
new session (same IE and Netscape browsers as above that still work
fine with Tomcat 3.3). I've verified the behaviour by printing out
the session.getId() each time on each JSP -- and Session Id is always
different.

I am wondering if there is some default setting in Tomcat 4.1 that is
keeping it from recognizing subsequent visits by the same browser as
the same session. I admit that I do not have a deep understanding of
Tomcat. read more about How to Maintain Sessions in Tomcat 4.1?


Message from Terry
Most recent post: 8/7/2004
4 authors and 5 replies.

Hello. I'm beginning to work with patterns and'd really appreciate
some of the group's feedback regarding a problem I'm solving. I'm
looking for a way to abstract a persistence layer interface in a way
that'd require little or no modification of the rest of the
application if the underlying storage medium were to change. Pretty
standard, no?

Currently, I have implemented the persistence layer as a package of three
interface files. The main data store interface holds all the usual
methods such as getBizObject(), removeBizObject( id ), saveBizObject(
bizObj ), etc. A second interface is a BizObject iterator, and the
third contains misc utilities. I have implemented a DB store by extending
these three interfaces, the idea being that when the data store medium
changes, we've only to extend the interface files again and the
application has no knowledge that its data is persisted in another
medium.

This works of course, but it does not strike me as a particularly elegant
solution.

My requirements are these:
- The application is currently a web app, but could be moved to SOAP or
EJB so I do not want to rely on a container.
- The number of classes comprising the persistence layer may change
- The underlying data store will change often.What I'm after is this:
- I'd like for changes to the store medium be completely transparent and
unobstructive to the rest of the application code.
- I'd like to have implemented persistence "packages" (implementatio read more about JAVA design pattern question


Message from Angus Parvis
Most recent post: 7/29/2004
4 authors and 11 replies.

Hi,

When a method throws an exception, I always have to deal with it in some
way (let it fall through or catch it).
But when a constructor throws an exception, it doesn't have to be
caught. Why that?

I'm curious about the answer ;)

Greetings,

Angus read more about constructors and exception handling


Message from cazq1998
Most recent post: 7/28/2004
4 authors and 5 replies.

Hi, anyone can help me?

I'm working on windows and I want to execute a command on a remote
computer (Unix) so I try to make a telnet to the specified server but
I did not get any answer. My code is really simple. I DO not WANT TO USE
SOCKETS OR ANY OTHER PROGRAM IN THE SERVER.

Can anyone give some advice, or any suggestion?

SOURCE CODE (this is the source code that I'm using)
-------------------------

import JAVA.io.*;

class test{

public test(){}
public void process(){
try {
// Execute command
String command = "telnet";
Process child = Runtime.getRuntime().exec(command);

OutputStream out = child.getOutputStream();
out.write("open <SERVER_NAME>\n".getBytes()); // Get the input stream and read from it
InputStream in = child.getInputStream();
int c;
while ((c = in.read()) != -1) {
System.out.print(""+(char)c);
}
out.write("my_user\n".getBytes());
while ((c = in.read()) != -1) {
System.out.print(""+(char)c);
}
out.write("\n".getBytes());
while ((c = in.read()) != -1) {
System.out.print(""+(char)c);
}
out.write("touch carlos.txt".getBytes());
out.write("exit".getBytes());
in.close();
out.close();
} catch (IOException e) { System.out.println(e.getMessage());
}

}

public static void main(String args[]){
test uno = new test();
uno.process();
}
} read more about executing remote command


Message from as9213
Most recent post: 7/26/2004
2 authors and 2 replies.

Hi,

I've developed a email sending program using the
JAVAx.mail.internet package. I inherit from the MimeMessage class to
develop my wrapper which handles the email text body. It works
successfully for email addresses like 'joe@xxxxxxxxxxx or
smith@xxxxxxxxxxx'. BUT it doesn't work for pager emails ie, if I have
a pager number like 8473193276 its (corresponding mail address is
8473193276@xxxxxxxxxxx') it doesn't send the text to my
pager.

Though I get a message from my source email , the 'text' matter or
the message doesn't appear. Could anybody tell me why could this
happen? I don't think its a code problem, becos I am able to log the
text until the last step when it is passed to the MimeMessage object &
DataHandler Object etc...

I've a few related questions. Does it happen because pager text
cannot be handled by a MimeMessage (which is part of
JAVAx.mail.internet package). Is a pager email address not a internet
email address?

Please throw light on my confused head!!

Thanks
Arvind! read more about pager email addresses


Message from sirgilligan
Most recent post: 7/26/2004
2 authors and 3 replies.

I can not figure out which JAVA Group is concerned with the development
process side of things. Sorry if this post is in the wrong area.

With the advent of JAVA and agile methods such as XP, Scrum, and
Crystal, etc., I was inspired to write my memoirs so to speak.

New version of Maverick Development Model:
http://home.att.net/~geoffrey.slinker/maverick/MaverickDevelopment.html

All of the other documents:
http://home.att.net/~geoffrey.slinker/agile.html

I'd appreciate any comments on my ideas. Please contact me. read more about Agile Development


Message from kk_oop
Most recent post: 7/24/2004
2 authors and 2 replies.

Hi. I need to store a series of numbers in a two-dimensional lookup
table. Basically, it will be preset to static final values and accessed
by two indicies.

Any standard JAVA approach for this? I'd like to use an ArrayList
over an array for bounds safety reasons. Is that the way to go, or is
there a better approach?

I'm new to JAVA and I know it has a huge API, so I'm just looking for
pointers--or I guess I should say references. Heh heh.

Thanks,

Ken read more about M