This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Question in including a jsp in another jsp  RSS feed

vjy chin
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am including a jsp inside another jsp.

Assume that top.jsp is included in all other jsps. In the top.jsp I am having some parameters, that the user will select for searching. So the first time, the user has to use the select button in the top.jsp to go to the results. From there only other pages are accessed.

Ok, my question is will I be able to get the selected values from top.jsp in the 2nd or 3rd jsp's without using hidden variables in the subsequent pages.

For eg
First the user gets a.jsp which includes top.jsp and nothing else. SO he selects some parameters
So the next page b.jsp displays the results (this also includes top.jsp). Here I am getting the selected values.

Next the user selects a record from b.jsp without clicking the search button in top.jsp and the results are displayed in c.jsp (this also includes top.jsp). But here I am not getting the selected values without having a hidden variable in b.jsp.

Why is it so?

Any help would be appreciated. Thanks
Jeanne Boyarsky
author & internet detective
Posts: 37230
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are two ways of passing data: hidden parameters and attributes. When the user clicks the search button in top.jsp, you have to use the parameter approach to know what was selected. Similarly, when the user clicks on a record in b.jsp, you need to use a parameter to know which one was clicked.

What you don't need is to keep passing along the parameters for what was originally selected in top.jsp. You can store this information in the HttpSession and access it on a later JSP.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!