Send innerHTML text in URL in JSP
Asked Answered
S

1

6

How to send innerhtml text of a tag in url on onclick event handler in JSP page and get this value in another JSP page? Here is my code

<a href="DocumentViewer.jsp">Hello</a>

I want to send Hello with URL. Help?

Salisbarry answered 17/10, 2014 at 9:48 Comment(3)
You should write onclick event handler.Consent
how to send value on onclick handler?Salisbarry
You can do it in different ways, the most simple is to use parameter in the urlConsent
C
2

You should pass the value in URL on onclick event and get it using

request.getParameter()

in JSP page. Below is the example code

<a href="DocumentViewer.jsp?proces=something">Hello</a>

and get it in JSP like this.

String pro=request.getParameter("proces");
Cabala answered 20/10, 2014 at 8:43 Comment(1)
Thanks Lovish. It's working fine. but i want to take this value to next page also. How can i achieve it?Salisbarry

© 2022 - 2024 — McMap. All rights reserved.