Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

lee kris

Ranch Hand
+ Follow
since Mar 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 lee kris

hi there,

java.util.logging.
I am trying to use this logging mechanism for the first time. I saw a couple of examples here and there and most of the time whenever here is a use of a FileHandler(which allows one to write to a file), the file that is written out is a XML file. can I somehow control this so that the file produced is just the same format as though I was using a ConsoleHandeler (meaning a plain text file).

Thanks.
16 years ago
hi Ray,
I get what you said about invalidating the user.
Here is what I tried and related codes.


and my logout Action is as follows( this is where I am invalidating the session and the user).



I tried this and it did not work so I am just not sure if this is the sure right way of invalidating the user.
User, by the way, is a class that deals with all of the user's information
Thanks.
lee
16 years ago
hi Ray Stojonic and everybody,
I followed the suggestion you gave me and the session time out works. Thanks. However, I have also noticed that it does not work in certain instances. For instance, If I login and go to some pages and logout and then past a url on the same browser, it lets me in (unless and otherwise it has been 30 minutes). if I logout the session should invalidate and I should not be able to access any pages after that.
on the other hand if I kill the browser and open a new one and then past a url (one of the pages) then it says sessiontimeout(which is what I want). Also after 30 minutes(struts default session time out) of inactivity it does timeout (this is good). So the only problem that I have it if I login and go to some pages and logout and, immediately, past a link which should only be accessed if a user has a session, on the same browser, then it does NOT say sessionTimeout or invalid session. I do invalidate in my logout action as follows:

So can any one please suggest to me what I could be missing.
Thanks guys.
lee
16 years ago
Thanks Ray,
I will do that and update you of the progress by tomorrow.
Thank you once again,
Lee
16 years ago
hi Ray Stojonic and everybody,
Ray, you are right I was not doing the user-check on every page. I understand what you want me to do but am not sure how. I have never done it before. Do I add a "user checking status" on all the actions (java files)?


Do I also need to set scope="session" in my struts-config.xml where all the actions are being used as the forward path?
A snipet of code would be very helpful.
I am thinking the following might do but not sure.



Thanks for your response and patience.
Lee
16 years ago
hi everyone,
I have a small application that I am developing and now I am trying to use sessions. I want to set the session when a user logs in and invalidate if when the user logs out. In between the login and logout there are many things that a user can do (many possible actions).
I have set the scope = "session" option in my struts-config.xml file and also I have set the session when a user logs in and invalidate it when a user logs out. Some codes snipets are as follows. First in my struts-config.xml I have...


my LoginAction.java and LogoutAction.java are as follows.



Now, when I am testing it, I login do a lot of action and logout. I then open another browser and try to gain access and do some actions and it still lets me in. In other words, after I logout, someone can just gain access to the system. can anyone suggest me how I correct this error? or perhaps link me to a similar example that uses session?
Thank you very much.
lee
16 years ago
hi,
I am asking this again since I did not get a response the last time. So please if you can suggest/respond to this I will greately appreciate it.

