Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

commons-service.jar and can't compile 1

Status
Not open for further replies.

bluepixie

Programmer
Jul 31, 2003
34
US
Hi,
I have 2 issues.
1. I am following the 'Mastering Jakarta Struts" book. (I downloaded the struts v. 1.1. I am using Tomcat.) On page 60 it listed which .jar files to move to the lib directory. The only one that I couldn't find was commons-service.jar. Also it mentioned xerces.jar but i only found xercesImpl.jar so I used that .jar. I went to the struts site again but couldn't find the commons-service.jar file. Have things changed since publication and I don't need it?

2. Also, I can't seem to compile my form. I get errors that it can't find the HttpServeletRequest and other imports. Is this related to the .jar's that i am missing? my directory structure (if it helps) is a struts folder with my jsp files off that is webapps->WEB-INF->xml files and my classes & lib folders. Inside lib I put my jars. In classes I have my classname folder where I would put my compiled java classes if I could. : )
Thanks!
 
note: I just found a service-commons.jar so I am hoping that is the missing file. I still can't compile though...
 
Hi,

I am not sure about the .jar file you are looking for and I haven't used that .jar file in any of my projects.

HttpServeletRequest error might occur when you donot have servlet.jar in your classpath while compileing the java files.

Just make sure you have those jar files in your classpath.

Cheers,
Venu
 
In my jdk classpath? sorry, I am still pretty new and have never been able to compile on my pc. : P
thanks!
 
Hi I think that i am goinng to post in the java forum bacause maybe that is a more relavant forum! Just in case, I have servlet.jar in my tomact/common/lib folder and here are my errors from the commandline:

C:\Tomcat_4_1\webapps\pixieapp>javac GuestbookForm.java
GuestbookForm.java:16: illegal start of expression
public String setGuestName(String guestname){
^
GuestbookForm.java:33: ';' expected
}
^
GuestbookForm.java:3: package javax.servlet.http does not exist
import javax.servlet.http.HttpServletRequest;
^
GuestbookForm.java:4: package org.apache.struts.action does not exist
import org.apache.struts.action.ActionForm;
^
GuestbookForm.java:5: package org.apache.struts.action does not exist
import org.apache.struts.action.ActionMapping;
^
GuestbookForm.java:7: cannot resolve symbol
symbol : class ActionForm
location: class pixie.GuestbookForm
public class GuestbookForm extends ActionForm {
^
6 errors
------------------------

I have checked to see what it want's the ';' but can see no errors in my code!
---------------------

package pixie;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public class GuestbookForm extends ActionForm {

private String guestname = null;
private String comment = null;

public String getGuestName(){
return (guestname);
{

public String setGuestName(String guestname){
this.guestname = guestname;
{

public void getGuestComment(){
return (comment);
{

public void setGuestComment(String comment){
this.comment = comment;
{

public void reset(ActionMapping mapping,HttpServeletRequest request) {

this.guestname = null;
this.comment = null;
}
}
 
Hi,

Make sure your classpath is set properly before you compile the Java File. I changed the GuestbookForm try the below code.

Classpath should have jdk,serlvet.jar,struts.jar before you compile this

package pixie;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import javax.servlet.http.HttpServletRequest;

/**
* User: vreddy
* Date: Jan 19, 2004
* Time: 10:58:42 AM
* Java: ${filename}
*/
public class GuestbookForm extends ActionForm {

private String guestname = null;
private String comment = null;

public String getGuestname() {
return guestname;
}

public void setGuestname(String guestname) {
this.guestname = guestname;
}

public String getComment() {
return comment;
}

public void setComment(String comment) {
this.comment = comment;
}

public void reset(ActionMapping mapping, HttpServletRequest request) {

this.guestname = null;
this.comment = null;
}
}

Cheers
Venu
 
Hi,
Thanks,
I did notice those problems right after I posted! Ialso put my struts.jar into the jdk../jre/lib/ext folder and that was fixed.
thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top