Link to home
Start Free TrialLog in
Avatar of member_october
member_october

asked on

Problem with Session?DynaActionform?BrowserBack?

Hi All !

In my application, if  I register using Account#1,email#1 ,password and zipcode#1(a unique userid#1 is generated and I am successfully logged on(auto login) ,then I click on Browser Back or type in the url of the page (its not a jsp a .do) , Enter Account#2,email#2 ,password and zipcode#1.(no user-id is created). If I logout and logon with userid#1 ,the 2 accounts are displayed .w

are the session attributes not set?if then how is the Account#2 being taken?

What I need is ,a second user-id must be successfully generated.(since email is different and user id is generated based on email)


Help needed IMMEDIATLY  !!!

PS:I have posted this question under javascript section Yday.
Avatar of Celdric
Celdric

Umm, sorry about my lack of english vocabulary.. umm
could you rephrase your question and explain your problem in detail?

Oh and these additional info will help us see the context of your problem:

What technologies are you using: Struts? JSP? Servlets? All of the above?

Does your form interact with a DB driver, JDBC maybe?

Do you store this data somewhere on your application (in order to compare different forms
and given them different id's)?

How do you implement user validations/authorization/authentification?

*shrug*
Avatar of member_october

ASKER

i am using Struts and JSP.

i guess my vocab is bad  and also i am new to java,struts so pls let me know if going wrongin my basics.

In registr_form.jsp I enter the acc#,email,password ,zipcode and then click on submit.The action class registraction.java is invoked and the request object is created using the form variables(DynaActionForm).A third party API is called and it returns a unique user-id.

So if I register again (clicking on back or directly entering the URL in address) ,the acc# in the present form becomes the second acc# for the first user-id .Thereby no second user-id is created even thoughI pass the new variable values in my header.





If you are auto-logged in, then you are theoretically associating the Account#2,email#2 ,password and zipcode#1
(from the second form submission) with your first login.

Add a check to your registr_form.jsp and registraction.java to see if the user is already logged in and if
they are logged in, don't register them again.
Ok, let me get this straight:
You have a form, that uses Struts tags like <html:text> etc..
In this form you capture the following things: acc#, email, password and zipcode.

The form is linked to a submit button and an action (which you have configured in struts-config.xml
to instantiate and run an Action servlet) This registraction.java gets the following things as para
meters: The Actionmapping, The ActionForm (in this case a DynaActionForm), the request and
the response. Now, I havent used Dynaforms personally, but these are created from
struts-config.xml directly, correct?

Ok, now to the problem:
You register yourself once, the account is entered in the database.
You press back and try to register again, another account is created. (you dont want this)

"""So if I register again (clicking on back or directly entering the URL in address) ,the acc# in the present form becomes the second acc# for the first user-id .Thereby no second user-id is created even thoughI pass the new variable values in my header. """

This means that when the second user register, the first account gets replaced instead of
creating a new account? We want to create new accounts each time a user register.

So, the problem is that the form stores the data from the previous registration?

Celdric,

The form stores the data from the previous registration.Thats what I guess.

BUT ,i think the word account is  misleading.say account = creditcardno.

I register first using :

creditcard no =100
emailid =abc@ee.com
password=a123
zipcode=01029
SSN :1001

The application logs me in."successfully registered!" (Use your email-id to login in future)

I click on browser back.the Registration form is displayed,I enter

creditcard no =200
emailid =xyz@ee.com
password=a123
zipcode=01029
SSN:1001

The application logs me in."successfully registered!"

NOW, I enter the site using abc@ee.com

your credit cards are  
100
200

What I need is only 100 to be displayed when abc@ee.com logs in. And want to see 200 displayed when logged in as xyz@ee.com.But if I try with xyz@ee.com ,theres a messsage that user invalid.Theres no entry in the DB for xyz@ee.com.

Post your SQL queries, lets see em. (If you can)

I think DynaForms always get "reseted" after use (maybe Im wrong), so, the value
should get stored there, at least until the next Instantiation from Struts-config..

So, next logical place to look is in the queries.

if you cant copy-paste em, at least try and explain em :D

Regards! (I leave in the office in an hour, hope t help you tomorrow, if you dont reply by then :D  )
ASKER CERTIFIED SOLUTION
Avatar of Gunt
Gunt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial