Prasad
Prasad

Reputation: 686

Issue while saving the dynamic field values in the preferences

I have already posted one question on the same issue. But I'm not able to solve my issue and not able to move forward in my task.

I have created a editable portlet where in the configuration page I am showing he dynamic questions which are fetching form the database. So for the same reason I am iterating my array list and creating the input fields dynamically as follows,

Iterator<String> itr = al.iterator();
 while(itr.hasNext())
 {
         String columnVal = itr.next();
         columnVal = columnVal.trim().toLowerCase();
         %>
         <aui:input name="<%=columnVal%>" type="checkbox" />
         <%
 }

With the above code the fields are creating dynamically with proper labels and seems to be fine.

When I try to save these dynamic field values in the preference I changed my input statement syntax to the proper way by adding the prefix as "preferences--" and suffix as "--" as shown below,

<aui:input name="preferences--<%=columnVal%>--" type="checkbox" />

I don't know what syntax is wrong in the above statement. But I am not able to see the label names in UI. instead of showing the proper label names for all labels it is showing <%=columnVal%> on UI.

I am using default configuration action class in my liferay-portlet.xml as mentioned below,

<configuration-action-class>com.liferay.portal.kernel.portlet.DefaultConfigurationAction</configuration-action-class>

Can any one please correct my syntax and help me to save my dynamic field values in the preferences.

Upvotes: 1

Views: 191

Answers (1)

Pankaj Kathiriya
Pankaj Kathiriya

Reputation: 4210

From reference link's comment section:

According to JSP 2.1 Specification multiple expressions and mixing of expressions and string constants are not permitted.

So you have to use below code in your case:

<aui:input name='<%="preferences--"+columnVal+"--"%>' type="checkbox" />

Upvotes: 2

Related Questions