Solved

to call another jsp page

Posted on 2008-10-05
7
5,979 Views
Last Modified: 2013-11-11
u have a form where it has two buttons when i click one button i have to call jsppage1 with parameter emp_name,when i click second button i have to call jsppage1 with another parameter

can anybody help[ this

i attach my program

<input type="Submit" name="Submit" value="Download By ManufacturerName">
                              <input type="button" name="ByRegion" value="Download By Region" onClick="??????">

i want to do my program the same this as submit button...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
 

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Down Load Future Electronics Data</title>
 

<script type="text/javascript" src="jquery-1.2.1.pack.js"></script>

<script type="text/javascript">

	function lookupName(inputString) {

		if(inputString.length == 0) {

			// Hide the suggestion box.

			$('#suggestions').hide();

		} else {

			$.post("fut_ele_ByManName.jsp", {queryString: ""+inputString+""}, function(data){

				if(data.length >0) {

					$('#suggestions').show();

					$('#autoSuggestionsList').html(data);

				}

			});

		}

	} // lookup

	

    function lookup1(inputString) {

		if(inputString.length == 0) {

			// Hide the suggestion box.

			$('#suggestions').hide();

		} else {

			$.post("fut_ele_ByRegoin.jsp", {queryString: ""+inputString+""}, function(data){

				if(data.length >0) {

					$('#suggestions').show();

					$('#autoSuggestionsList').html(data);

				}

			});

		}

	} // lookup
 

	function fillName(thisValue) {

		$('#inputString').val(thisValue);

		setTimeout("$('#suggestions').hide();", 200);

	}

    

      function fill1(thisValue) {

		$('#inputString1').val(thisValue);

		setTimeout("$('#suggestions').hide();", 200);

	}

    

function message(inputString)

{

  

		

			$.post("futer_excel_byRegionMain.jsp", {queryString: ""+inputString+""}, function(data){

				if(data.length >0) {

					alert(data);

				}

			);

		
 
 
 

}

</script>

	<LINK REL=stylesheet HREF="ssl.css" TYPE="text/css">

		<style type="text/css">

  <!--

    body {

    margin-left: 20px;

    margin-top: 20px;

    }

  -->

</style>

<style type="text/css">

	body {

		font-family: Helvetica;

		font-size: 11px;

		color: #000;

	}

	

	h3 {

		margin: 0px;

		padding: 0px;	

	}
 

	.suggestionsBox {

		position: relative;

		left: 30px;

		margin: 10px 0px 0px 0px;

		width: 200px;

		background-color: #3574EC7;

		-moz-border-radius: 7px;

		-webkit-border-radius: 7px;

		border: 2px solid #000;	

		color: #fff;

	}

	.suggestionsBox1 {

		position: relative;

		left: 200px;

		margin: 20px 0px 0px 0px;

		width: 700px;

		background-color: #3574EC7;

		-moz-border-radius: 7px;

		-webkit-border-radius: 7px;

		border: 2px solid #000;	

		color: #fff;

	}

	

	.suggestionList {

		margin: 0px;

		padding: 0px;

	}

	

	.suggestionList li {

		

		margin: 0px 0px 3px 0px;

		padding: 3px;

		cursor: pointer;

	}

	

	.suggestionList li:hover {

		background-color: #659CD8;

	}

</style>
 

</head>
 

<body>
 
 

		<H1>

			Download Data

		</H1>

		<BR>
 
 

	<div>

            <table width="" border="0" cellpadding="1" cellspacing="0" bgcolor="#4682b4">

		<tr>

		<td>
 

		<form >
 

		<table width="100%" border="0" cellpadding="4" cellspacing="1">

							<tr class="data1">

								<td>

									Enter the Manufacturer name:

								</td>

								<td>

									:

								</td>
 

<td>
 
 

			<div>

				

				<br />

				<input type="text" size="30" value="" name="emp_name" id="inputString" onkeyup="lookupName(this.value);" onblur="fill();" />

			</div>

			

			<div class="suggestionsBox" id="suggestions" style="display: none;">

				<img src="upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />

				<div class="suggestionList" id="autoSuggestionsList">

					&nbsp;

				</div>

			</div>

			</td>

			</tr>

			<tr class="data2">

			<td>

			Region

			</td>

			<td>

			:

			</td>

			<td>
 

<div>

				

				<br />

				<input type="text" size="30" value="" name="emp_id" id="inputString1" onkeyup="lookup1(this.value);" onblur="fill1();" />

			</div>

			

			<div class="suggestionsBox1" id="suggestions" style="display: none;">

				<img src="upArrow.png" style="position: relative; top: -999px; left: 30px;" alt="upArrow" />

				<div class="suggestionList" id="autoSuggestionsList">

					&nbsp;

				</div>

			</div>
 
 

</td>

							</tr>

								</table>

				</td>

			</tr>

			<tr>

				<td align="center">

					<input type="Submit" name="Submit" value="Download By ManufacturerName">

					<input type="button" name="ByRegion" value="Download By Region" onClick="??????">
 

				</td>

			</tr>

		</table>
 

		</form>

	</div>
 

</body>

</html>

Open in new window

0
Comment
Question by:priyapratheep
  • 3
  • 2
  • 2
7 Comments
 

Author Comment

by:priyapratheep
ID: 22647278
ans pls
0
 
LVL 2

Expert Comment

by:priya_patil
ID: 22647516
a javascript method to call another jsp on On Click event is

use onclick="location.href='jsppage1.jsp'"
0
 

Author Comment

by:priyapratheep
ID: 22647522
i want to pass parameter also

i want to pass the value of the text box

<input type="text" size="30" value="" name="emp_id" id="inputString1" onkeyup="lookup1(this.value);" onblur="fill1();" />
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 2

Expert Comment

by:priya_patil
ID: 22647557
give a name to your form tag
i.e. <form name="form1">

add javascript function

<script language="javascript">
function calljsp()
{

      //alert(" ********* "+document.form1.emp_id.value);
      val=      document.form1.emp_id.value;
      location.href="jsppage1.jsp?param="+val;

}
</script>

and call function
onclick= "javascript:calljsp()"

if you write your code inside <% %>(i.e. scriplets)
than you can directly get the parameter using
onlick="javascript:calljsp(this.form.emp_id.value)"
0
 
LVL 16

Expert Comment

by:sh0e
ID: 22647673
Missed a bracket on line 56 in function "message()":
                        $.post("futer_excel_byRegionMain.jsp", {queryString: ""+inputString+""}, function(data){
                                if(data.length >0) {
                                        alert(data);
                                }
                        }); //<--- missing bracket


//add this jQuery code to post data

<script type="text/javascript">

;$(function(){

	$("form").submit(function(){

		message($("input[name='emp_name']").val());

		return false;

	});

	

	$("input[name='ByRegion']").click(function(){

		message($("input[name='emp_id']").val());

		return false;

	});

});

</script>

Open in new window

0
 

Author Comment

by:priyapratheep
ID: 22648414
hi sh0e:

how can u call this ....can u bit explin this
0
 
LVL 16

Accepted Solution

by:
sh0e earned 500 total points
ID: 22655616
That code just works.  Copy/paste it into your web page.
It binds message() to form.submit and ByRegion.click

You need to fix your function message()
It is missing a bracket on line 56
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
get radio button vale in array 7 37
HTML page and JavaScript 2 54
angularls and plnkr 14 19
gif animation 6 21
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now