• Post Reply Bookmark Topic Watch Topic
  • New Topic

I need help with my very first jsp

 
Ron Alby
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read the JSP tutorial, and in it they said that you could change the html extension on any html file to jsp and it should work. So, that is what I did.

Under Tomcat I changed the name of the file, and I got immediate errors:
Undefined attribute xml:lang
Missing end tag for http

Here is the offending line:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

I also get:
Undefined attribute name (gmail.com)
Undefined attribute name(mailto:someone)

Here is the offending line:
<a href=\"mailto:someone@gmail.com\">Email Me </a>

Please help ... this is a lousy way to start off with JSP's

BTW - this html file was generated by an uber-simple web design program. The program allows you to embed raw html in the code - my plan is to do the basic work in the web design program and then embed any jsp I need.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ron Alby wrote:
Here is the offending line:
<a href=\"mailto:someone@gmail.com\">Email Me </a>

What's with the back-slashes? They're syntactically incorrect.

Please show us the entire file, being sure to UseCodeTags.

Normally, HTML is just treated as template text (and ignored by the JSP processor), but if you have syntax errors that will trip up the JSP engine, of course you will have problems.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ron Alby wrote:my plan is to do the basic work in the web design program and then embed any jsp I need.

You may be disappointed in that. These programs are prone to emit crappy code, and while HTML processors in the browsers are frequently forgiving of such crap, JSP engines are not.
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ron Alby wrote:Here is the offending line:
<a href=\"mailto:someone@gmail.com\">Email Me </a>


Well, yeah, that isn't even valid HTML. It sort of looks like it was extracted from some Java code, where you have to escape quotes in string literals, but at any rate get rid of those backslashes and make it valid.
 
Ron Alby
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok - so we found the easy one ... the mail one was clearly a cut and paste error on my part.

However, nobody has spoken up about the first issue. That is not a simple cut and past error, and I'm not sure how to proceed. Here is the code again:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So take out the offending attribute then. It isn't going to make the least bit of difference anyway.
 
Ron Alby
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear - you were correct in asking for the whole file. As I was trimming it down I discovered the problem. When I remove the following comment from the code, the warnings disappear from the HTML, and the errors go away from the JSP:

<!--
Photo credits for this website's design: <http://www.albury.com/ProximityServer/sandvox_SmoothDark/Credits.rtf>
Licensing for this website's design: <http://www.albury.com/ProximityServer/sandvox_SmoothDark/License.rtf>
-->

Or, at least the warnings and errors about a non-terminated http tag. There is still the issue of xml:lang.

So, I take it that in HTML, a comment isn't really a comment.
 
Ron Alby
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah - I can run all of the generated files thru sed and clean up the issues ... I was just hoping that wouldn't be necessary.
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ron Alby wrote:So, I take it that in HTML, a comment isn't really a comment.


Not quite. In JSP, an HTML comment isn't a JSP comment. It's possible for a JSP to generate an HTML comment, so you can expect JSP to concern itself about what is inside HTML comments in its source.
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ron Alby wrote:Yeah - I can run all of the generated files thru sed and clean up the issues ... I was just hoping that wouldn't be necessary.


It looks like you've chosen to generate XHTML. And what you have there is in fact valid XHTML. However the JSP parser doesn't seem to be identifying it as XHTML; perhaps you have lost the DOCTYPE from the start of the document?
 
Ron Alby
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul

Thank you for your patience in replying to me

The top of the document is:
<!DOCTYPE html>

I have contacted the designer company and asked them to investigate. In the mean time I'm working on my sed scripts.

Thanks again.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!