{ test.jsp | back to index.jsp }
January 17, 2008
These are my notes as I learn JSP as a PHP developer. This is my third JSP page. (Ever.) I'll admit I know a good bit of Java, so its not hard to pick up. These notes will mainly be my "gotchas" that I run into as I convert code from one language to the other. I'm not switching to JSP for development, just expanding my horizons. In fact, the first few minutes of my JSP experience have solidified my faith in PHP as my language of choice for what I do. ;]
First, I've been reminded that Java doesn't let you use multiline string declarations in any kind of logical way. You have to end each line with its own close-quotes, add the concatenator + sign, and then start back into your string again in quotes on the next line. Watch out! If you've forgotten this, you're likely to see a lot of "unclosed string literal" errors.
So, if you used to set a variable like this:
$pageTop = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML
1.1//EN\"
\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">
<head>\n<meta http-equiv=\"Content-Type\" content=\"application/xhtml+xml;
charset=utf-8\" />
<title>";
Now you'll have the pleasure of converting it to this:
String pageTop = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML
1.1//EN\"\n"+
" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"+
"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n"+
"<head>\n<meta http-equiv=\"Content-Type\" content=\"application/xhtml+xml;
charset=utf-8\" />\n"+
"<title>";
To–Do: