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.
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 opinionated walrus
Marshal
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: 175
posted
0
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?
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: 12612
posted
0
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: 175
posted
0
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: 12612
posted
0
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: 175
posted
0
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: 12612
posted
0
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
posted
0
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: 15003
posted
0
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: 12612
posted
0
And make sure you post in the correct form if it's a Struts-specific question.