Solved

Program won't compile:  Expecting ")"

Posted on 2004-08-01
3
235 Views
Last Modified: 2012-05-05
Hi guys, please take a look at my code.  I have one error left and it's driving me crazy.  On line 79 it's expecting a ")", but I don't see where or why I'd need one.  Also, now that I'm a little better with Java, does anybody use a special editor or GUI for their java development other than notepad, which is what I'm using now.

package weblocker;

import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.text.*;
import java.net.*;
import java.awt.*;
import java.awt.event.*;


public class verifycredit extends HttpServlet {
public void init() throws ServletException {
    Authenticator.setDefault(new MyAuthenticator());
      }
  public void doGet(HttpServletRequest request,
              HttpServletResponse response)
      throws ServletException, IOException {

 response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String title = "Your registration has been processed!";
    String docType =
      "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
      "Transitional//EN\">\n";
try {
      
     String MerchantID = "10011";
     String Amount = request.getParameter("Amount");
     String REFID = request.getParameter("REFID");
     String AccountNo = request.getParameter("AccountNo");
     String CCMonth = request.getParameter("CCMonth");
     String CCYear = request.getParameter("CCYear");
     String NameonAccount = request.getParameter("NameonAccount");
     String AVSADDR = request.getParameter("AVSADDR");
     String AVSZIP = request.getParameter("AVSZIP");
     String CCRURL = "";
     String myemail = ",videotwogo@yahoo.com";
     String Email = request.getParameter("Email") + myemail;
     String USER1 = request.getParameter("USER1");          //This collects the City
     String USER2 = request.getParameter("USER2");          //This collects the State
     
//Setup query string to send to backend server

  String qString= "NameonAccount="  + NameonAccount;
qString= qString + "&MerchantID="   + MerchantID;
qString= qString + "&CCRURL="       + CCRURL;
qString= qString + "&AVSADDR="           + AVSADDR;
qString= qString + "&AVSZIP="           + AVSZIP;
qString= qString + "&AccountNo="    + AccountNo;
qString= qString + "&CCMonth="           + CCMonth;
qString= qString + "&CCYear="           + CCYear;
qString= qString + "&Email="           + Email;
qString= qString + "&REFID="           + REFID;
qString= qString + "&Amount="           + Amount;
qString= qString + "&USER1="           + USER1;
qString= qString + "&USER2="           + USER2;

    HttpSession session = request.getSession();

}
 catch (Exception e)
        {
            //If any general error, notify the user.
          out.println("General exception: " + e.toString());
           // response.sendRedirect("http://www.cnn.com");
          
        }
out.println(docType +
                "<HTML>\n" +
                "<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" +
                "<BODY BGCOLOR=\"#FDF5E6\">\n" +
                "<SCRIPT LANGUAGE=javascript>\n" +
"<!--\n" +
"window.onload=updateVariables\n" +
"function updateVariables() {\n" +
"parent.document.location = "https://webservices.primerchants.com/billing/TransactionCentral/processcreditcardonline.asp?" + "<%=qString%>";\n" +
"}\n" +
"//-->\n" +
"</SCRIPT>\n" +


"</head>\n" +
"<body>\n" +

"Dear <%=NameonAccount%>      <br><br>\n" +

"We are currently processing your order.      <br>\n" +
"Please do not use the browser back button or close this window until processing is complete.      <br>\n" +
"If there is an error in processing your order, it will be displayed here.                                    <br><br>\n" +

"Please be patient. This process can take up to 1 minute.            <br><br>\n" +

"Thank you.\n" +
                                                                                                      
"</body>\n"

out.println("</BODY></HTML>");
}
}
0
Comment
Question by:cxxxcxxx
  • 3
3 Comments
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 11688981
i think you forgot to escape a double quote:

"<%=qString%>";\n"

should be

"<%=qString%>\";\n"
0
 
LVL 30

Accepted Solution

by:
GrandSchtroumpf earned 500 total points
ID: 11689002
and another one here also:
"parent.document.location = "https:/..."
should be
"parent.document.location = \"https:/..."

and finally, you need to close your parenthesis and statement:
"</body>\n"
should be
"</body>\n");
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 11689085
:°)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

713 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