Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 2712 | Replies: 2
![]() |
•
•
Join Date: Jan 2007
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
Hi all,
I have a simple problem but a major 1 for me now...
i need to pass the selected value of radio button from 1 jsp to another jsp i.e when user selects a radio button option and then clicks on the submit button then the selected value should b passed to another jsp and should b able to display it....
plz help me out ......
ne sample code will b highly beneficial......
I have a simple problem but a major 1 for me now...
i need to pass the selected value of radio button from 1 jsp to another jsp i.e when user selects a radio button option and then clicks on the submit button then the selected value should b passed to another jsp and should b able to display it....
plz help me out ......
ne sample code will b highly beneficial......
•
•
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation:
Rep Power: 5
Solved Threads: 34
JavaScript != JSP
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
•
•
Join Date: Feb 2007
Posts: 14
Reputation:
Rep Power: 2
Solved Threads: 0
•
•
•
•
Hi all,
I have a simple problem but a major 1 for me now...
i need to pass the selected value of radio button from 1 jsp to another jsp i.e when user selects a radio button option and then clicks on the submit button then the selected value should b passed to another jsp and should b able to display it....
plz help me out ......
ne sample code will b highly beneficial......
Hai Sandeep,
I guess the following code is the answer for your question.
I have two jsp files. one is test1.jsp and another is test2.jsp.
i have radio buttons in test1.jsp file and i am trying to print the valur of radio button in test2.jsp.
test1.jsp
<%@page import = "java.io.*, java.util.*,java.text.*"%>
<html>
<head>
<script language="javascript1.1">
function validate()
{
f=document.forms[0];
alert("validate Starts");
for(var i=0;i<5;i++) {
if(f.radiobutton[i].checked) {
f.hide.value=f.radiobutton[i].value;
alert("value stored");
}
}
f.hiddenField.value="one";
return;
}
</script>
<title>Test</title>
</head>
<body>
<p> </p>
<p> </p>
<form name="form1" method="post" action="test2.jsp">
<p>
<label>
<input name="radiobutton" type="radio" value="one">
One
</label>
<br>
<label>
<input name="radiobutton" type="radio" value="two">
Two
</label>
<br>
<label>
<input name="radiobutton" type="radio" value="three">
Three</label>
<br>
<label>
<input name="radiobutton" type="radio" value="four">
Four
</label>
<br>
<label>
<input name="radiobutton" type="radio" value="five">
Five
</label>
<br>
</p>
<p>
<input name="submit" type="submit" id="submit" onclick="validate()" value="Submit">
</p>
<p>
<input name="hide" type="hidden" id="hide">
<input type="hidden" name="hiddenField">
</p>
</form>
<p> </p>
</body>
</html>
Test2.jsp
<%@page import="java.sql.*,java.util.*"%>
<%@ page import ="java.util.regex.Pattern, common.Util"%>
<%
String hide=null;
String hide1=null;
if(request.getParameter("hide")!=null)
hide=request.getParameter("hide");
if(request.getParameter("hiddenField")!=null)
hide1=request.getParameter("hiddenField");
%>
<html>
<head>
<title>Test2</title>
</head>
<body>
<form name="form1" method="post">
<input type="text" name="textfield" value="<%=hide%>">
<input type="text" name="textfield" value="<%=hide1%>">
</form>
</body>
</html>
hope so you understand.
Bye...
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode