I am using Liferay as platform.I have created drop down list with 2 values (true/false ("false" is selected by default)) once I click on update button , it should be updated in preferences field (i.e drop down list). I am using below code but its giving null value. I am not able to read/get selected drop down value from EditPreferences.jsp to EditController.java. If its possible to render value from Editpreferences.jsp to EditConytroller Class then That should be fine for me. thank you for any kind of suggestion.
This is my code in EditPreferences.jsp
<portlet:defineObjects />
<script type="text/javascript" src="js/jquery.js"></script>
<%@page import="javax.portlet.PortletPreferences" %>
<%
PortletPreferences pref = renderRequest.getPreferences();
String IsCollege = pref.getValue("IsCollege","");
Locale locale = renderRequest.getLocale();
ResourceBundle bundle = portletConfig.getResourceBundle(locale);
String updated = (String) request.getAttribute ("preferences-updated");
if (updated != null && updated.equals ("true")) {
%>
<div class="portlet-msg-info">
<liferay-ui:message key="preferences-update-successful" />
</div>
<%
}
%>
<portlet:actionURL var="actionOneMethodURL">
<portlet:param name="action" value="actionOne"></portlet:param>
</portlet:actionURL>
<form method="POST" action="${actionOneMethodURL}" >
<tr>
<td>
IsCollege:
</td>
<td>
<select id="IsCollege">
<option value="false" selected="selected">False</option>
<option value="true">True</option>
</select>
</td>
</tr>
<tr>
<td colspan=2>
<input type="submit" id="updateBtn" value="Update">
</td>
</tr>
</form>
EditController.java
@ActionMapping(params = "action=actionOne")
public void setPublisherPref(ActionRequest request, ActionResponse response)
throws Exception {
PortletPreferences pref = request.getPreferences();
String IsCollege = ParamUtil.getString(request, "IsCollege", "");
pref.setValue("IsCollege", IsCollege);
pref.store();
request.setAttribute("preferences-updated", "true");
}
<select name="IsCollege">
– Pankaj Kathiriya<select name="<portlet:namespace/>IsCollege">
. – Tomas Pinos