0

Hi,
i want to call another jsp from a jsp.lets say one.jsp and two.jsp. So one.jsp has a form. two .jsp need to get that values from one.jsp.

Can 'request.getparameter()' be used in two.jsp to get the parameters sent by the one.jsp.please can any one help me?
this is my two.jsp

<%@ page language="java" contentType="text/html"%>
<jsp:useBean id="crt" scope="session" class="beans.MyShoppingCartNew"/>
<html>
<head>
<title>Cart Items</title>
<SCRIPT type=text/javascript> 
	function checkForm( )
	{
		ccv = document.getElementById('ccv').value;
		
			if ( ccv.length == 3 && !isNaN( ccv ) )
			{
				return true;
			}
			
			else
			{
				alert( 'Please enter in your CCV number.' );
				return false;
			}
	}
</SCRIPT>

</head>
<body bgcolor="#EF8428"  onload="load1()">
 <HR width="1200" color="red" noshade>
		<table align="right" border="0" cellpadding="10" >
			<tr>
		 		<th size="200px" bgcolor="khaki"><a href="Login.html"> Sign In </a></th>
				<th size="200px" bgcolor="khaki"><a href="MenuList.html"> Register </a></th>
			</tr>			
		</table>
		<table border="0" cellpadding="10">
		   	<tr> 	
		    	<th size="200px" bgcolor="khaki"><a href="welcome.html"> Home </a></th>
            	<th size="200px" bgcolor="khaki"><a href="MenuList.html"> Menu </a></th>		 
			</tr>		
		</table>	
		<HR width="1200" color="red" noshade>

 <% String fname=request.getParameter("FName");
    String sname=request.getParameter("SName");
    String phone=request.getParameter("Phone");
	
	String email=request.getParameter("Email");
	String address1=request.getParameter("Address1");
	String street=request.getParameter("Sreet");
	String address3=request.getParameter("Address3");
	String area=request.getParameter("Area");
	String ddate=request.getParameter("Ddate");
	String dtime=request.getParameter("Dtime");
	
	crt.CusDetails.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
	int crt=crt.getcost();
	%>
<FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">
	<input type="hidden" name="totCst" value="<%=cst%>"> 
<H1 align="center">Credit Card Details</H1>
<P align="center">You will be charged <STRONG><%=cst%></STRONG></P>
<P align="center"><FONT color=red></FONT></P>
<TABLE CELLSPACING="10PX" align="center">
  <TR><TD>Card Number:</TD>
      <TD><INPUT type="text" name="ccnumber"/></TD>
  </TR>
  <TR>
    <br><TD>Card Type:</TD>
    <TD><SELECT name="card_type"> 
	<OPTION value="visa">Visa</OPTION> 
	<OPTION selected value="Master Card">Master Card</OPTION></SELECT> </TD></TR>
  <TR>
    <br><TD>Expiry Date:</TD>
    <TD><SELECT name="month"> 
	<OPTION selected value=01>1</OPTION> 
	<OPTION value=02>2</OPTION> 
	<OPTION value=03>3</OPTION> 
	<OPTION value=04>4</OPTION> 
	<OPTION value=05>5</OPTION> 
	<OPTION value=06>6</OPTION> 
	<OPTION value=07>7</OPTION> 
	<OPTION value=08>8</OPTION> 
	<OPTION value=09>9</OPTION> 
	<OPTION value=10>10</OPTION> 
	<OPTION value=11>11</OPTION> 
	<OPTION value=12>12</OPTION></SELECT> 
	
	<SELECT name="year"> <OPTION selected 
        value=07>2007</OPTION> <OPTION value=08>2008</OPTION> <OPTION 
        value=09>2009</OPTION> <OPTION value=10>2010</OPTION> <OPTION 
        value=11>2011</OPTION> <OPTION value=12>2012</OPTION> <OPTION 
        value=13>2013</OPTION> <OPTION value=14>2014</OPTION> <OPTION 
        value=15>2015</OPTION> <OPTION value=16>2016</OPTION> <OPTION 
        value=17>2017</OPTION> <OPTION value=18>2018</OPTION> <OPTION 
        value=19>2019</OPTION> <OPTION value=20>2020</OPTION> <OPTION 
        value=20>2021</OPTION></SELECT> </TD></TR>
  <TR>
    <br><TD vAlign="top">Name:</TD>
    <TD vAlign="top"><INPUT size=30 type="text" name="fullname"><BR><SMALL>(as 
      printed on card)</SMALL></TD></TR>
  <TR>
    <br><TD vAlign="top">CCV:</TD>
    <TD vAlign="top"><INPUT id="ccv" size=3 type="text" name="ccv"><BR><SMALL>The CCV 
      number is the 3 digit number found on the back of your credit 
    card</SMALL></TD></TR>
  <TR>
    <td></td><TD><BR><input type="submit" value="I authorised this transaction"></TD></TR></TABLE>
	
	</FORM>

	</body>
</html>
2
Contributors
6
Replies
12
Views
7 Years
Discussion Span
Last Post by javaAddict
0

In One jsp have the form with all the fields and a submit button:

<form [B]action="two.jsp"[/B] name="someName">
.....
<SELECT name="month">
  <OPTION selected value="01">1</OPTION>
  <OPTION value="02">2</OPTION> 
</SELECT>
.....
<input type="submit" value="I authorised this transaction">
</form>

And in the other jsp:
two.jsp

String monthSelected = request.getParameter("month");
0

In One jsp have the form with all the fields and a submit button:

<form [B]action="two.jsp"[/B] name="someName">
.....
<SELECT name="month">
  <OPTION selected value="01">1</OPTION>
  <OPTION value="02">2</OPTION> 
</SELECT>
.....
<input type="submit" value="I authorised this transaction">
</form>

And in the other jsp:
two.jsp

Tank you for replying.
I did as you said.but it dosnt work.
two.jsp wants to get parameters from one.jsp.
this is one.jsp(deliveryDet.jsp)

[code]

<%@ page language="java" contentType="text/html"%>
<jsp:useBean id="crt" scope="session" class="beans.MyShoppingCartNew"/>

<html>


<head>
<title>Form Validation Example</title>

<script>
function ValidateContactForm()
{
    var fname = document.ContactForm.FName;
	var sname = document.ContactForm.SName;
	var phone = document.ContactForm.Phone;
    var email = document.ContactForm.Email;
    
    var street = document.ContactForm.Street;
    var area = document.ContactForm.Area;
   

    if (fname.value == "")
    {
        window.alert("Please enter your first name.");
        fname.focus();
        return false;
    }
	
	 if (sname.value == "")
    {
        window.alert("Please enter your surname.");
        sname.focus();
        return false;
    }
       if (phone.value=="")
 {
		window.alert("Please Enter your Phone Number");
		phone.focus();
		return false;
	}
	if (phone.value.length<10)
 {
		window.alert("Please Enter your Phone Number");
		phone.focus();
		return false;
	}
    if (email.value == "")
    {
        window.alert("Please enter a valid e-mail address.");
        email.focus();
        return false;
    }
    if (email.value.indexOf("@", 0) < 0)
    {
        window.alert("Please enter a valid e-mail address.");
        email.focus();
        return false;
    }
    if (email.value.indexOf(".", 0) < 0)
    {
        window.alert("Please enter a valid e-mail address.");
        email.focus();
        return false;
    }

 
      if(street.value=="")
  {
 window.alert("Please Enter the street name");
 street.focus();
 return false;
 }
 

if(area.value=="")
{
 window.alert("Please Enter the area");
 area.focus();
 return false;
 }


    return true;
}


</script>
</head>

<body bgcolor="#EF8428" >
		     
		<hr>
		<table align="right" border="0" cellpadding="10" >
			<tr>
		 		<th size="200px" bgcolor="khaki"><a href="Login.html"> Sign In </a></th>
				<th size="200px" bgcolor="khaki"><a href="MenuList.html"> Register </a></th>
			</tr>			
		</table>
		<table border="0" cellpadding="10">
		   	<tr> 	
		    	<th size="200px" bgcolor="khaki"><a href="welcome.html"> Home </a></th>
            	<th size="200px" bgcolor="khaki"><a href="MenuList.html"> Menu </a></th>		 
			</tr>		
		</table>	
		<hr>
<div style="{position: absolute; left:400px; top:150px;}">Total number of items:   <%=crt.getNumOfItems()%><br>
Total cost:   <%=crt.getCost()%></div>
<div style="{position: absolute; left:400px; top:250px;}">

<form method="post" action="CreditCard.jsp" name="ContactForm" onsubmit="return ValidateContactForm();">
    <TABLE border=0 cellSpacing=2 cellPadding=5>
  <TR>
    <TD class=altrow height=50 colSpan=2><STRONG>Delivery Details</STRONG> 
      (*denotes required fields) </TD></TR>
  
  <TR>
    <TD>First Name</TD>
    <TD><INPUT maxLength=30 size=20 type="text" name="FName">*</TD></TR>
  <TR>
    <TD>Surname</TD>
    <TD><INPUT maxLength=30 size=20 type="text" name="SName">*</TD></TR>
  <TR>
    <TD>Phone</TD>
    <TD><INPUT maxLength=10 type="text" name="Phone">*</TD></TR>
  
  <TR>
    <TD>Email</TD>
    <TD><INPUT maxLength=100 size=30 type="text" name="Email">*</TD></TR>
  
  <TR>
    <TD vAlign=top>No.</TD>
    <TD><INPUT type="text" name="Address1"></TD></TR>
  <TR>
    <TD vAlign=top>Sreet name</TD>
    <TD><INPUT type="text" name="Street">*</TD></TR>
  <TR>
    <TD vAlign=top>Address Line 3</TD>
    <TD><INPUT type="text" name="Address3"></TD></TR>
   
  <TR>
    <TD>Area</TD>
    <TD><INPUT maxLength=30 size=20 type="text" name="Area">*</TD></TR>
	
	<TR>
    <TD>Dilivery date</TD>
    <TD><INPUT maxLength=30 size=20 type="text" name="Ddate">*<br><small>Time between 9.00am to 9.00pm<br>Will be deliverd with a 15min variation</small></TD></TR>
	<TR>
    <TD>Delivery time</TD>
    <TD><INPUT maxLength=30 size=20 type="text" name="Dtime">*</TD></TR>
  
 <tr><th> <input type="submit" value="Submit"/></th></tr>
  
  </table>
  </form>
 </div>

</body>
</html>

this is two.jsp(CreditCard.jsp)

<%@ page language="java" contentType="text/html"%>
<jsp:useBean id="crt" scope="session" class="beans.MyShoppingCartNew"/>
<%@ page import="java.util.Enumeration"%>
<html>
<head>
<title>Cart Items</title>
<SCRIPT type=text/javascript> 
	function checkForm( )
	{
		ccv = document.getElementById('ccv').value;
		
			if ( ccv.length == 3 && !isNaN( ccv ) )
			{
				return true;
			}
			
			else
			{
				alert( 'Please enter in your CCV number.' );
				return false;
			}
	}
</SCRIPT>

</head>
<body bgcolor="#EF8428"  onload="load1()">
 <HR width="1200" color="red" noshade>
		<table align="right" border="0" cellpadding="10" >
			<tr>
		 		<th size="200px" bgcolor="khaki"><a href="Login.html"> Sign In </a></th>
				<th size="200px" bgcolor="khaki"><a href="MenuList.html"> Register </a></th>
			</tr>			
		</table>
		<table border="0" cellpadding="10">
		   	<tr> 	
		    	<th size="200px" bgcolor="khaki"><a href="welcome.html"> Home </a></th>
            	<th size="200px" bgcolor="khaki"><a href="MenuList.html"> Menu </a></th>		 
			</tr>		
		</table>	
		<HR width="1200" color="red" noshade>

 <% String fname=request.getParameter("FName");
    String sname=request.getParameter("SName");
    String phone=request.getParameter("Phone");
	
	String email=request.getParameter("Email");
	String address1=request.getParameter("Address1");
	String street=request.getParameter("Sreet");
	String address3=request.getParameter("Address3");
	String area=request.getParameter("Area");
	String ddate=request.getParameter("Ddate");
	String dtime=request.getParameter("Dtime");
	
	crt.CusDetails.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
	int crt=crt.getcost();
	%>
<FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">
	<input type="hidden" name="totCst" value="<%=cst%>"> 
<H1 align="center">Credit Card Details</H1>
<P align="center">You will be charged <STRONG><%=cst%></STRONG></P>
<P align="center"><FONT color=red></FONT></P>
<TABLE CELLSPACING="10PX" align="center">
  <TR><TD>Card Number:</TD>
      <TD><INPUT type="text" name="ccnumber"/></TD>
  </TR>
  <TR>
    <br><TD>Card Type:</TD>
    <TD><SELECT name="card_type"> 
	<OPTION value="visa">Visa</OPTION> 
	<OPTION selected value="Master Card">Master Card</OPTION></SELECT> </TD></TR>
  <TR>
    <br><TD>Expiry Date:</TD>
    <TD><SELECT name="month"> 
	<OPTION selected value=01>1</OPTION> 
	<OPTION value=02>2</OPTION> 
	<OPTION value=03>3</OPTION> 
	<OPTION value=04>4</OPTION> 
	<OPTION value=05>5</OPTION> 
	<OPTION value=06>6</OPTION> 
	<OPTION value=07>7</OPTION> 
	<OPTION value=08>8</OPTION> 
	<OPTION value=09>9</OPTION> 
	<OPTION value=10>10</OPTION> 
	<OPTION value=11>11</OPTION> 
	<OPTION value=12>12</OPTION></SELECT> 
	
	<SELECT name="year"> <OPTION selected 
        value=07>2007</OPTION> <OPTION value=08>2008</OPTION> <OPTION 
        value=09>2009</OPTION> <OPTION value=10>2010</OPTION> <OPTION 
        value=11>2011</OPTION> <OPTION value=12>2012</OPTION> <OPTION 
        value=13>2013</OPTION> <OPTION value=14>2014</OPTION> <OPTION 
        value=15>2015</OPTION> <OPTION value=16>2016</OPTION> <OPTION 
        value=17>2017</OPTION> <OPTION value=18>2018</OPTION> <OPTION 
        value=19>2019</OPTION> <OPTION value=20>2020</OPTION> <OPTION 
        value=20>2021</OPTION></SELECT> </TD></TR>
  <TR>
    <br><TD vAlign="top">Name:</TD>
    <TD vAlign="top"><INPUT size=30 type="text" name="fullname"><BR><SMALL>(as 
      printed on card)</SMALL></TD></TR>
  <TR>
    <br><TD vAlign="top">CCV:</TD>
    <TD vAlign="top"><INPUT id="ccv" size=3 type="text" name="ccv"><BR><SMALL>The CCV 
      number is the 3 digit number found on the back of your credit 
    card</SMALL></TD></TR>
  <TR>
    <td></td><TD><BR><input type="submit" value="I authorised this transaction"></TD></TR></TABLE>
	
	</FORM>

	</body>
</html>

these are the errors i get

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 54 in the jsp file: /CreditCard.jsp
String cannot be resolved
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
Syntax error on token "fname", delete this token
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
String cannot be resolved
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
Syntax error on token "sname", delete this token
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
String cannot be resolved
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
Syntax error on token "phone", delete this token
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
String cannot be resolved
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
Syntax error on token "email", delete this token
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
String cannot be resolved
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
Syntax error on token "address1", delete this token
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
String cannot be resolved
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
Syntax error on token "street", delete this token
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
String cannot be resolved
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
Syntax error on token "address3", delete this token
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
String cannot be resolved
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
Syntax error on token "area", delete this token
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
String cannot be resolved
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
Syntax error on token "ddate", delete this token
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
String cannot be resolved
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 54 in the jsp file: /CreditCard.jsp
Syntax error on token "dtime", delete this token
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 55 in the jsp file: /CreditCard.jsp
Duplicate local variable crt
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">
58: 	<input type="hidden" name="totCst" value="<%=cst%>"> 


An error occurred at line: 55 in the jsp file: /CreditCard.jsp
Cannot invoke getcost() on the primitive type int
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime);
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">
58: 	<input type="hidden" name="totCst" value="<%=cst%>"> 


An error occurred at line: 58 in the jsp file: /CreditCard.jsp
cst cannot be resolved
55: 	int crt=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">
58: 	<input type="hidden" name="totCst" value="<%=cst%>"> 
59: <H1 align="center">Credit Card Details</H1>
60: <P align="center">You will be charged <STRONG><%=cst%></STRONG></P>
61: <P align="center"><FONT color=red></FONT></P>


An error occurred at line: 60 in the jsp file: /CreditCard.jsp
cst cannot be resolved
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">
58: 	<input type="hidden" name="totCst" value="<%=cst%>"> 
59: <H1 align="center">Credit Card Details</H1>
60: <P align="center">You will be charged <STRONG><%=cst%></STRONG></P>
61: <P align="center"><FONT color=red></FONT></P>
62: <TABLE CELLSPACING="10PX" align="center">
63:   <TR><TD>Card Number:</TD>


Stacktrace:
	org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
	org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
	org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:316)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

Edited by coroll: n/a

0

That is not how you call methods:

crt.CusDetails.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime)

Your error is very basic and has nothing to do with jsp or web programming. I don't want to sound harsh but if you can't fix this error then you go back to learn better the basics.

In case in was an honest mistake that you just missed and didn't correct it even if you knew the answer then that is ok.

It is up to you to decide what you need:

crt.CusDetails.derCusData(fname,sname,phone,email,address1,String street,address3,area,ddate,dtime)

Also after that line you do this:

int crt=crt.getcost();

That is no correct either. You declare an int: crt, and you have above another variable with the same name: crt.CusDetails

0

That is not how you call methods:

crt.CusDetails.derCusData(String fname,String sname,String phone,String email,String address1,String street,String address3,String area,String ddate,String dtime)

Your error is very basic and has nothing to do with jsp or web programming. I don't want to sound harsh but if you can't fix this error then you go back to learn better the basics.

In case in was an honest mistake that you just missed and didn't correct it even if you knew the answer then that is ok.

It is up to you to decide what you need:

crt.CusDetails.derCusData(fname,sname,phone,email,address1,String street,address3,area,ddate,dtime)

Also after that line you do this:

int crt=crt.getcost();

That is no correct either. You declare an int: crt, and you have above another variable with the same name: crt.CusDetails

oh yes.what i did was jjust coppied that line from bean.thank you.
But now it says

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 54 in the jsp file: /CreditCard.jsp
crt.CusDetails cannot be resolved or is not a field
51: 	String ddate=request.getParameter("Ddate");
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.CusDetails.derCusData(fname,sname,phone,email,address1,street,address3,area,ddate,dtime);
55: 	int cst=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


An error occurred at line: 55 in the jsp file: /CreditCard.jsp
The method getcost() is undefined for the type MyShoppingCartNew
52: 	String dtime=request.getParameter("Dtime");
53: 	
54: 	crt.CusDetails.derCusData(fname,sname,phone,email,address1,street,address3,area,ddate,dtime);
55: 	int cst=crt.getcost();
56: 	%>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">
58: 	<input type="hidden" name="totCst" value="<%=cst%>"> 


Stacktrace:
	org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
	org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
	org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:316)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

i think a problem with my bean.

my bean is like this.

public class MyShoppingCartNew{
    ...
 public int getCost(){}
    ...
  public class price{
    ...

   }
  public class CusDetails{
     public void derCusData(){
...
     }
  }
}

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

0

one error could be solved.

But it says
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 54 in the jsp file: /CreditCard.jsp
crt.derCusData cannot be resolved or is not a field
51: String ddate=request.getParameter("Ddate");
52: String dtime=request.getParameter("Dtime");
53:
54: crt.derCusData.derCusData(fname,sname,phone,email,address1,street,address3,area,ddate,dtime);
55: int cst=crt.getCost();
56: %>
57: <FORM onsubmit="return checkForm()" method="post" name="ccForm" action="">


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:316)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

0

You do this: crt.CusDetails.derCusData and this: crt.derCusData.derCusData

What type are the crt, CusDetails, derCusData.
Is CusDetails inside the MyShoppingCartNew like an inner class? If yes then you don't need that.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.