Basically, I am using jakarta struts to develop a small project. I am trying to see how I can log the activities of all users who log in to the application and access the database (creating, deleting and editing data) etc. I want to be able to record these information so that I know who logged in when, what the activity of that user was. Now, I have and am still reading on some mechanisms such as the log4j etc. But I am still not sure of what tool to use to accomplish this.
If I am to use the log4j do I use the logger.info for inserting such info or what? Can any one suggest to me what tool to use so that I start reading and working on it. Also if anyone know where I can get more resources regarding this (such as examples) can you please tell me.
Thank you in advance for your help.
Lee
16 years ago
hi,
I am using jakarta struts to develop a small project. I am trying to see how I can log the activities of all users who log in to the application and access the database (creating, deleting and editing data) etc. I want to be able to record these information so that I know who logged in when, what the activity of that user was. Now, I have and am still reading on some mechanisms such as the log4j etc. But I am still not sure of what tool to use to accomplish this.
If I am to use the log4j do I use the logger.info for inserting such info or what? Can any one suggest to me what tool to use so that I start reading and working on it. Also if anyone know where I can get more resources regarding this (such as examples) can you please tell me.
Thank you in advance for your help.
Lee
16 years ago
hi Ted and every body,
I have been working on some project using the struts frame work. I have never heard of jakarta struts before to be honest but I was forced to work on it since my friend left the job which he has started in struts a while ago. Ever since then, I have been working hard to get to know this framework. This forum has been the biggest help and I want to thank the whole community for that. I am almost done with the project now. I think for a person new to stuts, the best thing will be to provide them with a simple, fully functional example that they can always refer to when they get lost. I did not get a good example that encapsulated most of the concepts of struts. So Ted do you have such an example in your upcoming book? Do you think it is a good idea to have an example like that people can have so that they learn faster?
Thank you and have a blessed day to you all.
Lee.
16 years ago
hi Ted and every body,
I have been working on some project using the struts frame work. I have never heard of jakarta struts before to be honest but I was forced to work on it since my friend left the job which he has started in struts a while ago. Ever since then, I have been working hard to get to know this framework. This forum has been the biggest help and I want to thank the whole community for that. I am almost done with the project now. I think for a person new to stuts, the best thing will be to provide them with a simple, fully functional example that they can always refer to when they get lost. I did not get a good example that encapsulated most of the concepts of struts. So Ted do you have such an example in your upcoming book? Do you think it is a good idea to have an example like that people can have so that they learn faster?
Thank you and have a blessed day to you all.
Lee.
16 years ago
hi guys,
Rick you are funny man. I got the error and was able to solve it. It definitely was in the mix-up of things and the major one was

and I honestly do not know how I messed that one up. But anyways thank you guys for trying to help as usual. if any body wants the whole list of codes regarding this and how I corrected it, let me know and I will post most of it.

Lee
hi guys,
Philip asked " Have you tested the UPDATE statement in a query tool, such as the mysql command line utility?"
Answer: of course, it works nicely and as expected. In fact I have a similar example that works on a different database and works correctly(except that this has many attributs).

Question:"Beyond that, are you certain personal.getStudentID() returns a value?"
Answer: yet personal.getStudentID() return a String.

Rick asked :
"Also, student_id in the table is a varchar. Does personal.getStudentId() return a String? "
Answer: yes, personal.getStudentId() returns a String.

And the "qlString.append" was a typo error otherwise it is"sqlString.append" in the java code.

Thank you guys and would appreciate further comments or suggestions to the original problem.
Have a good day.
Lee
hi,
May be this is not the right forum for the following question regarding mysql but if one can check it out for me it is great.
I am using mysql and JDBC for some application that uses the jakarta struts frame work.
mysql works fine with a lot of insert, delete, and what not but when i am trying to update I get some error which has already costed me many hours. Here is some details that might help you help me in detecting this problem.

the sql statement:

The Java code:



the SQL:




upon execution i get the following error:
Syntax error or access violation, message from server:
"You have an error in your SQL syntax. Check the manual that corresponds to your
MySQL server version for the right syntax to use near 'where student_id = "xxxxxxxx".

where "xxxxxxxx" is a wrong value for student_id. What syntax error in mysql could be causing this?
Thank you, in advance, for trying to help.
Lee
hi gurus,
I have a database from which I display some data on a jsp page. my goal is to be able to edit this data by allowing a user to click on a "Edit" link and then he/she should be able to change the data and submit so that the changes are reflected (stored) in the database. Eveything is ok except that when I click on the "Edit" link the data which should be populated on the form does not appear. It just gives me the form (empty). I am getting the data from the database correctly (I tested it) I am also trying to set the value into the form but I am not sure why the data does not get set.
here is how I set the values on to the form.

//get it from the db using student Id as the key
SomeVO personal = SomeDAO.getPersonal(student_id, getDataSource(request));

if (personal != null)
{
form = new TheForm();

form.setStudentId(personal.getStudentId());
form.setLastName(personal.getLastName());

.
.
.
form.setCountry(personal.getCountry());
}


Can someone suggest to me what I might be missing or forgetting Please. Thank you and have a good day.
Lee.
16 years ago
hi Craig Jackson,
Perfect. works perfectly now.
Thank you.

Lee
16 years ago