• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to pass the value of radio in c:if

 
Bharath Gowda
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've 2 radio buttons as defined below

td>
<input type="radio" name="search" value="person" checked="checked">Person
</td>
<td>
<input type="radio" name="search" value="group" > Group
</td>

I need to show some jspf based on the selected radio button. so i've written the code as below.

<c:if test="$(sessionScope.)"> --- what should I write here to get the session value
<jsp:include page="page1.jspf"></jsp:include>
</c:if>
<c:if test="$(sessionScope.radio.search = 'group')">
<jsp:include page="page2.jspf"></jsp:include>
</c:if>
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bharath Gowda:
I've 2 radio buttons as defined below ... I need to show some jspf based on the selected radio button
What is the relationship between the page that contains the radio buttons and the page that contains the JSTL code you are asking about?

what should I write here to get the session value
What does any of this have to do with sessions?
[ October 09, 2008: Message edited by: Bear Bibeault ]
 
Bharath Gowda
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear,

There are 2 type of search need to be performed, so I have 2 radio buttons. on click of each radio i'll show the different jspf's which has tables to show the data.

Based on the radio the user has selected during the session, I need to show the jspf. so i'm using the c:if tag to check the user selected value
 
Afzal Hossain
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI there,
you can use the following EL to the jsp:

<c:if test="${param.search=='person'}">
<jsp:include page="page1.jsp"/>
</c:if>

because from the input form you are sending the information as a request paramater. So you can use param. Hope you understand.

Hope this will help you
thanks
 
Bharath Gowda
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Afzal,

yes it works. Thank you.
 
Afzal Hossain
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are most welcome friends.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!