wood burning stoves 2.0*
The moose likes Servlets and the fly likes JSP's & HTML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP Watch "JSP New topic
Author

JSP's & HTML

Mike Cunningham
Ranch Hand

Joined: Nov 14, 2000
Posts: 129
I've read that a limitation with JSP's is that you have to insert all of the HTML in with the JAVA code. Is there a way to integrate JSP's with HTML generated from an HTML editor such as Dreamweaver? I'm just looking for the easiest way to put the JSP's together.
Thanks,
Mike
Yamuna Pattathil
Greenhorn

Joined: Dec 03, 2000
Posts: 19
I believe what u said is not correct and is a fact about servlets. Using jsp we can just use plain html and java code is written within scripting elements
Dustin Marx
Ranch Hand

Joined: Mar 06, 2001
Posts: 40
You could actually have a JSP with only HTML in it (but with a .jsp extension) and it would work. So, really, what some people don't like is the mixing of Java directly inside this HTML with scriptlets or expressions. To get around this, JavaBeans can be used in conjunction with <jsp:useBean>, <jsp:getProperty>, and <jsp:setProperty> to move some of the Java syntax out of the JSP and into JavaBeans. Custom tags can also be utilized by writing Java class handlers that incorporate much of the Java functionality that would otherwise have been mixed with the HTML in the JSP.
If you are not worried about maintainability (such as for a class project), it is probably easiest to just write the HTML and incorporate Java where dynamic behavior is needed using scriptlets and expressions.
sachin dabhade
Ranch Hand

Joined: Mar 10, 2001
Posts: 73
what you said is true for servlets and not for jsp.
in servlets you have to embed the html tags in your java file.
about jsp you can use html and jsp altogether to give the dynamic effect where you want and static else where.
sachin
Mike Cunningham
Ranch Hand

Joined: Nov 14, 2000
Posts: 129
I appreciate all the replies. I've primarily used JAVA with a few servlets...so I'm pretty new at it.
Originally posted by Dustin Marx:
You could actually have a JSP with only HTML in it (but with a .jsp extension) and it would work. So, really, what some people don't like is the mixing of Java directly inside this HTML with scriptlets or expressions. To get around this, JavaBeans can be used in conjunction with <jsp:useBean>, <jsp:getProperty>, and <jsp:setProperty> to move some of the Java syntax out of the JSP and into JavaBeans. Custom tags can also be utilized by writing Java class handlers that incorporate much of the Java functionality that would otherwise have been mixed with the HTML in the JSP.
If you are not worried about maintainability (such as for a class project), it is probably easiest to just write the HTML and incorporate Java where dynamic behavior is needed using scriptlets and expressions.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JSP's & HTML