标签: portlet

Spring portlet mvc在提交编辑表单期间验证失败

我有一个几乎没有验证的表格.在新表单提交期间,如果验证失败,我可以看到这些错误消息.但是,在我有意地将字段更改为空白并且提交表单时编辑表单期间,Jsp页面上没有显示错误消息,但我可以将控制器中的错误数量设置为1.

<portlet:actionURL var="actionUrl">
    <portlet:param name="action" value="editCommunity"/>
    <portlet:param name="communityID" value="${community.id}"/>
</portlet:actionURL>

<liferay-ui:tabs names="Details" />

<form:form commandName="community" method="post" action="${actionUrl}">
    <form:hidden path="id"/>

    <div><form:errors cssClass="portlet-msg-error" path="*"/></div>

    <table class="manager-detail">
        <tr>
            <th class="portlet-form-field-label">
                <label for="community_label_name"><spring:message code="community.label.name"/></label>         
                <span class="manager-field-required">*</span>
            </th>
            <td><form:input id="community_label_name" cssClass="portlet-form-input-field" path="name" size="30" maxlength="80" /></td>
        </tr>
Run Code Online (Sandbox Code Playgroud)

我的编辑控制器方法.....

渲染编辑表格

@RequestMapping(params = "action=editCommunity")
public String showEditCommunityForm(final RenderRequest request,
        @RequestParam(value="communityID") Long id, final Model model)
        throws CommunityNotFoundException {
    final ThemeDisplay themeDisplay = (ThemeDisplay) request
            .getAttribute(WebKeys.THEME_DISPLAY);

    model.addAttribute("community", communityService.getCommunity(id));


    return "communityEdit";
}
Run Code Online (Sandbox Code Playgroud)

编辑的表格已提交

