How to upload [Reprinted] in Struts

xiaoxiao2021-03-05  23

http://www.javayou.com/showlog.jspe?log_id=106

The following is a simple example 1. JSP page Select File: < HTML: Submit> Upload 2. Form bean is mainly two things here, and the first of course is imported. Import org.apache.struts.upload. *; then declared a corresponding field and generate a getter and setter method for this field for formfile picture = null; public formfile getPicture () {return picture;} public void setPicture (FormFile P) ) {this.picture = p;} 3. Action UploadForm theForm = (UploadForm) form; FormFile picture = theForm.getPicture (); String fileName = picture.getFileName (); String contentType = picture.getContentType (); String size = (Picture.GetFileSize () "bytes"); // do something ... // You can use InputStream to get Picture.GetinputStream

Parameters on Struts file upload

When the write log in the development of JDLog is discovered, Struts is not very perfect in Struts. The uploaded parameters are best encapsulated in the FormBean, such as adding the formfile field to handle, so Struts automatically corrects the properties of the upload file domain with the properties of the FORMBEAN. Processing, but if you cannot read the normal form field through Request.getParameter in the Execute method. This problem is currently in research ...

Struts About Parameter Passages

In the Struts framework, when the action is executed, it is also an actionforward, how to pass some parameters to this page? (I mean directly to join the parameters instead of the request / session, such as input.jsp? Name = Tom) This issue I am studying, there is an answer to it naturally. [align = Right] [size = 1] [color = # ccccc] [edit on 2004-2-12 10:51:29 by liudong] [/ color] [/ size] [/ align]

Liu Dong netizen said: Liu Dong netizen said: Liu Dong users said: Hahaha, it is actually very simple! RETURN NEW ACTIONFORWARD (MApping.getinput () "? log_id =" reply.getLogId ());

转载请注明原文地址:https://www.9cbs.com/read-37390.html

New Post(0)