0

I have one jsp called "first-jsp" containing this code:

<a href="./second-jsp.jsp?id=<% out.print(id); %>"><%out.print(id);%></a>

As you can see, first-jsp "sends" the id variable to another jsp page, called "second-jsp".

From second-jsp I can retrieve its value simply using:

<% String id = request.getParameter("id");%>

I want to send the value of another variable to "second-jsp" (together with id).

Let's say I want to send the value of a String variable called "name" for example.

How the above code should be modified to achieve this?

I should be able to retrieve name similarly to id, using

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

So, I'm able to use both id and name in second-jsp.

Thanks!

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
NoobNe0
  • 385
  • 1
  • 6
  • 20

1 Answers1

0

you can pass two parameters

<a href="./second-jsp.jsp?id=<% out.print(id); %>&name=<% out.print(name); %>"><%out.print(id);%></a>
Taha
  • 1,072
  • 2
  • 16
  • 29