• Post Reply Bookmark Topic Watch Topic
  • New Topic

Writing JSP from scratch

 
Muhammad Imad Qureshi
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Vijitha Kumara
Bartender
Posts: 3952
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.... 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Muhammad Imad Qureshi
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.)
 
Muhammad Imad Qureshi
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like we are all in violent agreement.
 
Aman Goel
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys. People directly write JSP pages. That's the advantage of JSP over servlet.
 
Vijitha Kumara
Bartender
Posts: 3952
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ayoma Wijethunga
Ranch Hand
Posts: 38
Firefox Browser IntelliJ IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!