I have been programming since last 5 years. I have maintained JSPs but not written one from scratch. What I want to know is, do people first create html pages using some html editor and then convert into a JSP or they directly create JSPs. Which editor is normally used for creating JSPs in eclipse?
.... do people first create html pages using some html editor and then convert into a JSP or they directly create JSPs
JSPs generate dynamic content as oppose to HTML pages which are static. But we use HTML to display the output with JSPs so the difference is we add JSP tags (which generate the dynamic content) inside the HTML.
This message was edited 1 time. Last update was at by Vijitha Kumara
Unless you are doing it wrong -- by putting Java code in a JSP -- a JSP will look a lot like an HTML file with some special markup in the form of JSTL tags and EL expressions, and perhaps some directives at the top.
thanks for your reply. But for html I can use a lot of tools to simply drag and drop objects. For example coffeecup html editor. Can I use something similar for jsps. Or is that how people first develop their jsps?
Bear Bibeault
Author and opinionated walrus
Marshal
Drag and drop JSPs? I'd rather die than let some WYSIWYG tool write code for me!
But maybe that's just me.
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12612
posted
0
Nope, I'd let a room full of actual monkeys write my HTML before letting a WYSIWYG editor do it; easier to clean up.
(Both the code and the room.)
This message was edited 1 time. Last update was at by David Newton
Muhammad Imad Qureshi
Ranch Hand
Joined: Sep 13, 2005
Posts: 235
posted
0
So that means, all good pages that are easier to maintain are hand written. So the best way is to first design my page on paper and then write code for it?
Thanks for all your replies.
Mark E Hansen
Ranch Hand
Joined: Apr 01, 2009
Posts: 639
posted
0
There are (obviously) a lot of opinions about how you should create your JSP pages The bottom line is that you create/edit them the same way you did your HTML pages. In fact, take any HTML page and change the extension to .jsp and you have a JSP page (a JSP page doesn't have to contain any JSP/JSTL/Whatever tags).
Use what works best for you.
Bear Bibeault
Author and opinionated walrus
Marshal
Not always. Some HTML WYSIWYG tools will simply remove any JSP it finds as invalid, or worse, rearrange it so that it no longer works. Or simply crash.
All kidding aside, when it comes to the point where you are using JSP, you should be a mature enough coder to be able to code from scratch rather than relying on tools to generate code for you.
Mark E Hansen
Ranch Hand
Joined: Apr 01, 2009
Posts: 639
posted
0
I'm sorry if you think I said that all WYSIWYG editors are good. It was not my intent to imply such a ridiculous notion.
I think the choice of tool for HTML editing is a personal one. The fact that some may choose to use a WYSIWYG editor doesn't mean they are necessarily immature. I was brought up to do things without fancy editors, so that's just my personal choice. I can, however, understand how some may have been brought up using WYSIWYG and are simply more comfortable using them.
Of course, to use one that destroys JSP (or other) tags would be less than useful. I would expect that a developer choosing a tool for development would not choose one that would make the work harder.
Bear Bibeault
Author and opinionated walrus
Marshal
Aman Goel wrote:People directly write JSP pages. That's the advantage of JSP over servlet.
Servlet's has it's own lifecycle methods that can be written for us by IDE's no matter what we use that servlet for. But with modern JSPs (has it's own lifecycle methods too), with it's usage (mainly for the view) what's generated by the IDE may be useless.
This message was edited 1 time. Last update was at by Vijitha Kumara
Aman Goel wrote:Hi Guys. People directly write JSP pages. That's the advantage of JSP over servlet.
Mainly, in a servlet you write the Java code and embedded some HTML syntax in it. But with JSP you write HTML and embedded some Java code in it. Well, that's in simple language.
So in MVC, JSPs are used (and should be used) in constructing the view and Servlets are used as controllers.
So my idea is that discussing advantage of JSP over servlet is not possible because both are used in two different fields.
This message was edited 1 time. Last update was at by Ayoma Wijethunga