Note that there are some explanatory texts on larger screens.

plurals
  1. POhide the data in the url using servlet
    primarykey
    data
    text
    <p>I want to hide the url data from the user by using servlet but i didnt get any solution.please anyone resolve this issue</p> <p>Here i am using three files.</p> <p>First i am calling servlet by using the java script in the jsp file.Here is the javascript code:</p> <p>reports_arb.jsp:</p> <pre><code>&lt;html&gt; ... &lt;script&gt; .... .. function generateReport(){ if(role=="dg") { var depts=win.depts.value; var usercode=win.users.options[win.users.selectedIndex].value; if(usercode=="0") { return false; } } else if(role=="depthead") { var usercode=win.users.options[win.users.selectedIndex].value; if(usercode=="0") { return false; } }else if(role=="us"){ var dg=win.dg.value; var depts=win.depts.value; var usercode=win.users.options[win.users.selectedIndex].value; if(usercode=="0") { return false; } } else {alert("user"); var usercode=win.logusers.value; alert(usercode); } url="RedirectServlet?&amp;FD="+FD+"&amp;TD="+TD+"&amp;actionid="+status+"&amp;usercode="+usercode+"&amp;action=reports"+""; window.open(url, '_blank', 'toolbar=no,menubar=no,width=300,height=400,resizable=no,scrollbars=no'); return true; } } &lt;/script&gt; .... ... ... .. &lt;button style="width: 135px; height: 25px;cursor:hand;" onClick="generatereport();"&gt; ..... &lt;/html&gt; </code></pre> <p>Second i am getting the values which are passed in the url into the servlet:</p> <p>RedirectServlet.java</p> <pre><code> //Getting values from Reports_arb.jsp String Fromdate=request.getParameter("FD"); String Todate=request.getParameter("TD"); String status=request.getParameter("actionid"); String usercode=request.getParameter("usercode"); //placing given values in a session request.setAttribute("FD", Fromdate); request.setAttribute("TD", Todate); request.setAttribute("actionid", status); request.setAttribute("usercode", usercode); //Redirecting to showReport_arb.jsp //response.sendRedirect("showReport_arb.jsp"); request.getRequestDispatcher("showReport_arb.jsp").forward(request, response); </code></pre> <p>third thing is iam getting the above values into the jsp:</p> <p>showReport_arb.jsp:</p> <pre><code> String FD=request.getAttribute("FD").toString(); String dtArray[]=FD.split("-"); FD=dtArray[1]+"-"+dtArray[0]+"-"+dtArray[2]; / /System.out.println("FD is---"+FD); String TD=request.getAttribute("TD").toString(); String dtArray1[]=TD.split("-"); TD=dtArray1[1]+"-"+dtArray1[0]+"-"+dtArray1[2]; //int actionto=Integer.parseInt(request.getAttribute("actionto")); int actionid=Integer.parseInt(request.getAttribute("actionid").toString()); int usercode=Integer.parseInt(request.getAttribute("usercode").toString()); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload