• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

HTML tags vs JSP tags vs Struts tags  RSS feed

 
Greenhorn
Posts: 16
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been studying these tags but am not clear with their uniqueness.
Could anyone explain me the differences among HTML , JSP and Struts tags ?
Thanks in advance    
 
Bartender
Posts: 9494
184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have examples of specific tags that you're unsure about?
 
Akshayyha Krishnamurthy
Greenhorn
Posts: 16
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, there are most tags in all the three of them like for text field in  HTML its <input type="text">, in struts its <s:textfield name="" label=""> so whats the difference between them ?
 
Bartender
Posts: 9550
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Struts textfield field is connected to the Struts framework.  If you had a textfield declared as such:

Struts will expect the Action that preceded the JSP page to have a field with the same name (and a method "getFirstName").  That way, the Action can retrieve values to set on the JSP should you be editing a known value.  Struts also adds some functionality to form tags.  For example, by default it wraps a field in table tags, which is useful in typical use cases.
See the Tag Syntax  and the Tag Developer's Guide for more information.
You can use regular HTML tags with Struts but I believe you have to jump through some hoops to get the framework to recognize the field when it is submitted.
 
Bartender
Posts: 19993
95
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hypertext Markup Language (HTML) is defined by the Internet Engineering Task Force (IETF) by a set of IETF Request For Comment (RFC) documents. For example, HTML 2.0 is defined by RFC1866. There are superceding RFCs such as those for HTML4 and HTML5, and I'll let your search engine be your guide on them.

JSP tags are defined as part of the J2EE and later JEE standard specifications. Originally by Sun, later by Oracle, and now, I suppose by Apache Jakarta.

Struts tags are define as part of the Struts documentation. Struts, unlike HTML and JSP does not have a major industry group behind it (unlike JavaServer Faces, which is also part of the JEE standard specs). However, it does have a robust defining community of its own.

Functionally, HTML is primarily designed to provide presentation and layout of a document with (optionally) GUI controls on it. HTML was originally pretty sloppy, with no standard quoting character (either single or double quotes allowed), case-insensitive tags, and no rigour in whether a given element was properly terminated. A variant of HTML is xhtml, which is defined as requiring XML constraints: case-sensitive, uses double-quotes as its attribute delimiters and requires that all elements be either self-terminated (<X/>) or terminated by a matching close tag (<X></X>).

JSP tags provide directives to the Java web application container and allow access to JEE objects such as the HttpServletRequest and session-scope objects. They act essentially as an extension to the HTML tags, since HTML knows nothing about J2EE/JEE. JSP tags require strict (XML-style) syntax, I believe. There are also other JSP markups like scriptlets (which should be avoided) and meta-information like tag library definitions that use a special syntax such as "<%". <br />
JSP tags are likewise extendable. In addition to the built-in tags, there are standard functional tagsets, such as the Java Standard Template Language (JSTL), which allows defining "looping" and conditional constructs, in addition to other, (sometimes questionable) abilities.

You can also define your own custom JSP tag libaries.

In fact, Struts is built on a set of Struts custom JSP tag libraries in conjunction with a controller servlet and various utility base classes and interfaces. The Struts tags allow more of an automated Model/View/Controller operation (technically, they call it Model 2) and define smarter GUI controls.

JavaServer Faces (JSF) took that one step further and made it into full MVC with POJOs for model objects and validators for input data. JSF was designed in part by some of the people who created Struts and wanted to remedy some of the more annoying aspects of Struts. JSF originally also was built using custom taglibs, but JSF version 2 changed the View Models from JSPs to templates (data) and the templates are compiled to create JSF control structures instead of servlets. To the GUI designer it wasn't that much of a change, but internally it was radically different. JSF was also designed with the idea that other target formats besides HTML should be possible, but this hasn't been exploited much so far.

All of the JSP and Struts (and JSF) tags are abstractions. Only HTML tags are understood by web clients (browsers). So the JSP and Struts rendering mechanisms are responsible for converting the JSP, custom, and Struts tags to standard HTML (or xhtml).
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!