aspose file tools
The moose likes JSP and the fly likes I need help with my very first jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "I need help with my very first jsp" Watch "I need help with my very first jsp" New topic
Author

I need help with my very first jsp

Ron Alby
Greenhorn

Joined: May 31, 2011
Posts: 24
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

Joined: Jan 10, 2002
Posts: 56224
    
  13

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.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56224
    
  13

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
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2

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

Joined: May 31, 2011
Posts: 24
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
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2

So take out the offending attribute then. It isn't going to make the least bit of difference anyway.
Ron Alby
Greenhorn

Joined: May 31, 2011
Posts: 24
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

Joined: May 31, 2011
Posts: 24
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
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2

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
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2

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

Joined: May 31, 2011
Posts: 24
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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: I need help with my very first jsp
 
Similar Threads
warnings in jsp files(undefined attribute name)
Argh....all I want to do is load this applet..
Issues adding i18n Chinese support to existing Struts based code
Unable to compile class for JSP (Using custom tag)
Using EL to generate attribute/value pairs inside of an XHTML element