masijade 1,351 Industrious Poster Team Colleague Featured Poster

Use ob.getClass() ? rather than T.class

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Moving this to the javascript forum.

You would have better luck on a firefox forum, maybe.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That the value for the bean class "CarBean" is invalid?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

> GlassFish is not apache's server. It is from Oracle.
And your point? Both are open source application servers that he could try.

Which we can both nearly guarantee is what the OP actually had in mind.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

tomcat is utility to connect application server to database server and apache is too but tomcat is used for more complicated application servers

?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And again, JSPs should not be performing actions. Their purpose is display, and display only. You have heard the phrase "just because you can do something does not mean that you should", right?

Doing these sorts of things in a JSP usually leads to unscaleable and/or nearly unmaintainable code.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Jasper and JavaMail (both of which would have quickly turned up with a just a little googling).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then you are getting an exception on one of those set lines that you are seemingly ignoring or you would have provided the exeption.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Tomcat is a web container, somewhat less than a full application server.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Only administrators can bind ports smaller than port 1024.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Do not use scriptlets. Scriptlets were included in the first version of JSP and quickly gotten rid of in the second. They only still exist to facilitate backwards compatability. You need to use beans, or at the very least JSTL sql tags. And JSPs should not being doing anything except displaying data, anyway. Any site request that is to actually do anything should be going to a servlet (and that should also make use of existing beans) and then, after the work is done, should be forwarding the request to a JSP to actually display the page.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That parse method is giving you a java.util.Date object, you need a java.sql.Date object in the setDate method. See the Date(long) constructor of java.sql.Date and the getTime() method of java.util.Date and use the latter as the argument in the former to get a java.sql.Date instance.

Edit: P.S. it would have helped to know the exception you were getting.

