Thanks for any help you can provide.
Reference: Web Development with Java Server Pages pgs. 258, 278
I'm having a problem with the FAQ project, specifically AddCommand.class
and FaqRepository.class. I compiled FaqRepository.java first, then
AddCommand.java, but the compiler states getInstance() isn't found in
FaqRepository.class.
***********************************************************************
Error Message from Compiler:
***********************************************************************
C:\jakarta-tomcat\webapps\roundtable\web-inf\classes\com\datasoft\faqtool>javac
AddCommand.java
AddCommand.java:16:
Class com.datasoft.faqtool.FaqRepository. getInstance not found.
FaqRepository faqs = new FaqRepository.getInstance();
^
1 error
***********************************************************************
Snippet from FaqRepository.java:
***********************************************************************
public class FaqRepository {
private static FaqRepository instance;
private static final String driver = "postgresql.Driver";
private static final String user = "guest";
private static final String pass = "guest";
private static final String dbURL
= "jdbc:postgresql://localhost/rt";
private Connection connection;
private PreparedStatement getStmt;
private PreparedStatement putStmt;
private PreparedStatement remStmt;
private PreparedStatement getAllStmt;
private PreparedStatement updStmt;
public static FaqRepository getInstance()
throws FaqRepositoryException {
if (instance == null)
instance = new FaqRepository();
return instance;
}
***********************************************************************
Snippet from AddCommand.java:
***********************************************************************
public String execute(HttpServletRequest req)
throws CommandException {
try {
if (CommandToken.isValid(req)) {
FaqRepository faqs =
new FaqRepository.getInstance();
FaqBean faq = new FaqBean();
faq.setQuestion(req.getParameter("question"));
faq.setAnswer(req.getParameter("answer"));
faqs.put(faq);
req.setAttribute("faqtool.msg",
"FAQ Added Successfully");
}
Thanks,
Todd Kurtz
____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets