LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-17-2009, 04:40 PM   #1
rcarwise
LQ Newbie
 
Registered: Apr 2009
Posts: 1

Rep: Reputation: 0
compiling error FH.java:20: <identifier> expected


Hello I'm trying to compile some java code when I compile the code I get the same error FH.java:20: <identifier> expected at dispatcher.forward(request,response);
^

The ^ shows where the identifier goes,but no matter what I put I get the same error message.Help me please!!!


This is all the java code I'm trying to compile.[

package coreservlets;




import javax.servlet.RequestDispatcher;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import coreservlets.beans.*;
import coreservlets.ButtonMethod;
import java.sql.*;




public class Dispatcher extends HttpServlet {
RequestDispatcher dispatcher =
request.getRequestDispatcher(address);
dispatcher.forward(request,response);
}

public class FH extends HelperBase {

HttpSession session = request.getSession();
FB dbb = (FB)session.getAttribute("dbb");
public Object getDbb() { return dbb;}

public FH(HttpServletRequest request,
HttpServletResponse response) { super(request, response); }

@ButtonMethod(buttonName="login")
public String loginMethod()
{ BeanUtilities.populateBean(dbb, request);
String detas = "";
String address= "Login";
String sql = "select * from users where e_mail = '"+dbb.getE_mail()+"';";

try {
dbb.connect(); ResultSet rs = dbb.execSQL(sql);
if ( dbb.next())
{ if( rs.getString("p_word").equals(dbb.getP_word()) )
{ dbb.setC_pict("/rcarw001/images/" +
Integer.toString(Integer.parseInt(dbb.getSer_no())%7)+".jpg'");
}
else { detas = "Please login again"; address = "None"; }
}
else { detas = "Please register to use this site"; address = "None"; }
dbb.close();
} catch(Exception e){}
dbb.setDetas(detas);
return(address);
}

@ButtonMethod(buttonName="submit")
String submitMethod()
{BeanUtilities.populateBean(dbb, request);
String detas = "";

if (dbb.getP_word().equals(dbb.getCp_word()) && ! dbb.getP_word().equals(""))
{String sql = "select * from users where e_mail = '"+dbb.getE_mail()+"';";
try
{dbb.connect(); ResultSet rs = dbb.execSQL(sql);
if (dbb.next()) { detas = "You are already registered"; }
else
{ sql = "insert into users (f_name, l_name, e_mail, p_word )" +
"values ('" +dbb.getF_name()+ "'," + "'" +dbb.getL_name()+ "'," +
"'" +dbb.getE_mail()+ "'," + "'" +dbb.getP_word()+ "');";
int i = dbb.updateSQL(sql);
detas = "Thanks for the registration - Please login now";
}
dbb.close();
} catch(Exception e) {}
}
else { detas = "Passwords did not match";}
dbb.setDetas(detas); return("None");
}

@ButtonMethod(buttonName="list")
String listMethod(){
try { FB db = (FB)session.getAttribute("db");
if ( db == null )
{ db = new FB(); session.setAttribute("db", db); db.connect(); }
String sql = "select f_name,l_name,ser_no from users";
String th = "Associated Users<br><table width='1000'>";
dbb.setDetas(th + db.list(sql));
} catch(Exception e){}
return ("List");
}

@ButtonMethod(buttonName="disc")
String discMethod()
{ String detas = "<form><table>" +
"<tr><td>Formula 1 race stories</td>" +
"<td><input type='submit' name='disc' value='1'></td></tr>" +
"<tr><td>Your favorite racer</td>" +
"<td><input type='submit' name='disc' value='2'></td></tr>" +
"<tr><td>Best race tracks</td>" +
"<td><input type='submit' name='disc' value='3'></td></tr>" +
"<tr><td>Best races or all time</td>" +
"<td><input type='submit' name='disc' value='4'></td></tr>" ;
detas = detas + "</form></table>";
dbb.setDetas(detas);
return ("Disc");
}

@ButtonMethod(buttonName="edit_s")
String edit_sMethod()
{ BeanUtilities.populateBean(dbb, request);
String sql = "update users set f_name = '" + dbb.getF_name() + "'," +
" l_name = '" + dbb.getL_name() + "'" +
"where ser_no = " + dbb.getSer_no() + ";";
try { dbb.connect(); int i = dbb.updateSQL(sql); dbb.close();
} catch(Exception e){}
dbb.setDetas("<br>Record Updated<br>"); return ("Edit");
}

@ButtonMethod(buttonName="list_m")
String list_mMethod(){
FB db = (FB)session.getAttribute("db");
try { db.close();} catch(Exception e){}
session.removeAttribute("db"); return("Login");
}

@ButtonMethod(isDefault=true)
String uploadMethod()
{ dbb.setDetas("");
if ( dbb.getType().equals("Edit") ) return("Edit");
return("None");
}

@ButtonMethod(buttonName="disc_m")
String disc_mMethod() { return ("Login"); }

@ButtonMethod(buttonName="logo")
String logoMethod()
{ session.removeAttribute("dbb"); dbb.setDetas(""); return ("None");}

@ButtonMethod(buttonName="register")
String registerMethod() { return("Register"); }

@ButtonMethod(buttonName="edit")
String editMethod() { dbb.setType("Edit"); dbb.setDetas(""); return ("Edit");}

@ButtonMethod(buttonName="edit_m")
String edit_mMethod() { dbb.setType(""); return("Login"); }


protected void doGet() throws ServletException, IOException
{session.setAttribute("helper", this);
if ( dbb == null ) { dbb = new FB(); session.setAttribute("dbb", dbb);}
String address = executeButtonMethod();
request.getRequestDispatcher("/"+address+".jsp").forward(request,response);
}
}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C compiling error: expected expression before { token CoderMan Programming 3 03-31-2009 05:31 PM
xmacs java compiling error - jdk version problem lindope Programming 0 09-25-2008 10:58 PM
Java "<identifier> expected" error. nro Programming 2 09-01-2004 01:20 AM
Compiling Java Assertion error CragStar Linux From Scratch 13 01-21-2003 02:24 PM
ERROR: not an identifier GEEXTER Linux - Newbie 0 12-16-2002 12:27 PM


All times are GMT -5. The time now is 06:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration