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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

org.apache.commons.fileupload.portlet.PortletFileUpload

Status
Not open for further replies.

WartookMan

Technical User
Nov 24, 2003
346
AU
I'm having some problems getting the following code to compile. I'm trying to create a File Upload portlet for use with a JSR 168 Portal Server (WebSphere 5.1 to be exact).

I have downloaded the 1.1-dev build from the Jakarta website, and installed that in my WEB-INF/lib directory. My code is (stripped considerably) as follows:
Code:
...
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.portlet.PortletFileUpload;
...

public void processAction(... )
...
	PortletFileUpload upload = new PortletFileUpload();
	List fileItems = (List)upload.parseRequest(request);
	Iterator itr = fileItems.iterator();

	while ( itr.hasNext() )
	{
		FileItem fi = (FileItem)itr.next();
		if(!fi.isFormField())
		{
			serverresponse += "NAME: " + fi.getName() + "<br>";
			serverresponse += "SIZE: " + fi.getSize() + "<br>";
			serverresponse += fi.getOutputStream().toString() + "<br>";
		} else {
			serverresponse += "Field = " + fi.getFieldName() + "<br>";
		}
	}
...
I am receiving the following message:
Code:
com\lcltd\raleigh\jsr168\WCMTools.java:198: cannot access javax.servlet.http.HttpServletRequest
file javax\servlet\http\HttpServletRequest.class not found
	List fileItems = (List)upload.parseRequest(request);
	                              ^
1 error

What have I done wrong... I'm assuming plenty of people have got this working in the past since the libraries are over 2 years old and it's a fundamental thing to do with servlets. Please note that this is for a Portlet though so the request method is slightly different.

Any assistance would be greatly appreciated.

Senior IBM Lotus Workplace Web Content Management (LWWCM) / Aptrix Specialist & Web Developer
w: w: e: Pete.Raleigh(at)lclimited.co.uk
 
The compiler needs to be able to see the HttpServletRequest class. The jar containing this class and it's dependencies must be on the compiler's classpath (using the -classpath command-line parameter).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top