GeeCON Prague 2014*
The moose likes JSP and the fly likes annoying JSP error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "annoying JSP error" Watch "annoying JSP error" New topic
Author

annoying JSP error

Devin Fleenor
Greenhorn

Joined: Apr 12, 2005
Posts: 3
Hello,

I have a page that works well - until I try to do a simple

function. The actual code is:



where I am basically trying to remove any spaces in the string "STnospace".
But when I go to that page in the browser, it is giving me these errors:



Any ideas what I am doing wrong?

Thanks,
Devin
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61298
    
  66

You do realize that in Java the double quote is used to denote String literals and that the single quote is used to denote character literals?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bonagiri UmaMaheshwar Rao
Greenhorn

Joined: Mar 27, 2005
Posts: 12
you can use the following statement for your conversion.
s= s.replaceAll(" ","");
Niki Nono
Ranch Hand

Joined: Mar 20, 2005
Posts: 256
Hi devin
I guess you will have to write a small piece of code which will split the string depending on the number of spaces and concatenate the seperate strings together.
You will have to use the String.substring() and String.indexOf() in a loop and generate a new string.
Try it out.
This is one way to do it.
If there is any other way do please let me know if you come across it.


Life called,so here I am.<br />Cheers<br />Niki.:-)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61298
    
  66

I guess you will have to write a small piece of code


No, he can use the replaceAll() method as he plans. He just needs to get his syntax correct.
Devin Fleenor
Greenhorn

Joined: Apr 12, 2005
Posts: 3
Thanks all for the help, I was just coming back here to mention that I had discovered
the String.replaceAll() method and got it working.

Bear: yes, I knew that - what I didn't know is that '' isn't accepted as a character!

Niki: I think your method would be good excercise on using String.substring() and String.indexOf() - so i might try it that way even though the String.replaceAll() is much easier.
[ April 13, 2005: Message edited by: Devin Fleenor ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: annoying JSP error