b_suneetha Posted March 11, 2007 Share Posted March 11, 2007 hiI need a help regarding how to load other jsp page on click of a button from current jsp page.My requirement is that I have a jsp page with two check boxes and a submit button. I need to load another jsp page on clicking the submit button depending opens select check box.I m new to jspAny help will be sppreciated. Link to comment Share on other sites More sharing options...
Lepper Posted March 13, 2007 Share Posted March 13, 2007 hiI need a help regarding how to load other jsp page on click of a button from current jsp page.My requirement is that I have a jsp page with two check boxes and a submit button. I need to load another jsp page on clicking the submit button depending opens select check box.I m new to jspAny help will be sppreciated.In the onclick event of the checkboxes (or in the onclick event of your button or submit button) you can call a javascript function that changes the href of the current page with the window.location.href = "http://the_page_you_want";An example is below:<script type="text/javascript">function goToPageDependingOnCheckedCheckBox(){ if(document.getElementById('check1').checked){ window.location.href = "/someDirectoryOfMyWebServer/page1.html"; } else { //if the checked checkbox is the other checkbox window.location.href = "/someDirectoryOfMyWebServer/page2.html"; }}</script> Note that a checkbox need validations and stuff (that i didn't did because i'm lazy ) so... better use a radio and you can delete the button, and call the function when the onclick event in that radio is called.Also you can see this page for a complete reference of DOM (very useful for javascript): http://www.w3schools.com/htmldom/default.aspGood learning! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now