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

Servlet exception stream closed jsp
creating and exporting a csv from Display tag table
bean write to number type id
restrict image file size in alloy UI
The function getContextPath must be used with a prefix when a default namespace is not specified
how can i retrive parameters from EncodeURL using jsp?
onclick tag giving error in h:commandLink
Displaytag - How to pass hidden value in url?
Embedding Tag Files in a JAR
Errors when the compiler is trying to build a custom JSP tag based on an Java Bean
Creating nested custom tag using jsp2 tag files
Unable to access session on JSP
Dealing with <html:options>
No tag “tableFacade” defined in tag library imported with prefix “jmesa”
how to refer values of one jsp file to other jsp
incorrect username and passwords

Categories

HOME
maven
netsuite
server
comparison
react-virtualized
relay
razor
jpeg
webpack-2
retrofit
azure-media-services
applepay
facebook-php-sdk
vifm
tomcat6
here-api
midi
kentor-authservices
collectd
google-cloud-ml
fallback
quickfix
normalizr
kryo
cloudhub
sylius
kvc
restful-authentication
centos6.5
facet
dbclient
jspm
srcset
instant-messaging
bosh
yadcf
ioio
perlin-noise
ghost4j
http-digest
vxworks
jquery-bootgrid
multilingual
unobtrusive-validation
opshub
temporary-files
galen
sfdc
quadratic-programming
convertapi
angular2-meteor
scorm
dandelion
ionicons
dotnetzip
powercli
worker-thread
feeds
gcsfuse
spring-mongodb
titanium-android
minimization
topbeat
ado.net-entity-data-model
firebaseui
gstreamer-0.10
essence
ipconfig
asp.net5
two-factor-authentication
wapiti
quicklisp
php-ci
interrupted-exception
ng-animate
socketexception
valueconverter
xceed-datagrid
openlaszlo
access-rights
rabl
comaddin
orchardcms-1.7
hosts-file
objective-c-2.0
coercion
django-tagging
actionview
mozilla-prism
dbal
ncqrs
audio-capture
microsoft-virtualization
ti-dsp
sustainable-pace
text-coloring
dbisam
windows-live-messenger

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