I have an application where user authenticate himself in first page and later on move on to other pages.
Page 1 ( Authenticate & Save the credentials in variable)
|
Page 2 - Use the saved credentials & get the respective data from DB
|
Page 3 - Use the saved credentials & get the respective data from DB
|
Page n - Use the saved credentials & get the respective data from DB
So in the first page user will be Authenticate and he can move on to next page and the url will be like this:
http:\\ controller\Action1 --> Page 1
http:\\ controller\Action2 --> Page 2
Now, I want to make sure that user will not change the URL and jump to nth page from 1st page.. like..
http:\\ controller\Action1 --> Page 1
to
http:\\ controller\Action17 --> Page 17
As we are saving the credentials and he is authenticated user he can jump to any page he want to...I want to make sure that he follows the sequence ...In one single word..I dont want user to modify the URL and jump to any page he wanted...He should only modify to jump to NEXT PAGE not to any other page..
Related
I want to display the page that the user is logging in for ...
A user has to login before viewing pages. If not, then the user is redirected to login. It is at this point I want to display the name of the page they want to go to and view once logged in.
In the session controller, under the create def - I created the following instant variable:
#intended_url = Session::get('url.intended', url('/'));
and the view page contains the following:
<h4>Sign in to go back to <%= #intended_url %>.
Unfortunately, nothing is showing up?
If you want to store anything in the session, you must do so in a controller that has access to it. This means that setting the session takes place in a controller that is for a page. You do so by
session[:page_name = #intended_id
Then you can retrieve it with
display ------> session[:page_name]
Your problem can also be solved by instead calling the controller from the page.
Controller.controller_action
This displays your controllers action name which if you follow Ruby On Rails design will be your page name.
I have a website which uses a multi-step Contour form. When the user clicks "Next" i would like to get the URL so they can return back to the same step if they have not completed the form.
At present if the page URL is http://currentsite.com/questionnaire/qa1.aspx (qa1.aspx is the page that holds the Contour form) it returns back to the same step, if i close my browser and navigate back to the samem page.
My concern here is if the user deletes their cookies this would mean they cant return to the form again by browsing to the same page.
So how could i create the URL to return the user back to the step/page on a partially submitted form?
If the user has to log in, I would recommend that you store the form information in a database, associated with their login information.
Background
I have a view page(abc.html.haml) with 2 drop down options A and B. A, B are lists which hold a set of records whose parts I am showcasing through the UI.
By default on hitting the controller#index action(called via browser url), the page populates with the records from the A list.
I then have an Ajax call which populates the same page with the records from list B, on choosing the drop down menu. Let's assume I have now moved from State A to B using the drop down option.
Issue
Once, I have the page populated with records from list B, Now, upon page refresh, My drop down menu still holds the same state 'B', but the default set of records which load from the controller#action on page refresh is from the list A(thus the state of the drop down menu should be 'A').
Any inputs on how I can get a work around for this ?
Thanks.
I am not sure if I understand your problem completely, but a few options I can think of:
Use javascript to change the URL when selections are made in the drop downs. You could add paramaters to the URL that could reflect the state of the drop downs, you could then parse these on load of the page.
Give the user a refresh button that you control, then you can send information back to the controller on refresh so that you load the right defaults.
Store the current users selections in the database via ajax calls as the user makes them. I don't know the context of your app, so I don't know how feasible this is. Then you could obviously load these on page load if they exist.
The simplest option however would be to reset all controls on page refresh, I think users expect that behaviour anyway.
I am new to struts2. I am working on the struts2 with spring application.
I developed user registration functionality. In this registration process have the 3 steps(3forms). First page is step1 contains some fields, second page is step2 contain some other fields and step3 contains some other fields.I used session map in the action class to put the all field values of all forms.After submission form in step3 it goes to call rest service and give the response.If the response is OK then i am redirecting to success page step4. In some cases if user is already exits then it gives response existed user then am redirecting to step5 page. In this page i used one message " Sorry the user is already exists" and with one link "Home Page".
I used this link <s:a id="next" href="/sample/register/user.action"> Homepage </s:a> in step5 page. After clicking on this link it goes to homepage(means step1 page) fine,but it doesn't contain user entered values. I have to maintain all field values in the step1,step2,step3 process. How to achieve this problem.
Please any one can give suggestion.
IF you are using session map to persist values being entered by the user, i believe they should be available in the session until you have not removed them from the session or session expired.more over when you do redirect a new request -response cycle started by the framework and a new value stack will be created that means all old values will be lost.
From your description i believe you are creating a wizard like functionality and if this is the case i believe struts2 provide a more elegant and flexible solution
ScopeInterceptor
This is designed to solve a few simple issues related to wizard-like functionality in Struts
Still you need to show how you trying to show the values in the form being filled by the user if something fails or when user is already exists in the system as described in your case.In this case you need to fetch object/data from the session.
I have three pages:
The first inserts some info into the DB.
The second inserts some new info into the DB, when it is requested
The third shows this information
How to notify the third page when the second updates the info?
Redirect to it from page 2 and append GET parameters such as http://www.your.url/page3?changed=true
Have a check on page 3 for parameters and behave accordingly.