Solved

Program won't compile:  Expecting ")"

Posted on 2004-08-01
3
232 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
Comment Utility
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
Comment Utility
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
Comment Utility
:°)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

762 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

12 Experts available now in Live!

Get 1:1 Help Now