Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

accessing anchor <a> value in a loop

Status
Not open for further replies.

alimirmd

Programmer
May 22, 2007
4
0
0
SA
Hi,
Well,actually,I am not sure whether I have written a correct subject or not.

Actually,I have created a JSP page,which displays records,,,,like any inbox folder,which displays a list of messages,,,, or the best example would be our forum.Here,we have a list of topics.As new topics get added,old topics move to next page.At the top,we have anchor links to different pages 1.2.3.4.5.......As we click the page number,it will take us to that page.
I want to create something like that.My code skeleton would be:

<%
for(int i=0;... )
{
%>
<a href="mypage.jsp?strr=val"><%=i%></a>
<%
String val=request.getParameter("val");
if(val!=null) // anchor is clicked
{
for(......)
{
//display records
}
break;
} // end if
} // end outer for
%>

I get the links 1,2,3,,,,.As soon as I click any link,the records of that page are displayed,,,,but the links disappear.Only link for the first page (i.e. 1) is left. Everything is o.k....But as soon as I click a page number,I get the records of that page,but the links(2,3,4,,,,,) disappear. Only link with value 1 is left.If I click it,then I go to the first page.I don't know where to put the break statement.
If I remove the break statement,,,the records of that page will b displayed and even the links won't disappear.But,as soon as I click another link, it will take me to the first page only...i.e. only the first 10 records r displayed.Only the first page appears.....

I hope I was clear.If u have any doubts,plz ask me.I will send my complete code.Even if u provide me a skeleton of how to work,I shall b very thankful....

Hope to get a reply soon.....Thanks.............
 
In your for loop, what is the termination condition?

In your above example you just say:
Code:
for(int i =0;....);

It sounds like when you view the page using the links, whatever termination condition you are using is true and the loop is never entered.

Please post your entire code but be sure to use the [ code ][ /code ] brackets.

~Ron


typedef map<GiantX,gold, less<std::shortestpathtogold> > AwesomeMap;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top