i have a jsp page which have a some school names link. when i click to link of a school name, school name are appended to a link that will go to a second page.
in this second page have same item which i will use same for all school. i want to know how to attach a request parameter in a link using in second page which appended from first page so that i can access navigate the data based on school name.

please suggest.

Recommended Answers

Your question doesn't make much sense but I will give you an example in case it helps:

PAGE 1:

<a href="page2.jsp?name=someSchool&address=someA&number=11">Link in page 1</a>

PAGE 2: (page2.jsp)

<%
String name = request.getParameter("name");
String address= request.getParameter("address");
String number= request.getParameter("number");
%>


<a href="page2.jsp?name=<%=name%>&address=<%=address%>&number=<%=number%>">Link in page …
Jump to Post

All 2 Replies

Your question doesn't make much sense but I will give you an example in case it helps:

PAGE 1:

<a href="page2.jsp?name=someSchool&address=someA&number=11">Link in page 1</a>

PAGE 2: (page2.jsp)

<%
String name = request.getParameter("name");
String address= request.getParameter("address");
String number= request.getParameter("number");
%>


<a href="page2.jsp?name=<%=name%>&address=<%=address%>&number=<%=number%>">Link in page 2</a>

Inside the <%=%> you put the java variable. You can name the variable whatever you want. But inside the request.getParameter("") you must put as String what you used at the link as name of the parameter:

?name=someSchool
request.getParameter("name")

thanks for giving answers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.