Search code examples
jspurlonclicksendinnerhtml

Send innerHTML text in URL in JSP


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?


Solution

  • 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");