| | |
new to javascript
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2007
Posts: 6
Reputation:
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......
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:
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...
![]() |
Similar Threads
- Javascript links not working (Web Browsers)
- JavaScript's window.opener (JavaScript / DHTML / AJAX)
- recommendations for JavaScript learning resources? (JavaScript / DHTML / AJAX)
- Javascript/HTML problem!!! (JavaScript / DHTML / AJAX)
- Javascript Useful? (IT Professionals' Lounge)
Other Threads in the JSP Forum
- Previous Thread: How to send mail
- Next Thread: Combo box and Ms-access
| Thread Tools | Search this Thread |
apache backbutton combobox connection database development directorystructure dynamicpagetitles eclipse frames glassfish ie8 imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 network parameters passing ping printinserverinsteadofclient redirect request.getparameter response servlet servletdopost()readxml sessions software ssl state_saving_method stocks sun tomcat tutorial update video web






