【问题标题】:Liferay 7.0 redirect to another jsp page with js click functionLiferay 7.0 使用js点击功能重定向到另一个jsp页面
【发布时间】:2017-06-29 16:28:06
【问题描述】:

我有两个 jsp,view1 jsp 和 view2.jsp。我在 view1 jsp 中有一个按钮,我希望该按钮将我重定向到 view2.jsp。我正在关注 liferay 中的教程,我只想知道如何使用 jquery 中的点击功能来做到这一点

渲染命令:

@Component(
    immediate = true,
    property = {\
       "javax.portlet.name=" + HelloWorldPortletKeys.HELLO_WORLD,
       "mvc.command.name=/jsp/view2"
    },
    service = MVCRenderCommand.class
)
public class EditEntryMVCRenderCommand implements MVCRenderCommand {
@Override
public String render(
    RenderRequest renderRequest, RenderResponse renderResponse) {

    return "/jsp/view2.jsp";
}
}

view2.jsp

<portlet:renderURL var="view2URL">
    <portlet:param name="mvcRenderCommandName" value="/jsp/view2" />
    <portlet:param name="entryId" value="<%= String.valueOf(entry.getEntryId()) %>" />
</portlet:renderURL>

JS点击功能

$("#buttonid").click(function() {
    $("#div1").load("${view2URL}");

)};

【问题讨论】:

    标签: javascript jquery jsp liferay-7


    【解决方案1】:

    使用 Ajax 可以实现这种需求。 在serveresource 方法中添加以下行

    include("/jsp/loadResult.jsp", resourceRequest, resourceResponse);
    

    【讨论】:

      猜你喜欢
      • 2018-03-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-24
      • 1970-01-01
      • 2013-09-05
      • 2014-05-17
      • 2019-08-04
      相关资源
      最近更新 更多