This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes submit button is not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "submit button is not working" Watch "submit button is not working" New topic
Author

submit button is not working

Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
Hiiiiiii Freinds......I am a newcomer in the field of JSPs and Servlets.I am developing a web application and having a problem in forwarding control from one page to another page
welcome page of my application is index.jsp which is divided into three frames one frame is reserved for taking user input details i.e. username and password.after clicking upon submit button control should go to loginhandler.jsp after that a page welcome.jsp should open with welcome, username printed over it.
But i have a problem, upon clicking the submit button nothing is happening.What is the problem behind?please help me!
I am attaching code snippets with message.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4646
    
    5

Are you placing the Submit button inside a HTML <form> set? With the proper Action and Method values?

I recommend using Firefox with HttpFox plugin, it really helps see what is going on, which method you are using, paramtees, etc.
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

You aren't attaching any thing.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Don't attach anything, use code tags, and include the relevant configs/code.
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
i have written about attachments but havn't attached anything.oops
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
index.jsp


login.jsp


loginhandler.jsp
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
now plesse reply!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Can you see that the formatting didn't work? Please edit your message to properly indent your code and remove the color/size tags.

Your form doesn't have an "action" attribute. (Or a closing form tag.)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

Nothing to do with JSP -- moved to the HTML forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
thank you for suggestions freinds!
i have edited the code for loginhandler.jsp,i application is in development mode and i am checking database connectivity at primary level....i want to knowthings like database beans are required at this level or not?
submit button is working now but even after entering the correct login details loginfailed.html page is openning!
formatted codes are given below

login.jsp

loginhandler.jsp

welcome.jsp




loginfailed.html




Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

Do you really not indent your code?
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
sir,i am unable to understand how code would ne indented at javaranch?please tell clearly?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

Use code tags and indented code and the indentation will be preserved.
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
but i have used them........i am really confused how to indent them further.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

Adding code tags after you've lost the formatting won't help. If you use code tags and put formatted code between them, the formatting will be preserved.
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
please don't keep aside my queries and questions.i am looking for someone who can resolve them out after looking up the code thoroughly as i am not able to understand how indentation would be done?reply please?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

It's hardly surprising that things don't work. You have scriptlets in your JSP -- that's a bad thing. Not only that but you have your JDBC connection hard-coded in those scriptlets -- that's not a very good idea. Not only that but you are trying to use the JDBC-ODBC bridge and there's a good chance you haven't configured an ODBC data source on the server where the JSPs are running.

Anyway it might well be that one of your JSPs is throwing an exception. Have a look in the server logs to see if that's the case.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Ankit Tripathi wrote:please don't keep aside my queries and questions.i am looking for someone who can resolve them out after looking up the code thoroughly as i am not able to understand how indentation would be done?reply please?

The thing is that unindented code is unnecessarily difficult to read: you're a *lot* more likely if you put the effort in to make things as easy as possible to help you.
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
I have separated the business logic and view.but this time i am getting a new error-
/loginhandler.jsp(4): class 'com.mycompany.login.Login' could not be loaded
probably occurred due to an error in /loginhandler.jsp line 4:
<jsp:useBean id="idHandler" class="com.mycompany.login.Login" scope="request" />

i am using weblogic 8.1 and oracle database server.codes for JSPs and bean class are given below-

login.jsp

loginhandler.jsp

welcome.jsp

Login.java







David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Looks like a deployment issue, perhaps.

Seriously--indent your code. You're not likely to get much help if it's difficult to read.

Also, I'm not sure those sendRedirects will work since you'll have already written to the response.
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
seriously i am trying to keep my code as clear as possible.
what is the meaning of first and last sentences?pease explain clearly?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Ankit Tripathi wrote:seriously i am trying to keep my code as clear as possible.

Then indent it. Indentation indicates structure. Structure is important. Code is needlessly difficult to read without structure.

what is the meaning of first and last sentences?pease explain clearly?

You can't send a redirect after you've already written to the response (like with HTML).
tarun saha
Greenhorn

Joined: Mar 23, 2010
Posts: 27
hi,

i used javascript to focus() on the required field and it is working with <input type="text" name=... onchange=...> and similarly with <html><form></form></html>

but it is focusing something else when I am using <html:form...> and <html:text...>

please help me on this.

Thanks in advance for any help.

Regards.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
arun saha,

Why did you hijack this old thread. Post your question in your own thread.

Eric
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

And make sure you post in the correct form if it's a Struts-specific question.
 
jQuery in Action, 2nd edition
 
subject: submit button is not working
 
Similar Threads
JSF Page Navigation Problem
Post Production Problem ActiveX JavaScript - Urgent!!
Calling Html file from a servlet
Pop window in HTML
problem when visiting same page again