I have a web page which has a navigation menu that goes to different pages. the menu i have would be like this :
Page 1
Page 2
Page 3
Page 4
Now i am following a sequence that i have to go from page 1 to page 2 then to page 3 and so on. (NOTE : here this sequence that i am following is not from the navigation menu but from the submit button in the respective pages for example Page 1 sumbit button would go to Page 2)
What i want is when the page is loaded the Navigation menu should have only Page 1 like this :
Page 1
then when i submit and go to Page 2 the navigation menu should have :
Page 1
Page 2
And i can freely navigate to Page 1 and Page 2 from the navigation menu (I am using this method to avoid using back button) then when i submit from Page 2 to Page 3 the navigation Menu should have :
Page 1
Page 2
Page 3
And i can freely navigate to Page 1, Page 2 and Page 3 and it continues like this for all the other pages.
For this i am currently creating a session variable and using that variable i am navigating this way but I need a better way of doing this operation. What i am currently doing is this :
String pagecompare = session.getAttribute("pageValue").toString();
if(pagecompare.equals("page0"))
{
String pagevalue="page1";
session.setAttribute("pageValue", pagevalue);
}
i am using it in every page the page value changes from 1-4 @ the end of the page and this is how i am displaying :
<a href="page1.html">Page 1</a>
<%
if(pagecompare.equals("page2"))
{
%>
<a href="page2.html">Page 2</a>
<%
}
if(pagecompare.equals("page3"))
{
%>
<a href="page2.html">Page 2</a>
<a href="page3.html">Page 3</a>
<%
}
if(pagecompare.equals("page4"))
{
%>
<a href="page2.html">Page 2</a>
<a href="page3.html">Page 3</a>
<a href="page4.html">Page 4</a>
<%
}
%>
Can you please help me with finding a way to solve this problem. I do not mind if the solution be jquery.