JSPs should only be used for display purposes in Web Applications, kind off like swing and AWT are used for the User Interface. Your actual programming logic should be written in normal Java class, to the methods of which you will pass your parameters (in this case the word to be scrambled) and they will return back the result. So never put your programing logic inside a JSP.
For this small assignment of your you may think the above advice is an overkill but its always better to start using the right approach as early as possible.
By checking out your code I suggest you use consistent indentation. There are some places where you have indented correctly whereas at other places you have just conveniently just forgotten about it. You can read
here about the code conventions recommended by Sun while programming in Java.
Also look at the following piece of code:-
target and
guessed are both String objects. The
== operator for in case references to objects checks if
target and
guessed both point to the same String object. So
guessed == target would evaluate to true only in the following case : -
target = new String("jack");
guessed = target;
if (guessed == target){
But you need to check if the contents of the two strings
target and
guessed are the same. So for that you need to use the
equals() method of the
String class (or
equalsIgnoreCase() if you do not wish to consider the case), So the above statement should then be :-
if (guessed.equalsIgnoreCase(target)){
There might be a few more problems in your JSP but I suggest you at least implement what has been mentioned here for a start.