English 中文(简体)
春季MVC的定制标签内的有效载荷
原标题:File uploading from within a custom form tag in Spring MVC

Context

Part of the administrator side of our application requires the user to edit various types of content, which involves using a rich text editor or using files to generate content that can be seen by the client side users of the application. It s kind of a domain-specific CMS lite.

可在申请的不同部分使用这一代号,作为我们某些实体的代号。 我们决定,把我们自己的国家——《公约》——《公约》——能够用于代议——在行政官——“......”——包括一块”。

Question

我们要做的是:

<form:form modelAttribute=...>
    <olo:content-editor path="content"/>
    <!-- Other form fields for this entity -->
    <form:.../>
    <form:.../>
</form:form>

<代码>olo:content-editor tag随即根据需要何种内容产生一些形式领域。 这意味着它(或者,视内容类型而定,可能不会!) 产生<>基于文件内容的编码标签,其中包含:

<input type="file" name="file/>

可以用来替换与档案内容有关的档案。

问题在于,春季的“数字”表明,文件上载要求填写<编码>enctype,以确定其发送多部分表格数据。 由于文件上载是tag/em>的一部分,而不是form。 我们认为,这是不可取的。 我们希望能够使用我们的<代码>olo:content-editor tag,而不必改动encette/code>属性。 这是可能的吗?

Possible solutions

We can think of two client-side hacks that may resolve our problem, but both seem to be rather ugly solutions:

  • Include a script in filebased content tag that changes the form enctype when it s loaded, so that it is always set to the appropriate type. (Very ugly.)
  • Submit the file data as a regular hidden form field, of which the data is set by using the HTML5 File API (administrators use a compliant browser. This seems far less ugly but still not an optimal solution.)
问题回答

暂无回答




相关问题
Using a file form field with a Java servlet

I am tring to retrieve a filename or the file itself for use in a java servlet (from a web form). I have a file form field: <form enctype="multipart/form-data" method="post" action="...

Streaming uploaded files directly into a database table

I have several applications that allow users to upload attachments that are stored inside a database table. This has worked fine for several years because it was initially intended for smallish image ...

Asynchronus File Upload with StateServer Mode

I want to implement Asynchronus File Upload. I ve tried ajax:AsyncFileUpload control. It s working fine only with InProc Mode. But I m using StateServer Mode. Any help from anybody? Thanks in ...

How do CMS upload images?

I am just playing around and trying to make a very simple CMS. Right now I what I do right now is I use "FtpWebRequest" to get the file that they want to change around and stick it into a jquery ...

File does not upload from web form in Django

Howdy - I ve written a very simple app to accept job applications including a resume upload. Running the bundled server for development locally, I can successfully upload files via the web form on ...