nash avin

Ranch Hand
+ Follow
since Nov 13, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by nash avin

Thanks for the reply.The rs.getString(1) is not empty because it works when it is used all by itself



I also observed that this below code gives SQL Exception



Error:::

Error SQL: java.sql.SQLException: No data found


The complete code is given below,




Hope that you will help me out.Help would be appreciated.

Thanks
AS
16 years ago
JSP
Hi,
I was wondering why this below code dosent show anything on the web browser.Kindly let me know.



I want to get a link on each value coming from the database by this

Help would be greatly appreciated.

AS
[ July 15, 2004: Message edited by: Bear Bibeault ]
16 years ago
JSP
Hi,
If the startup console hangs then you havent set up the tomcat correctly,there is no point in using the http://localhost:8080 url.Whats the operating system you are using.
let me know
nash
17 years ago
Hi,
I want the initialization of the database i.e.,

Class.forName(DEFAULT_DRIVER);
Connection connection = DriverManager.getConnection(DEFAULT_URL);

To be done in one method (in a class) and other methods should use this connection object inside.Is it possible to do something like this.Hope that you got my question correctly.
A reply would be appreciated.
Thanks
AS
Also adding,
What will be the return type of a method that will return a connection.Let me know thanks
Hi,
Thanks for the information.I will try what you have adviced.Will keep posting.
As
17 years ago
hi,
I want to direct to another page if a user is not present in the database.How do I go about doing this.The servlet gets the username and password from the html/jsp page.
The servlet checks whether the use is present in the database,if the user and password is not present in the database,The user must be given an option for registration,a link to the register.jsp page.
Hope that I have rightly phrased the question.Hoping to hear ASAP.
Thanks in advance.
as
17 years ago
Hi people,
Thanks for your time in explaining in as much detail as possible.As Indicated I have put the necessary files in the necessary folders.
I want to know whether I have set the class path correctly.Kidly guide me in this regard
I have set my classpath as follows
E:/WEB-INF/sourcefiles
The controller and the model directories are present in the sourcefiles directory.
Hope to hear a reply as early as possible.
Thanks in advance
AS
17 years ago
Hi,
Thanks for the reply.Will find out.Ignorance can make one sweat.Will keep posting.
Thanks
AS
17 years ago
Hi,
Will let you know what I have done so far.
E:/sampleapp/WEB-INF/sourcefiles/controller/ControllerServlet1.java
/model/UserValidator1.java
I have set the classpath appropriately
ie., e:/sampleapp/WEB-INF/sourcefiles/controller
/model
This is where the class files will be stored.
I have included in the respective files
package sourcefiles.controller; in ControllerServlet1.java &
package sourcefiles.model; in UserValidator1.java
then in ControllerServlet1.java i have imported
import sourcefiles.model;
This is what I have done
I get a whole bunch of errors for this.The errors are


ControllerServlet1.java:8: package sourcefiles.model does not exist
import sourcefiles.model.*;
^
ControllerServlet1.java:19: cannot resolve symbol
symbol : variable UserValidator1
location: class sourcefiles.controller.ControllerServlet1
UserValidator1.initDatabase();
^
ControllerServlet1.java:38: cannot resolve symbol
symbol : class UserValidator1
location: class sourcefiles.controller.ControllerServlet1
UserValidator1 uv = null;
^
ControllerServlet1.java:51: cannot resolve symbol
symbol : class UserValidator1
location: class sourcefiles.controller.ControllerServlet1
uv = new UserValidator1();
^
ControllerServlet1.java:52: isValid is already defined in doPost(javax.servlet.
ttp.HttpServletRequest,javax.servlet.http.HttpServletResponse)
boolean isValid = UserValidator1.validateUser(connection, user, pass);
^
ControllerServlet1.java:52: cannot resolve symbol
symbol : variable UserValidator1
location: class sourcefiles.controller.ControllerServlet1
boolean isValid = UserValidator1.validateUser(connection, user, pass);
^



Kindly let me know what could be the error.
Your help would be appreciated.
Thanks
AS
17 years ago
Hi,te get you.Kindly let me know in as much detail as you can.
I hope the responder to this topic previously will see this message.You have written that the folder name and the package name must be the same.I didnt quite understand.
Put the servlet class and the other class in the same package,what does this mean.
Let me know.Hope to hear from you.
Thanks in adavance
AS
17 years ago
Hi,
Thanks people for your thoughts.I am a little late in replying.Will check out your point of view.
Will keep posting.
Thanks
AS
17 years ago
Thanks for the reply.But I am getting a whole bunch of cannot resolve symbols.
The code for the servlet is posted below


PS: The UserValidator1 is the class that has the methods that have to be called.
The errors I am getting are as follows


ControllerServlet1.java:15: cannot resolve symbol
symbol : variable UserValidator1
location: class ControllerServlet1
UserValidator1.initDatabase();
^
ControllerServlet1.java:33: cannot resolve symbol
symbol : class UserValidator1
location: class ControllerServlet1
UserValidator1 uv = null;
^
ControllerServlet1.java:47: cannot resolve symbol
symbol : class UserValidator1
location: class ControllerServlet1
uv = new UserValidator1();
^
ControllerServlet1.java:48: cannot resolve symbol
symbol : variable UserValidator1
location: class ControllerServlet1
boolean isValid = UserValidator1.validateUser(connection, user, pass);

17 years ago
Hi,
I have 2 java programs(one is a servlet and the other is a class file).The class file runs as an application when the main method is used.
Now I want to call the methods in this class file from the servlet.The servlet is in a folder by name "controller" and the other class file is in a folder called "model".
I want to call the initDatabase() method from the init() method in the servlet and the validateUser() method in the doPost() method.
Kindly let me know what can be done.Any help would be gr8tly appreciated.
Let me know if the codes for the respective programs are required.
Thanks
as
17 years ago
Thanks for the reply I did as you said and this is what the errors I am getting as


UserValidator1.java:80: non-static variable connection cannot be referenced from a static context
boolean isValid = UserValidator1.validateUser(connection, args[0], args[1]);
^
UserValidator1.java:84: non-static variable connection cannot be referenced from a static context
connection.close();
^



Thanks for any help
AS
17 years ago


The errors I get are as follows......

UserValidator1.java:80: cannot resolve symbol
symbol : variable connection
location: class UserValidator1
boolean isValid = UserValidator1.validateUser(connection, args[
0], args[1]);
^
UserValidator1.java:84: cannot resolve symbol
symbol : variable connection
location: class UserValidator1
connection.close();
^
2 errors
17 years ago