• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jsp:param vs c:param

 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

In HFSJ page 452-453, it is shown how you can include/import pages and customise them using params.

The following code is used for the includes/imports:





My question is - what's the difference between the param tags (I understand the difference between import and include).
Are these tags interchangable? I'm guessing not - otherwise c:param shouldn't exist if it is just a duplicate, especially as jsp:param comes as standard.

Thanks in advance,

MG
 
Sheriff
Posts: 67746
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
You use the one appropriate for the containing tag. jsp with jsp, c with c.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
c:param be nested in c:import, c:url and c:redirect. jsp:param is nested in jsp:include, jsp:forward, and jsp:params. They serve the same purpose, but cannot be interchanged.
 
Mark Garland
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I always get a little suspicious when I come across duplicate code that does the same thing.

Thank you both for your replies - it's definitely been cleared up, and its one more fact for the exam (now under a week away).

Thanks once again,
[ May 31, 2007: Message edited by: Mark Garland ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Servlets have changed very little since they first came out.

JSP, on the other hand, has undergone some drastic changes.
As a result it now has one of the major drawbacks that makes Perl code difficult to maintain; there are several syntaxes for doing the exact same thing.

The best rule of thumb is "Don't mix them".
If you're starting out a new project, learn the best practices for JSP 2.0.
Use MVC to factor everything but the presentation markup out of your JSPs into servlets and beans or plain old Java ojbects (POJOs) and then use JSTL and EL to perform any branching and looping needed to work with the result objects in your pages.
reply
    Bookmark Topic Watch Topic
  • New Topic