scriptlet - The execution is repeated after refreshing the jsp page -


I am writing a jsp page that has a button and I am putting the code in scriptlet < P> Everything is good after running, but when I refresh the page, the code is run again without clicking on the button. So I want to get rid of it.

Here is my JSP code:

  & lt;% if (request.getParameter ("btnSubmit")! = Null) // BtnSubmit is the name of your button, that is not the ID of the button {string classname = request.getParameter ("testclass"); Println (className); String [] command = {"CMD", "/ c", "mvn -adat =" + classname + "test"}; ProcessorBuilder Probleor = new processbler (command); // You can set your work directory probuilder.directory (new file ("C: \\ user \\ amira \\ junoWorkspace \\ TestProjectUI");); Process process = prober.start (); // read-out DIR output is java.io.InputStream = process.getInputStream (); InputStreamReader isr = New InputStreamReader (is); Buffed reader br = new buffed reader (ISR); String line; System.out.printf ("The output of running% s is: \ n", Arrays.toString (command)); While ((line = br.readline ())! = Null {} System.out.println (line);} // Wait for the exit value {int exitValue = process.waitFor (); System.out.println ("\ N \ nThe value of the summit" is the value to exit);} Grip (Interrupted ejection) {// TODO Auto-Generated Catch Block e.printStackTrace ();}}% & Gt; & Lt ; Html: file attribute = "tonfitter" name = "tonform" /> <<> & gt; please specify a test: 
input type = "file" name = " Testclass "size =" 40 "> << p>
  • input type =" submit "id =" submit btn "name =" btn Submit "value =" execute trial "/>

    any Also, the idea will be appreciated Thanks

    I think the form method < Code> get . You must do this as the form method as POST .

      & lt; Form action = "....." method = "post" & gt;   

    is an IP address request that allows to automatically refresh the browser when

    Post non idempotent Strong> which gives the browser a pop up asking something like , do you want to submit the request again.

  • Comments

    Popular posts from this blog

    java - NullPointerException for a 2d Array -

    python - Assemble mpeg file unable to play in mediaplayer -

    c# - NameSpace Manager or XsltContent to parse aspx page -