简体   繁体   English

Liferay:如何从Portlet首选项上载图像?

[英]Liferay: how can i upload a image from portlet preferences?

Using liferay 6.2, I'm currently trying to create a portlet where a image is displayed. 我目前正在使用liferay 6.2创建一个显示图像的portlet。

I have already done this but I need to be able to change the image from the preferences uploading a new one. 我已经做到了,但是我需要能够通过上传新图片的首选项来更改图片。 I already have a form to upload a file but I'm not able to upload the file and show it on the portlet. 我已经有一个上传文件的表单,但是我无法上传文件并将其显示在portlet上。

This is the form in the edit.jsp 这是edit.jsp中的表格

<aui:form action="<%=editPreferencesURL%>" method="post">
<aui:input label="image" name="Image" type="file"/>
<aui:button type="submit" />
</aui:form>

This is the renderURL: 这是renderURL:

<portlet:renderURL var="editPreferencesURL">
   <portlet:param name="mvcPath" value="/html/folder/edit.jsp" />
</portlet:renderURL>

The editPreferencesURL that you mention is a renderURL - for posting a form you'll need an actionURL . editPreferencesURL你提到是renderURL -用于提交表单,你需要一个actionURL

A renderURL is typically used to show the raw form (eg it's fine to use it to link to the edit mode form) but not for updating data. renderURL通常用于显示原始表单(例如,可以使用它链接到编辑模式表单),但不能用于更新数据。 During render a portlet cannot change state, during action it can. 渲染期间,Portlet无法更改状态,而在操作期间,它可以更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM