Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 5th, 2004, 04:33 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default Why my jsp page is submit twice?

I have two JSP page, there are one text and one button in index.jsp,when write some information in text area and press Enter Key,this page will be submit to other JSP page named cal.jsp,and in cal.jsp will print a message "receive".when I run this index.jsp,and write some information in textarea and then press Enter Key,I found this page is submit to cal.jsp,but I found that cal.jsp print two receive,like follows:
receive
receive

It should print "receive" once,but in fact it prints "receive" twice,why occur this condition? I only submit once.
My code is follows:

index.jsp
...
<script language="JavaScript">
<!--
   function onCheck(){
    if(strIsNull(document.thisform.code.value)==true){
     alert("can't null");
     return;
    }
    else{
     document.thisform.action="cal.jsp";
     document.thisform.submit();
    }
  }

    function mykeydown() {
     var whichkey=event.keyCode;
     if (whichkey==13 || whichkey==10){
       document.thisform.action="cal.jsp";
       document.thisform.submit();
     }
    }
 -->
</script>
<form form name="thisform" method="post">
<input name="code" type="text" size="18" onkeydown="mykeydown()">
<a href="javascript:onCheck();"><img src="images/queding.gif" width="46" height="19" border="0"></a>
</form>
...


cal.jsp
...
<%
    System.out.println("receive");
%>


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
submit form and jump on previous page sanjeev jha Classic ASP Basics 0 November 3rd, 2007 06:18 AM
A single JSP page havin one submit & normal button PrincessDreamz JSP Basics 1 September 4th, 2007 07:08 AM
Blank Struts page after submit simistef Struts 2 August 28th, 2007 12:46 AM
How redirect to a new page after submit form... sevtov Beginning PHP 4 February 12th, 2007 06:49 AM
having two submit buttons in asp page and passing KGANESH2006 Classic ASP Basics 1 April 24th, 2006 09:58 PM



All times are GMT -4. The time now is 02:09 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.