Edit Again: It is also not normal to surround the schema, table, and column names with single quotes ( ' ), although you might surround them with double quotes ( " ) if they also represent reserved words in the db.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

1.No, main thread and daemon thread are different.
2.daemon thread means it will executed continously.

All threads are executed "continuously", until the thing it is doing is finished or the thread is interrupted.

3.no
4.it doesn't require any main() method.
5.same as above
6. it will executed by using thread object..

IOW, as already said, a daemon thread is no different from a standard user thread, other than the fact that a program will not wait for that thread to finish before exiting.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well open the API docs and look at the File class. There is a method for receiving a list of all items in a directory, you know?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, where is your catch block for this, as any number of exceptions can be thrown by this code, and I have the sneaking suspiscion that you are ignoring them.

peter_budo commented: Catch block still trying to catch with rest of the code :P +16
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Of course, that raises the question of why you are using threads. I mean, if all the main program (or the thread that started that other thread) is going to do is wait until the other thread is finished, then the thread is nothing but extra overhead.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Use another loop.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Your first mistake is making this a scriptlet in a jsp. At the very least use either a Servlet or the sql JSTL tags, better would be to use some application beans. The actual error, however, means that you have an empty field in that row that you are retreiving as a String (and so results in null) and you are parsing that String to a number. Since the reference value null is not a valid String object (and even if it were the value would not be a valid number value) you cannot parse it to a number. Why do you not use getInt, rather than getString. And query the table explicitly (i.e. select col1, col2, ... rather than select *) and use a null check (in oracle it would be something like nvl(col, defaultValue), in Access I don't know and don't feel like checking).

javaAddict commented: Short but to the point +13
masijade 1,351 Industrious Poster Team Colleague Featured Poster

A daemon thread is a thread that does not need to be explicitly ended in order to end the program and it gets started like any other thread, by calling start(). See the Java Concurrency tutorials, there is a sticky thread at the beginning of this forum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I've already told you that until it compiles there is nothing to execute.

And, as far as being new goes, then you need to start with something simpler, such as the official tutorials.

stultuske commented: hear yeh, hear yeh .. +10
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Correct, the number of items in a list is one greater than the last index in the list.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because servlets/jsp/whatever are threaded and use the same instantiated class in all threads so static and instance items are shared.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

loop backwards, currently once you do removeRow(0) the former row 1 becomes row 0, then when you doe removeRow(1) (really row 2 now) the original row 3 becomes row 1, etc, etc.

mKorbel commented: that right +1 +8
masijade 1,351 Industrious Poster Team Colleague Featured Poster

don't use instance variables in your servlets.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It is strange that eclipse doesn't find any code to execute. How do you think I can possibly fix the issue?

You said that Eclipse "shows errors". Well, how do you propose that Eclipse execute anything that isn't compiled? This is not a scripting language, you know. As I said, fix those errors.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

@ Masijade, These packages and projects are from a book. Therefore, they are not written for readers to complete them; they're meant to help readers understand how an app works and play around with the code.

Okay? And? How does that change anything I said? If it doesn't compile it is not a main class. It is an attempt at a main class, but until it compiles there is nothing for Eclipse to execute.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, if Eclipse "shows that there are errors and warnings" then that class is probably not being compiled and so the project does not contain an executable main class. Fix the "errors and warnings", first.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What tags? You are not using any tags. You are using alot of scriptlets, of which you should not be using any. And, when someone is going in the completely wrong direction all you can do is turn them around, so go read that tutorial.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster

A long idle time between uses of the statement maybe? If that's case check out the session/connection timeout settings and the like for your db. Otherwise, simply catch the exception, check for this message (or, actually, the error code) and recreate the PreparedStatement.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Throw away the scriplet and read the JEE6 tutorials and learn how to do this stuff right.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, by going to the project menu, choosing properties, then going to the library tab and adding the jar?

Or going to the run menu, choosing run configurations, choosing the "task" for the class, choosing the classpath tab, and adding it?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

By simply catching IOException and using the getMessage method on the exception and the contains method on that String. You can not catch only that exception, though. If you want to make sure that the rest of the method will still continue if the exception is anything but that, then wrap just the statement that might throw that exception in its own try/catch block.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, by defining an "equals(Object o)" method in your own class?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You need to add it to the classpath in the run configurations, or as a library in the project properties. The "build path" is only for compiling, and for that you don't the MySQL driver.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I don't see (off hand) your problem, but I do have a suggestion, if you turn your if statement around, then you only have to check one condition each time (rather than two), i.e.

if (whatever >= 90) {
    // A
} else if (whatever >= 80) {
    // B
...
} else {
    // F
}

Edit: I would also strongly suggest passing the already created Scanner object to the method rather than wrapping System.in with yet another one.

Edit Again: I would, however, say to move the "studCount++" outside of the inner for loop, though.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? And what is wrong with INFO messages?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

JSP only has an effect after the submit, of course. JavaScript is your only choice.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yep, that's the other thing, using the schema/owner references. I don't know that the brackets are necessary there, and even if they are, then only around the reserved words.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Emp is probably a reserved word. Try surrounding the name in quotes or brackets (since this is an MS produced DB it might use the Access quoting process, hence the brackets).

I.E.

"SELECT * FROM \"Emp\""
// or
"SELECT * FROM [Emp]"
masijade 1,351 Industrious Poster Team Colleague Featured Poster

The system makes differntiation from an open file handle and an open socket handle. What seems to be happening here is that you are probably making a new socket connection for every communication transaction you are doing and then not closing them properly.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I think you are not using the master or the default password that is "adminadmin" .

Truth be told, I would expect a different error than "not supported" in that case.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Upgrade your netbeans?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

check the mysql "current working directoy" (although I don't believe it will be there) and try printing the Java program "current working directory" and check there.

System.out.println(System.getProperty("user.dir"));

Edit: And I have no idea what this has to do with "making a connection permananet".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Could be.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It's not really an interface. See this, section 9.2.1. It is actually the jdbc.services system property (which is can, of course, also be set in the control panel, and in JNLP and jws configurations). I swear I have read somewhere that when the manifest is set up properly that you don't even need to set that property (which is what I meant by the Services interface), but I can't, for the life of me, find it now. Maybe it was only in relationtion to JEE 6 capable containers.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What does your HTML look like? Are you using the Applet tag (which you shouldn't), or the Object tag (which is better, but still not right) or JNLP?

See this.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

registerDriver is the "old" form. The driver classes are to do that themselves when loaded (the reason for the Class.forName() call). In fact, in Java 6 and later, if the driver implements the Services interface (which it must do to qualify as a valid Java 6 JDBC driver (JDBC version 4.0, I believe) not Type 4, there is a difference between the JDBC version and the Type), you don't have to do either of those.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then you have not "included it on your classpath" properly. How did you "include it on your classpath" and how, exactly are you executing this code.