| |||||||
Du magst keine Werbung? Wir auch nicht!
Einfach registrieren und die Werbung ist weg. Diese Nachricht sehen nur nicht registrierte Nutzer.
![]() |
| | LinkBack | Themen-Optionen | Ansicht |
| | #1 (permalink) |
| Neuer User Registriert seit: May 2009
Beiträge: 20
| URLVariables in JSP auslesen
Hallo, ich lade via FileReference und einer JSP eine Datei hoch. Dabei möchte ich noch zusätzliche Informationen über die URLVariables übergeben. Wie lese ich diese in der JSP aus? mxml: Code: var request:URLRequest = new URLRequest(requestUrl); var vars:URLVariables = new URLVariables(); vars.userName = Settings.instance.currentUser.name; request.data = vars; fileReference.upload(request); Code: FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List /* FileItem */ items = upload.parseRequest(request);
Iterator iter = items.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
if (item.isFormField()) {
System.out.println("Got a form field");
String name = item.getFieldName();
String value = item.getString();
System.out.println("Name:"+name+",Value:"+value);
} else {
System.out.println("Not form field");
String fieldName = item.getFieldName();
String fileName = item.getName();
String contentType = item.getContentType();
boolean isInMemory = item.isInMemory();
long sizeInBytes = item.getSize();
System.out.println("Field Name:"+fieldName+",File Name:"+fileName);
System.out.println("Content Type:"+contentType+",Is In Memory:"+isInMemory+",Size:"+sizeInBytes);
byte[] data = item.get();
FileOutputStream fileOutSt = new FileOutputStream("webapps/flex_a_group/data/files/"+ fileName);
// hier möchte ich auf die übergebene Variable userName zugreifen
fileOutSt.write(data);
fileOutSt.close();
}
} |
| | |
| | #2 (permalink) |
| Perverted Hermit Registriert seit: Mar 2004 Ort: Delmenhorst
Beiträge: 11.856
|
Take a look here.
__________________ github: https://github.com/floriansalihovic/L18nExample <florian xmlns:speaker="www.beyondtellerrand.com/ffk11/speakers_sessions" xmlns:trainer="http://www.beyondtellerrand.com/ffk11/workshops" /> and @ g+ |
| | |
![]() |
| Lesezeichen |
| Themen-Optionen | |
| Ansicht | |
| |
Ähnliche Themen | ||||
| Thema | Autor | Forum | Antworten | Letzter Beitrag |
| Probleme mit URLRequest und URLVariables | Arne Drews | ActionScript 3 | 9 | 23-12-2009 12:59 |
| URLRequest und URLVariables | thembones410 | ActionScript 3 | 1 | 27-11-2009 12:06 |
| [Flash CS4] urlvariables an swf per Loader | janpedder | Flash Einsteiger | 0 | 07-05-2009 11:27 |
| URLVariables Eigenschaften in Array speichern | denniz | ActionScript 3 | 3 | 08-04-2009 14:24 |
| URLVariables subclassen | Rudi Ratlos | ActionScript 3 | 0 | 29-08-2007 16:39 |