Win a copy of Head First Android this week in the Android forum!

stan ioffe

Greenhorn
+ Follow
since Jun 30, 2005
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 stan ioffe

... Yes, there is no "back button" event per say .. In fact, of the 4 ways i proposed it's the weakest ...
What i meant was that you could implement a "back button" if your application has a button that allows your app to go back .. lol
-stan
16 years ago
There are many ways of doing what you want. One of them is to keep a flag in the session and invalidate the session when the back button is clicked. You can catch the "back button" event using a JS function.

You could also keep the "current displayed" as a String or some ID that represents the page in the session and if the user leaves the page via a browser's button, depending on your business logic, if that's a no-no, you can once again invalidate the session and redirect user to an error page.

Maybe another way would be to alert the user on back button press that if he continues, his session will be invalidated?

You should also check server documentation, there may be already an implemented service .. or some kind of listner that waits for the "back button event" .. and invalidates the session.

I hope this helps
-stan
16 years ago
I think you're having a problem because the receiving servlet is failing to set the correct contentType.

the doGet or doPost methods MUST set the contentType as the first step for the charset to take affect. If this method (res.setContentType()) is not called, the content type is assumed to be "text/html"

-Stan
16 years ago
Depending on your application and how much you care about each answered question in the test, it might make sense to keep saving data for each completed question. This way, if the session times out, you'll at least have some of the answered questions.

Another benefit is that you don't have to keep too much information in the session object ... especially if there are a lot of Strings or other immutable objects that can easily drain JVM's memory.

-stan
16 years ago
You can also serialize session data onto a disk and allow a different machine reload that data. ... However, as mentioned above, it's server specific.
-stan
16 years ago
Where is the "form_id" property set to "loginform"??

In the init(), you should set the form_id parameter to "loginform" since you're checking it later.

Then it should work ...

-stan
16 years ago
Every web application has exactly ONE instance of javax.servlet.ServletContext ... according to java's specification.

Each servlet has its own ServletConfig object. In other words, there is 1 ServletConfig object for each servlet. Think of ServletConfig as a wrapper around servlet's initialization parameters that are passed into the servlet for its instantiation.

-Stan
16 years ago
If you're submiting to a servlet that then redirects the request using a forward or an include, you can create session variables in the included servlets or you can create attributes using .setAttribute() method that can later on be retrieved from an HttpSesssion object on your final destination's page.

-stan
16 years ago
Do you want to remove the session or clear what's part of the session?
16 years ago
To add to Bill's point, you're going to have to create your own "checking system" ... For example, store some kind of unique key in a database that both applications will have access to.

Since you cannot use session, you're going to have to bind that key to a person's login, and have some kind of a flag that determines whether or not this login has already been activated by the other application. Then if it has, you could have another field which will keep a hash of all the name/value pairs that you would usually put into a session which both web apps will need to parse and maintain every time something needs to be added or deleted from the database ...

In any case, it's going to get really complicated, really fast. Are you sure you can't do without having a session for both applications??

-stan
16 years ago
Which app server are u using?
If you're using something like WebSphere, all you need to do is configure your JDBC connection and your connection pooling is going to be handled by the app server ... just a thought
-stan
16 years ago
I don't think you can resend the "rest of the file".
If the connection keeps breaking, maybe it's possible for you to break up the file into smaller pieces, then recombine them into a bigger file on the other end.
-stan
16 years ago
As I understand, you want to print out all month/sal for each name?
Then it's a double loop.
First get all names,
then for each name get month/sal information.

So, your output would be like this:
for each name, Print NAME, then, in the same row, print out all month/sal columns.
Repeat for the next name.

Does that explain it?
-stan
I think, (and i could be wrong ), your browser's cookies are disabled, thus, the URL is automatically re-written with an appended jsessionID.

Below is an extract from http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets11.html which is under "Session Tracking".
----
If cookies are turned off, the session is encoded in the Check Out URL as follows:
http://localhost:8080/bookstore1/cashier;
jsessionid=c0o7fszeb1

If cookies are turned on, the URL is simply
http://localhost:8080/bookstore1/cashier
----
It runs fine in IE6.0 ... What exactly is the problem?
16 years ago