@RequestMapping(params = "action=editCommunity")
public void submitEditCommunityForm(final ActionRequest …
Run Code Online (Sandbox Code Playgroud)

validation model-view-controller spring portlet

2
推荐指数
1
解决办法
3596
查看次数

如何在Liferay中跨2个不同的portlet共享属性文件?

我想创建一个公共属性文件,可以在Liferay中的2个portlet之间共享.或者更确切地说,它可以放在哪里,以便所有portlet都可以访问同一个文件.

portlet liferay

2
推荐指数
1
解决办法
1691
查看次数

Liferay:从init()获取PortletID和companyID

也许在init(PortletConfig)中通过PortletConfig

事情是使用

((PortletConfigImpl) portletConfig).getPortletId();
Run Code Online (Sandbox Code Playgroud)

是不允许的,因为在package.properties中添加portal-impl.jar会在尝试执行build ant target时抛出异常,说不再允许这样做

对于companyID,我直接不知道从哪里开始.我目前正在使用

long companyId = CompanyLocalServiceUtil.getCompanies().get(0).getCompanyId();
Run Code Online (Sandbox Code Playgroud)

但是一旦我有一家以上的公司,它就会失败

如果我能以某种方式得到Portlet对象,我认为这足以获得portletId和companyId

java portlet init liferay

2
推荐指数
1
解决办法
7032
查看次数

如何将javascript文件添加到liferay项目中的liferay-portlet.xml

我正在使用liferay 6.0.6开发一个应用程序,并希望将javascript文件添加到我的portlet中.如果我有两个或三个文件javascript我怎么能添加主题?

所以这是我的liferay-portlet.xml:

<portlet>
  <portlet-name>portletName</portlet-name>
  <icon>/icon.png</icon>
  <instanceable>true</instanceable>
  <header-portlet-css>/css/main.css</header-portlet-css>
  <footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
  <css-class-wrapper>portletName-portlet</css-class-wrapper>
</portlet>
Run Code Online (Sandbox Code Playgroud)

javascript portlet liferay-6

2
推荐指数
1
解决办法
7908
查看次数

Kotlin Liferay portlet 可能吗?

由于我找不到任何示例,我想知道是否可以创建一个使用(纯)Kotlin 而不是传统 Java 的 Liferay Portlet。

java portlet liferay kotlin

2
推荐指数
1
解决办法
620
查看次数

Liferay 7.3.5GA6自定义索引搜索和ddmFieldArray

我正在尝试使用 SearchContext、IndexSearcherHelperUtil 和所有其他东西为 Liferay 7.3.5 GA6 开发一个自定义 Web 内容搜索 portlet。

\n

我有一些具有不同字段的 DDMStructure,从我在 elasticsearch 索引上看到的情况来看,这些字段在嵌套文档中建立索引,如下所示:

\n
"ddmFieldArray": [\n{\n"ddmFieldName": "ddm__text__37702__nome_it_IT",\n"ddmValueFieldName": "ddmFieldValueText_it_IT",\n"ddmFieldValueText_it_IT": "Nome esempio",\n"ddmFieldValueText_it_IT_String_sortable": "nome esempio"\n}\n,\n{\n"ddmFieldName": "ddm__text__37702__descrizione_breve_it_IT",\n"ddmValueFieldName": "ddmFieldValueText_it_IT",\n"ddmFieldValueText_it_IT": "Esempio di descrizione breve da indicizzare",\n"ddmFieldValueText_it_IT_String_sortable": "esempio di descrizione breve da indicizzare"\n}\n]\n
Run Code Online (Sandbox Code Playgroud)\n

这与我以前知道的旧方式不同,其中自定义字段的索引如下ddm__[keyword/text]__[structure_id]__[field_name]

\n

现在,我明白\xc2\xa0这种不同的索引方式是由于为了避免弹性问题而进行的改进(已超出总字段的限制)但是......执行搜索后, com.liferay.portal中没有ddmFieldArray .kernel.search.Document .getFields,因此我无法从弹性搜索索引中获取 ddmstruct 字段值。

\n

这是代码:

\n
long journalArticleClassId = ClassNameLocalServiceUtil.getClassNameId(JournalArticle.class.getName());\n\nSearchContext searchContext = new SearchContext();\nsearchContext.setClassTypeIds(new long[] {journalArticleClassId});\nsearchContext.setCompanyId(companyId);\nsearchContext.setStart(QueryUtil.ALL_POS);\nsearchContext.setEnd(QueryUtil.ALL_POS);\n        \nBooleanQuery query = new BooleanQueryImpl();\n            \n        \nMatchQuery approvedQuery = new MatchQuery(Field.STATUS, String.valueOf(WorkflowConstants.STATUS_APPROVED));\n\nquery.add(approvedQuery, BooleanClauseOccur.MUST.getName());\n\n\nHits resultHits = IndexSearcherHelperUtil.search(searchContext, …
Run Code Online (Sandbox Code Playgroud)

java portlet liferay elasticsearch liferay-7

2
推荐指数
1
解决办法
2240
查看次数

如何使用AJAX调用具有指定URL的Controller的@RequestMapping方法

我是Spring和Portlet的新手.我想用jqgrid来显示一些列表.我试图在控制器中调用一个方法,该方法使用@RequestMapping进行注释,但该方法未被调用

我的控制器有以下方法

@Controller(value = "myController")
public class MyController {
    @RequestMapping(value="/myURL",method=RequestMethod.GET)
    public @ResponseBody MyDTO  initItemSearchGrid(RenderResponse response, RenderRequest request){
        MyDTO myDto=new MyDTO();
        return myDto;
    }
}
Run Code Online (Sandbox Code Playgroud)

我的JSP代码使用AJAX

var urlink="/myURL"; /* myURL is the exact String written in value Attribute of
                              resourceMapping in Controller*/
$.ajax({
    url :urlink,
    cache: false,
    data:$('#myForm').formSerialize(),
    dataType: "json",
    type: "GET",
    contentType: "application/json; charset=utf-8",
    success: function(jsondata){
       ...
    }
});
Run Code Online (Sandbox Code Playgroud)

当上面的AJAX代码正在执行时,我的方法不会被调用.

ajax spring portlet spring-portlet-mvc

1
推荐指数
1
解决办法
1万
查看次数

AUI没有定义,Liferay在jsp页面中没有定义错误?

我在liferay中使用我的自定义portlet.但不知何故,当我运行我的portlet我在错误控制台中有以下错误

Timestamp: 12/10/2012 12:33:19 PM
Error: ReferenceError: AUI is not defined
Source File: http://localhost:8080/eMenuAdvertise-portlet/js/jquery.min.js
Line: 4

Timestamp: 12/10/2012 12:34:21 PM
Error: ReferenceError: Liferay is not defined
Source File: http://localhost:8080/eMenuAdvertise-portlet/js/jquery.min.js
Line: 3
Run Code Online (Sandbox Code Playgroud)

那么为什么这个错误会出现在我的jsp页面中的一些jquery?

<%@ page import="net.sf.jasperreports.engine.JRException"  %>
<%@ page import="net.sf.jasperreports.engine.JasperExportManager" %>
<%@ page import="net.sf.jasperreports.engine.JasperFillManager" %>
<%@ page import="net.sf.jasperreports.engine.JasperPrint" %>
<%@ page import="net.sf.jasperreports.engine.JasperPrintManager" %>

<%@page import="com.liferay.portal.model.Role"%>
<%@ include file="/init.jsp"%>
<%@page import="com.liferay.portal.model.Organization"%>
<%@page import="com.liferay.portal.util.PortalUtil"%>
<style>
.borderColor{border: 1px solid #C62626;}
</style>
<portlet:renderURL var="ajaxaddnewrestURL">
    <portlet:param name="jspPage" value="/jsps/ajaxnewrest.jsp" />
</portlet:renderURL>
<portlet:renderURL var="editrestURL">
    <portlet:param name="jspPage" value="/jsps/Ajax_editrest.jsp" /> …
Run Code Online (Sandbox Code Playgroud)

portlet liferay liferay-6 liferay-theme

1
推荐指数
1
解决办法
9577
查看次数

如何从portlet导航到portlet

我的问题是如何从一个portlet转到另一个portlet.

我的情况是这样的:

用户可以查看特定portlet的view.jsp.当他点击一个按钮时,该页面将显示另一个portlet的view.jsp.也许这称为portlet重定向,但我不知道如何实现它.

也许一个解决方案可能是同一个portlet中的不同jsp文件,但我想通过portlet导航而不是jsps.

如果有人能够为我提供代码示例或文献参考,这将有助于我找到如何实现这种情况.

java portlet liferay

1
推荐指数
1
解决办法
717
查看次数

Liferay 7 CE-Osgi模块(Liferay MVC Portlet)无法加载javascript文件

我创建了一个新的liferay osgi模块。我的控制器具有以下标签:

@Component(
immediate = true,
property = {
    "com.liferay.portlet.display-category=Bla Modules",
    "com.liferay.portlet.instanceable=true",
    "javax.portlet.display-name=EventCalendar",
    "javax.portlet.init-param.template-path=/",
    "javax.portlet.expiration-cache=0",
    "com.liferay.portlet.footer-portlet-javascript=fullcalendar_year.js,/js/custom/main.js",
    "com.liferay.portlet.header-portlet-css=/css/fullcalendar_year.css,/css/fullcalendar.css",
    "javax.portlet.init-param.view-template=/view.jsp",
    "javax.portlet.resource-bundle=content.Language",
    "javax.portlet.security-role-ref=administrator,power-user,user"
},
service = Portlet.class
Run Code Online (Sandbox Code Playgroud)

但是财产

com.liferay.portlet.footer-portlet-javascript

不加载所有js文件,仅在调用一个文件的情况下才加载文件,如果不止一个,则不加载任何文件。

这是一个错误还是我做错了什么?

javascript osgi portlet liferay-7

1
推荐指数
1
解决办法
1708
查看次数