| Author |
Help on Symbol not found
|
George Soto
Greenhorn
Joined: Dec 18, 2003
Posts: 16
|
|
Can anyone give me an idea why this will not compile? I would be very greatfull!!! George LookupAction.java [48:1] cannot resolve symbol symbol : class LookupForm location: class com.actmort.LookupAction LookupForm lookupForm = (LookupForm) form; ^ LookupAction.java [48:1] cannot resolve symbol symbol : class LookupForm location: class com.actmort.LookupAction LookupForm lookupForm = (LookupForm) form; ^ 2 errors Errors compiling LookupAction. ackage com.actmort; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; public class LookupAction extends Action { protected Double getQuote(String symbol) { if ( symbol.equalsIgnoreCase ("SUNW") ) { return new Double(25.00); } return null; } public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse Response) throws IOException, ServletException { Double price = null; // Defau;t target to success String target = new String("success"); if ( form != null ) { // Use te LookupForm to get the request parameters LookupForm lookupForm = (LookupForm) form; String symbol = lookupForm.getSymbol (); price = getQuote(symbol); } // Set the target to failure if ( price == null ) { target = new String("failure"); } else { request.setAttribute("PRICE", price); } //Forward to the appropriate View return (mapping.findForward(target)); } }
|
 |
ramprasad madathil
Ranch Hand
Joined: Jan 24, 2005
Posts: 489
|
|
You will have to import the package containing the LookupForm class. ram.
|
 |
George Soto
Greenhorn
Joined: Dec 18, 2003
Posts: 16
|
|
Hi Ram, Thank you for you quick response. I use Package com.actmort; The assumption is that this will point to WEBAPP\ACTMORT\WEB-INF\classes\com\actmort\LookupForm.class I am using netbeans as well.. I am unable to compile. But the error in itself is because it can not access the LookupForm. I am assuming and please, correct me, there something blocking it from accessing it... If this is correct I need to check the scope because I can see it there but it is not accessing it... George
Originally posted by ramprasad madathil: You will have to import the package containing the LookupForm class. ram.
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Is this a typo:
ackage com.actmort;
And.. Is LookupForm in the com.actmort package? If not, you'll need to import it.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
George Soto
Greenhorn
Joined: Dec 18, 2003
Posts: 16
|
|
Hi Ben, Its a copy paste typo. It is actually correct on the code. Yes, the LookupForm is in the com.actmort package under the class directory. actmort/web-inf/classes/com/actmort/LookupForm I was thinking it was the class scope type... I need to double check that this evening!!! George
Originally posted by Ben Souther: Is this a typo: And.. Is LookupForm in the com.actmort package? If not, you'll need to import it.
|
 |
George Soto
Greenhorn
Joined: Dec 18, 2003
Posts: 16
|
|
Solution: differing version and deprecated objects in Strtus the root cause! Struts 1.2.8 vs 1.1
|
 |
 |
|
|
subject: Help on Symbol not found
|
|
|