How can I call the action method inside the MVCPortlet class onclick of the Submit button

前端 未结 2 2064
滥情空心
滥情空心 2021-01-26 11:06

I am using Liferay 6 for development.

I have added JQuery support to Liferay this way inside the file liferay-portlet.xml file



        
相关标签:
2条回答
  • 2021-01-26 11:19

    For your jsp you're close. Needs a bit of reordering, using the actionURL and the portlet's namespace. Warning - typed in stackoverflow answer window, didn't actually compile/run:

    <liferay-portlet:actionURL name="registerUser" var="registerUserURL"></liferay-portlet:actionURL>
    <form action="<%=registerUserURL%>">
        <div>
            <input class="default-value" type="text" name="<portlet:namespace/>Name" value="Name" />
            <input class="default-value" type="text" name="<portlet:namespace/>Password" value="Password" />
        </div>
    </form>
    
    <div class="fieldgroup">
     <input type="submit" value="Register" class="submit">
    </div>
    

    As you extend Liferay's MVC portlet the portlet side looks ok - just use request.getParameter("Name"); there.

    This is not related to jQuery at all, right?

    0 讨论(0)
  • 2021-01-26 11:26

    Don't forget to add the following on the top in your jsp:

    <%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
    
    0 讨论(0)
提交回复
热议问题