Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

java servlet problem in java script.?

Posted on 2003-04-01
9
Medium Priority
?
1,295 Views
Last Modified: 2012-06-21
hi everyone!
the problem is that i want to call a servlet from a java script code ..
in the jav script i've written the function which is called on the onclick event of submit button.
iam not able to to get my servlet page from that function call.
plz help me out .
the code is like this..
<script>
        function submit_db()
        {
        }
</script>

<input type="submit" value="Submit" onClick ="submit_db()" name="B2">    
what do i write in the function submit_db() to call my servlet
0
Comment
Question by:ombhai
8 Comments
 
LVL 4

Accepted Solution

by:
thanassis earned 252 total points
ID: 8245553
put an action at your form e.g:

<form name="form1" method="post" action="step2.jsp">
...
<input type="submit" value="Submit" onClick ="submit_db()" name="B2">    

...

and in your script

<script>
       function submit_db()
       {
         document.form1.submit();
         return true;
       }
</script>

0
 
LVL 5

Expert Comment

by:burtdav
ID: 8245583
you shouldn't even need the onClick or submit_db()
0
 
LVL 6

Assisted Solution

by:jarasa
jarasa earned 248 total points
ID: 8246247
Well if you have a form with some Input values wich you want to send to your servlet you should put and Action on the form pointing to the servlet and then call the submit() from the script as thanassis said.

If you just want to call the servlet with no form just make your validations on the script and redirect the URL from the script:

<script>
fuction sendRedirect() {
//Validations
.....
//Redirection
Document.location.href="your servlet address"
}
</script>

Have fun
Javier
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:ombhai
ID: 8250738
thanks a lot the problem is solved
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 9400225
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

<note>
Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp


Cd&

0
 
LVL 5

Expert Comment

by:burtdav
ID: 9401708
To me, ombhai's final comment suggests that an A grade should be given. I think jarasa's answer is best.

Recommendation: award A grade to "Comment from jarasa  Date: 04/01/2003 07:14AM PST"
0
 
LVL 6

Expert Comment

by:jarasa
ID: 9403966
Hi.

I should ask ombhai how did he solved his problem I guess thanassis aswer is as valid as mine and his/her asnwer was before mine.

Javier
0
 
LVL 6

Expert Comment

by:Programming_Gal
ID: 9712121
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split between jarasa and thanassis

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Programming_Gal
EE Cleanup Volunteer
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question