John
John

Reputation: 627

Send GET parameter when a href is clicked

I have a JSP page called page1.jsp, and a second one called page2.jsp. page1.jsp has an href link as follows:

   <a id= "l1" href="page2.jsp">WhenPressedSendParam</a>

When the link above is clicked, I want to send a given GET parameter(let's say keyword=5) to page2.jsp. In other words, I want the link to open the url page2.jsp?keyword=5.

How can I do it with hyperlinks instead of forms with submit inputs?

Upvotes: 0

Views: 64

Answers (1)

George Moralis
George Moralis

Reputation: 516

You can probably do it like this

  <a id= "l1" href="page2.jsp?keyword="${example.number}>WhenPressedSendParam</a>

where example is a class with a numeric variable called number

Upvotes: 1

Related Questions