masijade 1,351 Industrious Poster Team Colleague Featured Poster

A JSP will not play anything. If you know how to provide a browser with these items in HTML in such a way that the browser will play them, then you do it exactly the same way in JSP.

You can also have a servlet behind a link that masquerades as different types of media files, but, once again, it won't actually be playing anything. It will simply be designating the content-type and streaming the data out, and letting the browser decide what to do with it.

Let me put it this way, Servlets and JSP (in relation to the client/browser) do nothing except provide content and accept input. Period. They cannot pop up any windows on the client, they cannot play sounds on the client, they cannot play movies on the client, they cannot read things directly from the clients disks, etc, etc. They can only send the client data and accept requests from the client.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Post your code and we will help you correct it, but no one is just going to give it to you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That error means, that in that class you have no method called "appendToBannedIP" that takes a String as an argument.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Of course you can (and it is -9), but it's not worth it if you don't know whether or not it was already used. use split and mail it in pieces, then use join to recreate the file at the other end.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Not that I think you'll win much, but did you use the -9 option when you created the gzip file?

Otherwise, split and join.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That is, seemingly, not a publicly available ip address (i.e. can't be reached from the internet, at all), or you are attempting it to access throught the wrong interface on your computer, and so have no network path to it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Other than the fact that you shouldn't be doing this in a JSP, I don't know, since you haven't bothered to tell us what is going wrong with it, and I am not even going to attempt to guess.

What exceptions do you get?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Maybe, if you were to show what the nested exception is.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And what exactly would be the problem, other than the fact that this is JSP and should have been posted to the JSP Forum, and you are doing about every thing in a JSP that you shouldn't be.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Question 1. What if the same pattern also fits inside the "largest" pattern? i.e

pattern: A.*B
String: ABCDEFBGHIJK

Is AB matched, or is ABCDEFB matched?

Question 2:

What is th difference between 'A-Z' and '[A-Z]'? (Although there are other things in tr that should be used for this.)

Question 3:

Are you sure you copied it right as:
File substitution always happens on variable assignment.
doesn't seem right to me.

Question 4:

Knowing that handle>&handle redirects the first handle to whatever "stream" the second handle currently points to, and handle>outputStream redirects the listed handle to a newly created output stream, what do you think the answer is? Hint, the keyword in that question is marked.

Question 5:

Simply try it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

MouseListener

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Much easier, an ice-pick inserted about 3 cm into your ear in the direction of the other ear, pull it out, insert a flexible straw in its place, and you can blow your own mind.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Create two small classes and have one class call new on another class (that contains all the things you want to see) and run through the instantiation in a debugger.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

After a certain amount of time (I believe 30 min) you can't anymore.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Not urgent at all to us.

You retreive the InputStream from the response Object and use setBlob on a PreparedStatement to write it to the DB.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Here's one (as Google could have told you).

http://jtds.sourceforge.net/

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The thing is, from the way I read your post, the session will not contain any value under the key "errorcode". Therefore getAttribute("errorcode") will return null. Therefore ercode.trim() will result in a NullPointerException, therefore you need to add if (ercode != null).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yes, you can. There are JDBC Drivers available for SQL Server.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No, do not use the JDBC-ODBC Bridge. Use the actual JDBC Driver whenever there is one available.

@OP Have you configured your Windows Firewall to allow connections to that port?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Don't do other's homwowrk for them. It is against the terms and agreements you agreed to when you signed up here.

And, if you absolutely must post code, please use code tags.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm.... if (errcode != null) before the trim?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Place a reference to the applet in an html page, obviously.

http://java.sun.com/docs/books/tutorial/deployment/applet/

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Who says there is any?

I find it extremely lazy of people to expect there to be software programs that will convert code from one language into code from another. Both languages will have there own idioms, syntax, and "way of doing things", and it is almost guaranteed (regardless of which 2 languages are involved) that a "converter" program would be able to create syntactically correct, and runtime efficient code.

I have seen converters for other languages, and although they created code that was syntactically correct, it was nothing I ever wanted to actually use.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
"\\+"

instead of just

"+"

and likewise for the rest.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You shouldn't be "writing" to a DB from a JSP in the first place.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That is not everything, try again.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Look at the web applications logs for a stacktrace and a better exception message.

You should not be using scriptlets, however. Write a Bean.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

This is a servlet, not a JSP, and this sort of thing

out.println("<html>");
            out.println("<head>");
            out.println("<title>Servlet ReturnName</title>");  
            out.println("</head>");
            out.println("<body>");
            out.println(getName);
            out.println("</body>");
            out.println("</html>");

is frowned upon these days in a Servlet.

See http://java.sun.com/javaee/5/docs/tutorial/doc/

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, are you using the equals method to compare the Strings or == ? Your code might help us to guide you better.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Where is out defined?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Lets see if you can see the problem. Here is a snippet of your code

public class ChessBoard ... {
  public Chessboard() {
    ...
    brd = new GridChessBoard();
    ...
  }
}

public Class GridChessBoard extends ChessBoard ... {
  public GridChessBoard() {
    ...
  }
}

See the problem?

If not, then you really need to actually read the tutorials that we kept pointing you at when you posted at Java World.

When one class extends another (i.e. GridChessBoard extends ChessBoard), then, whenever the subclasses constructor (GridChessBoard's constructor) is called, a constructor from the super class (ChessBoard) will be called. It can be one you designate, but if you do not designate one, it will be the default constructor, i.e. ChessBoard().

Do you see the loop now?

You call ChessBoard(), it calls GridChessBoard() (which is completely wrong anyway, what the heck is a super Class doing any thing with one of the subclasses?), which calls ChessBoard(), which calls GridChessBoard(), which calls ChessBoard(), which calls GridChessBoard(), .....

Do you get the picture now?

Sheesh!

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, what's wrong with this post. Let's count the ways:

1. You use a bad title (you can use Java to search a MySQL DB, but you can't use a MySQL DB to search Java).

2. You dump a bunch of unformatted into the post (because of a very poor attempt at using code tags).

3. You provide no description, what-so-ever of what your actual problem is.

4. You say "please see attachment" with some funky symbols after it, but didn't attach anything.

5. And I haven't even started to look at the code, either (and won't).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Nevermind Wrong topic.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

There is a menu item somewhere under the browsers menus (called Java Console or something very close to that) and the printStackTrace will be printed there (if it occurs).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Don't worry too much about this guy. He has proven on another forum that he doesn't know what he is doing and either just cannot understand what you try to tell him, or simply ignores it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Posting in all caps is shouting.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

NEVER use Thread.stop(). It's extremely dangerous and will more likely than not cause very nasty things to happen.
It's deprecated for a reason you know, and that reason is that it will NOT do any cleanup.
It will kill the thread, and everything in it, now. No questions asked.
If that leaves data in an incomplete or unstable state, it doesn't care. If it leaves network or database resources open it couldn't care less. If it keeps hardware locked, waiting for commands that never can come no more, it's oblivious of that.

Yes. I know. Read again, that was suppossed to be self-written "stop" method in a class that created the thread (not the one from the thread class) designed to call interrupt on the actual thread and then perform some clean-up.

Edit: And yes, it was a very poor choice of a name, and it caused the confusion, but hey, at least I knew what I meant. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Why are you shouting? huh?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What is that trim suppossed to be doing?

a number entered like that is an int, which can't be trimmed, and getDate returns a Date, which can also not be trimmed (if that was what you meant). Neither of those are Strings, which is the Class that actually has that method.

What exactly are you trying to do?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Don't ignore errors

catch(Exception e) { }

Add a e.printStackTrace() to that catch block and check the Java Console.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

executeUpdate not executeQuery (on non-select queries)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Sorry. It's explained (better, although still not perfectly) in the next post.

The stop method should interupt this thread and perform and needed cleanup.

;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Read the MySQL manual and Google for an SQL Tutorial.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As far as the programmer making a mess of the programming, that can always happen.

And, I never said he should call thread destroy, or anything in that manner. I said to call interuppt and let the Thread clean itself up (and those actions are once again something the programmer must do), which is not, of course, deprecated.

The last paragraph, of course, is another very good option, though.

I agree, that it is not a very good idea to have a browser wait on a long running process, it would be a much better idea to have a "batch" style backend that the user can either check on at a later date, or that the backend can notify the user in some way (email, sms, etc.).

Some things cannot always be run in chunks, however. As an example, I recently had to write a Monte-Carlo financial simulation that operated on a few hundred thousand transactions, over a 10 year time period on a quarterly basis, over a minimum of 20000 iterations. The simulation could not be broken down (and still be effecient) and took a couple of hours to run. We used an event driven batch-style backend that sent an email upon completion.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Show your code (and use code tags). Also, is it a Date, DateTime, or TimeStamp field in the Database.

Be aware though, that if your calling getDate on the field, that it will return only a Date, the time will be 00:00:00.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I've never tried to do this, but I think you're going to have to track the thread ID of the long-running process

The Object that "controls" the thread is what is being stored in the session. IOW, already suggested.

and terminate that thread when the user clicks your "stop processing" button in your app.

You can't terminate a thread (you can only interrupt, i.e. signal, it and let the thread clean itself up). IOW, already suggested.

I don't think you can detect them pressing the browser's cancel button.

Already mentioned.

Also, I have never dealt with threads so I have no idea how to implement this suggestion.

Well, I don't mean to be mean, but then why post this? He has already been given a very detailed answer and this post didn't add anything, I'm sorry to say.

Aside from the fact that this thread is 2 years old.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, if it's in a production environment, it's even more important to get it upgraded.

Sun does not support that version any longer, so any problems that may occur are yours (or more correctly your company's) responsibility to fix.

Also, let it be known, that (if I remember correctly) there are security related bugs with that version.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I didn't know I had to add that (String) to it.

Well, I did tell you, twice.

Look closely at the docs for JComboBox. There is another getSelected.... method that will work (as long as the items in the JComboBox are Strings, and you cast the return Object properly) for you, find it.

Also, did you pay attention to the fact that I said you needed to do some casting?

If you don't understand something you're told (i.e. didn't know what casting was), then ask about that specifically, otherwise we're all just wasting our time here.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

replaceAll doesn't exist in 1.2.2 You can find third party libraries for it in 1.3, and as of 1.4, it is standard, but it does not exist in 1.2 (although, if you search, you may find a third party library, but, as I said, I believe that was first available 1.3).

I would seriously suggest, however, updating your jdk. Sun doesn't even offer documentation for 1.2 anymore (at least not from the Java SE documentation sites).

Why do you not want to upgrade?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm sorry, but how dense are you?

output.writeUTF((String) number.getSelectedItem());