I am attempting to upload a file from my html page to my servlet side code and store it in an arraylist
heres my html:
<pre>
<!DOCTYPE HTML>
<html>
<head>
<title>file upload</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<form action="url to my servlet java code" method="post" ENCTYPE="multipart/form-data">
<input type="file" value="browse..."/>
<br/>
<input type="submit" value="Upload File" />
</form>
</body>
</html>
</pre>
. .
. .
heres what i have in my servlet page's doGet() method
Part p1 = request.getPart("textfile.txt");
Scanner in = new Scanner(p1.getInputStream());
ArrayList<String> newList = new ArrayList<String>();
while(in.hasNextLine()){
newList.add(in.nextLine());
}
Collections.shuffle(newList);
so once i select the text file i want and hit upload, i get a nullpointerexception error.
help?