• Post Reply Bookmark Topic Watch Topic
  • New Topic

passing Parameters to Jsp page.  RSS feed

 
Pankaj Shet
Ranch Hand
Posts: 320
Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

We all know, we can pass parameters to servlets using init param and context param attribute in Deployment Descriptors.
but I am unaware of the same using JSP.

Can anyone help me for passing parameters to JSP.?

Thanks,
-Pankaj.
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Shet,

All your context params are available to JSP in the same way as they are available to your servlets :) e.g if you have a context param with the name myParamName then it can be accessed in your JSP with the expression ${myParamName}.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saif Asif wrote:if you have a context param with the name myParamName then it can be accessed in your JSP with the expression ${myParamName}.

That is not correct. Context parameters are not directly referencable in that way.

They can be obtained as members of the initParam implicit map. E.g. ${initParam.myParamName}
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
Saif Asif wrote:if you have a context param with the name myParamName then it can be accessed in your JSP with the expression ${myParamName}.

That is not correct. Context parameters are not directly referencable in that way.

They can be obtained as members of the initParam implicit map. E.g. ${initParam.myParamName}


Oh yes Bear , ( stupid me :mrgreen: ) I forgot to mention about the map initParam as well. Thank you for correcting me.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!