Wrox Programmer Forums
|
BOOK: Professional Jakarta Struts
This is the forum to discuss the Wrox book Professional Jakarta Struts by James Goodwill, Richard Hightower; ISBN: 9780764544378
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Jakarta Struts section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 20th, 2004, 02:59 AM
Registered User
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems with ch03app

When I attempt to compile LookupAction.java, I receive the following error:

C:\Tomcat 4.1\webapps\ch03app\WEB-INF\classes>javac LookupAction.java
LookupAction.java:43: cannot resolve symbol
symbol : class LookupForm
location: class ch03.LookupAction
      LookupForm lookupForm = (LookupForm)form;
      ^
LookupAction.java:43: cannot resolve symbol
symbol : class LookupForm
location: class ch03.LookupAction
      LookupForm lookupForm = (LookupForm)form;
                               ^
2 errors

Here is my code (taken from the Wrox code download site):

package ch03;

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;

//import ch08.WileyActionMapping;

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 {

    String theMapping = mapping.getClass().toString();

// WileyActionMapping wileyMapping = (WileyActionMapping)mapping;

    Double price = null;
    String symbol = null;

    // Default target to success
    String target = new String("success");

    if ( form != null ) {

      LookupForm lookupForm = (LookupForm)form;

      symbol = lookupForm.getSymbol();

      price = getQuote(symbol);
    }

    // if price is null, set the target to failure
    if ( price == null ) {

      target = new String("failure");
    }
    else {

// boolean logging = wileyMapping.getLogResults();
// if ( logging ) {
//
// System.err.println("SYMBOL:"
// + symbol + " PRICE:" + price);
// }

      request.setAttribute("PRICE", price);
    }
    // Forward to the appropriate View
    return (mapping.findForward(target));
  }
}

Any help is greatly appreciated.
 
Old October 11th, 2004, 12:26 PM
Authorized User
 
Join Date: Oct 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The code that is available for download is just plain wrong and bears no resemblance to the examples in the book.

I see that you have already commented out the import for the chapter 8 stuff and the mapping junk too.

I think that you may have a classpath issue.

When I compiled, I had to move the source to the WEB-INF/classes directory and I used the following command line

javac -classpath .;%CLASSPATH% -d LookupAction.java

I had to add "." (the current working directory) to the classpath so that it could reference the other classes in there.

Using -d will make the compiler drop the .class file into the right subdirectory on compile.


On review, I suspect that you are compiling the files one at a time from the command line. If you compile the LookupForm.java first it might resolve your "not found" error
 
Old December 21st, 2004, 03:45 PM
Registered User
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need to compile ALL of your classes in the ch03 package at the same time to get around this problem. Use something like this:

javac -classpath %CLASSPATH%;C:\jakarta-struts-1.2.4\lib\struts.jar; *.java

The "*.java" should compile all classes and solve your problem.








Similar Threads
Thread Thread Starter Forum Replies Last Post
Have 2 problems so far... Soulcatcher BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 June 20th, 2007 12:57 PM
2 problems here with me naveed77 Beginning VB 6 1 October 17th, 2006 06:04 PM
2 problems kanoorani Beginning VB 6 2 July 11th, 2006 11:45 PM
validate.asp problems and logon.asp problems p2ptolu Classic ASP Databases 0 February 16th, 2005 02:34 PM
Two Problems goraya C# 2 May 21st, 2004 05:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.