How to pass a value from one jsp to another jsp page?

前端 未结 4 1725
不知归路
不知归路 2020-11-27 06:29

I have two jsp pages: search.jsp and update.jsp.

When I run search.jsp then one value fetches from database and I store that

4条回答
  •  忘掉有多难
    2020-11-27 07:11

    Suppose we want to pass three values(u1,u2,u3) from say 'show.jsp' to another page say 'display.jsp' Make three hidden text boxes and a button that is click automatically(using javascript). //Code to written in 'show.jsp'

    
    

    // Code to be written in 'display.jsp'

     <% String u1 = request.getParameter("u1").toString();
        String u2 = request.getParameter("u2").toString();
        String u3 = request.getParameter("u3").toString();
     %>
    

    If you want to use these variables of servlets in javascript then simply write

    
    

    Hope it helps :)

提交回复
热议问题