jsp-tags


Difference between jsp include action tag and jsp include directive


I've found that when changing an included file, if I use the include action tag, then the change is reflected in the including jsp. But if I use the include directive, then the the change is not reflected in the including jsp.
However, I've found that the change does get reflected in the including jsp whether we use include action tag or include directive.
Please show me the difference using a program.
The contents of the directives form part of the main JSP during the translation phase, ie., when the JSP is compiled in to an equivalent servlet. So the contents from the jsp included using a directive componnet are merged in to the parent jsp at the translation time which happens only once. This include directive was mainly meant to be used for addressing the headers and footers which are mostly static that doesn't get changed often.
The include action tag on the other hand is for including dynamic contents ie., you can choose to send a parameter to the tag which that tag may process and display. this is unlike the headers and footers showing the same content again and again.
Main.jsp
<jsp:include page="included.jsp">
<jsp:param name="message" value="World" />
</jsp:include>
Included.jsp
<html>
<head>
</head>
<body>
<h2>Hello <%=request.getParameter("message") %></h2>
</body>
</html>
Also what server are you using. Since Tomcat7, things have changed and the main jsp will also compile if the included jsp(by any mechanism) is changed.
this link has more details.

Related Links

JSP Custom Tag File and Dynamic attributes
Fetch drop down box multi selector
jsp code to upload jgp files and save in mysql db
when I run my jsp pgogram I got this exception error type Exception report
jstl formatNumber in input leads to NumberFormatException
Youtube onYouTubePlayerReady() function not firing
username and password cannot be resolved or is not a field
How page directive “extend” in jsp works?
Simple property not found?
Reusing JSP custom tags inside html
JSP Quiz process is not giving me the correct percentage scored
Refer the id variable of logic - iterate using jstl-el
Invalid tagdir attribute while web-fragment is used
JSP foreach tag for two variables
Adding Parameter to href tag before uri
Servlet exception stream closed jsp

Categories

HOME
pdf
wso2-am
netbeans
plot
appx
cvs
at-command
yarn
infragistics
twitter-bootstrap-4
fancybox
vault
fancybox-3
izpack
wheelnav.js
timeout
ibm-odm
jsprit
clearcase-ucm
tostring
serilog
reactive-cocoa
evopdf
interop
riot.js
scriptcs
css-animations
sqlcipher
gitignore
subdomains
procdump
gsoap
tinymce-4
preg-match-all
oracle-fusion-middleware
column-family
xmlreader
sequential
hexo
bower-install
stacked
git-merge
hot-module-replacement
webdriver-manager
splice
graphenedb
gzipstream
convertapi
smartcontracts
strptime
komodoedit
paxos
nativeapplication
pg-dump
mako
crosswalk-runtime
watchconnectivity
visual-c++-2008
android-fonts
google-feed-api
storekit
yaws
associative-array
energy
ios8-today-widget
xna-4.0
mutation-observers
citrus-pay
security-testing
android-listview
graph-drawing
skos
neolane
sgen
rebol3
system.net.webexception
meteor-velocity
message-driven-bean
imdbpy
multiprocessor
geos
cdc
soundtouch
odata4j
cassini-dev
dmoz
word-processor
php-parser
pydot
spyware
hirefire
krl
pyinotify
mozilla-prism
filtered-index
rtml
ntvdm.exe

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App