• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Complete JSP Noob - Guide Info Please

 
Ranch Hand
Posts: 488
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Been using J2SE for a while not and I'm just getting started in J2EE. I just designed my first website by hand using html, htpl, and css. I'd like to try adding some type of JSP or JSF to the site. Not sure what I'll have it do yet. Does anyone have any good guides for making my first JSP? Also, preferably I need it to include html examples on how messages are sent from the html (using forms I take it) to the JSP and handled, etc. Something extremely simple please, like I said, I am a complete web developer novice!

I know I can do a web search, but I find much better information from you guys that have already tried/used it.

Thanks a ton in advance.
 
Brian Legg
Ranch Hand
Posts: 488
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just noticed the JSP FAQ section at the top of the forums. I think I will start there for now unless anyone has any good guide links.

Thanks!
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Be sure that whatever resources you use are up-to-date and avoid JSP scriptlets. The modern standard is to not put Java code in JSP pages, and to focus on using the JSTL and EL.

You might also want to read these JavaRanch Journal articles:

The Secret Life of JSPs

The Front Man

Avoid JSF for now (or in my opinion, forever) -- it'll just confuse you.
[ December 22, 2008: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You said:


The modern standard is to not put Java code in JSP pages, and to focus on using the JSTL and EL.



Is it ok to add javascript? I find there are many things that seem to only work with javascript in a JSP. For example, dynamically changing selection options depending on the choice the user makes in prior selection choices. If there is a Java way of doing this kind of thing I would be happy to give up dependence on javascript.
 
Brian Legg
Ranch Hand
Posts: 488
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear!! I'm sorry to hear about the JSF's... those were going to be my next target area for study. I thought using JSF's with Struts was considered "standard" these days?

Well, I want to get a feel for how to do most of these things the "hard way" first so that when I go to using Struts, Spring, or Stripes I can appreciate what it is they are supposedly making easier.
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Dan Walin:
Is it ok to add javascript?

Java != JavaScript

If there is a Java way of doing this kind of thing I would be happy to give up dependence on javascript.

Any Java executes on the server in order to format the HTML page to be sent to the client,. Remember, JSP is a server-side concept. Once the page leaves the server, it's just HTML.
[ December 22, 2008: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Brian Legg:
Thanks Bear!! I'm sorry to hear about the JSF's... those were going to be my next target area for study. I thought using JSF's with Struts was considered "standard" these days?

You'll no doubt find other opinions, but I think that JSF is a steaming pile that should never have survived the conceptual phase. If you like to build 5-ton machines full of gee-gaws in order to wipe your mouth with a napkin, JSF may be for you. Personally, I like to use the simplest tool that gets the job done.

Sun's pushing JSF hard, That doesn't make it good.

Well, I want to get a feel for how to do most of these things the "hard way" first so that when I go to using Struts, Spring, or Stripes I can appreciate what it is they are supposedly making easier.

Very wise. Understanding the underlying principles will help you decide what's a useful tool, what's hype, and what just gets in the way.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Brian Legg:
[QB]Thanks Bear!! I'm sorry to hear about the JSF's... those were going to be my next target area for study. I thought using JSF's with Struts was considered "standard" these days?

Those are competitors, so I don't understand how you would use them together.

JSF is great, but you shouldn't start using it before you've a good grasp on JSP/Servlets. Also, you shouldn't be using a visual editor (Netbeans/Visual Studio) to drag'n'drop JSF components at all. Those editors ships with the Woodstock component library which is simply horrible. Dragging'n'dropping would also only lead to more confusion and trouble for newbies, because you won't be able to understand the autogenerated code as long as you don't have a good grasp on JSF (and you get that only by actually understanding it and being able to write it yourself).
[ December 22, 2008: Message edited by: Bauke Scholtz ]
 
Brian Legg
Ranch Hand
Posts: 488
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the replies all.

"Those are competitors, so I don't understand how you would use them together."

Everything I've read so far on JSF says that they were designed to be used with Struts and they are not competitors at all. This is coming from multiple IBM sources, so you may want to double check that. They do state you can use one or the other but... well, here is a direct quote:


The Struts framework is an open source framework for building Web applications just like the JavaServer Faces (JSF) technology. Both frameworks are intended to help developers apply the Model-View-Controller pattern for Web application architecture.

The Struts-Faces integration library allows developers to use Faces UI components at the front end of their applications, while still allowing the familiar controller function and flexibility of a Struts application. This gives developers the ease of the Faces event listener programming model, the richness of the Faces UI component libraries, the flexibility and control of Struts navigation control, and the power of the Struts validation framework.

When it comes time to decide which framework to use when developing your applications, the choice between JSF and Struts is not mutually exclusive. They are actually intended to be used together effectively in a variety of ways.



As for the comment about using editors, I completely agree! I don't use any drag-drop programs or make-your-life-easier technologies until I do it the hard way and understand it first. Otherwise when you move to a new technology that doesn't support the make-it-easy tools then you have no idea what your doing. My website so far is 100% hand coded, not counting copy/pasting lol.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Brian Legg:

Everything I've read so far on JSF says that they were designed to be used with Struts

Nonsense. They may be able to work seamlessly together, but JSF is certainly not designed for that.
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wouldn't touch either with a ten-foot pole, but yeah, JSF, a J2EE standard, was not designed to sit atop Struts, a 3rd-party open-source project.
 
Legend has it that if you rub the right tiny ad, a genie comes out.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic