title: Liferay Portlet Basic MVC Flow and View Selection
body: <p>I'm trying to develop a basic portlet with LifeRay 6.1.  I'm well versed with various MVC implementations, but I find Liferay / java portlets somewhat confusing - especially the execution pipeline.</p>
  
  <p>With most MVC frameworks I've worked with the premise is simple request > router > controller > view.  The view selection is usually based the controller / action naming convention, a parameter passed in with the request or is manually loaded in the controller action.</p>
  
  <p>With LifeRay MVCPortlet it doesn't work like this; there's at least two types of URL that can be generated - a render url and an action url.  </p>
  
  <p>The render URL seems to totally bypass what I perceive to be the controller - a subclass of MVCPortlet.  It seems as though these urls are relatively easy to generate and the request loads the expected view, if you can call it that considering for all intents and purposes it completely bypasses the controller and has nothing to do with a model.</p>
  
  <pre><code>&lt;portlet:renderURL var="badminURL"&gt;&lt;portlet:param name="mvcPath" value="/views/edit.jsp" /&gt;&lt;/portlet:renderURL&gt;
  </code></pre>
  
  <p>The action URL goes through the controller, the action is called and then the default view is used to render the portlet regardless of what I supply as an mvc path.</p>
  
  <pre><code>&lt;portlet:actionURL var="adminURL" name="editSlide"&gt;&lt;portlet:param name="mvcPath" value="/views/edit.jsp" /&gt;&lt;/portlet:actionURL&gt;
  </code></pre>
  
  <p>Reading up through the class tree I can see that a property is used to define the view that gets used depending on the portlet mode. i.e.</p>
  
  <pre><code>this.viewTemplate = "/views/edit.jsp";
  this.editTemplate = "/views/edit.jsp";
  </code></pre>
  
  <p>Again setting this after init() is called only seems to have any effect when not accessed via an actionURL.</p>
  
  <p>So I guess my question is pretty basic, how are views selected and how to I select one to use when going via an actionURL.  Also any outline on execution pipeline would be very helpful</p>