only send twice can submit success via mobile device(both ios and android)

Bwi Scarletake, modified 4 Years ago. Expert Posts: 327 Join Date: 12/20/10 Recent Posts
i use liferay 6.2.

i create a sample mvc project, it work fine via PC.but if i use mobile device, cell phone or pad,  first time submit, i will get green successful message, second time, the green successful message will gone and all fields be cleared, back end server(my portlet) got nothing. and I have to send again, than the green successful message shows again.

i try disable cookies from browser, yes,  it work, every time i sent message , my portlet get the request, but the green successful message shows no more.
how can i make it success every time and show success message?
thank you. 
thumbnail
Olaf Kock, modified 5 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Bwi Scarletake:

how can i make it success every time and show success message?


Please post (simplified) code
Bwi Scarletake, modified 4 Years ago. Expert Posts: 327 Join Date: 12/20/10 Recent Posts
my view.jsp
<liferay-ui:success key="<%=Constant.ETR_RI_RECORD_SUCESS_MESSAGE_KEY %>" message="<%=descriptionRecordSuccessSB.toString() %>" />
<portlet:actionurl var="etrRecordFunctionURL" name="record" />
<aui:form id="<%=Constant.ETR_RI_FORM_ID%>"     action="<%=etrRecordFunctionURL%>" method="post">
&nbsp;&nbsp; &nbsp;<aui:layout>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<aui:column>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<aui:input name="<%=Constant.ETR_RI_EMPLOYEE_ID%>"         label="<%=descriptionEmployeeId%>" value="">
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<aui:validator name="required" />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<aui:validator name="minLength">9</aui:validator>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <aui:validator name="maxLength">10</aui:validator>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</aui:input>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</aui:column>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<aui:column>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<aui:input name="<%=Constant.ETR_RI_TEMPERATURE%>"         label="<%=descriptionTemperature%>" value="">
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<aui:validator name="required" />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<aui:validator name="number"></aui:validator>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</aui:input>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<aui:select name="<%=Constant.ETR_RI_MEASUREMENT_TYPE%>" id="<%=Constant.ETR_RI_MEASUREMENT_TYPE%>"         label="<%=descriptionMeasurementType%>">
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<aui:option value="1" label="<%=descriptionEarTemperature%>" />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<aui:option value="2" label="<%=descriptionForehead %>" />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</aui:select>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</aui:column></aui:layout></aui:form>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<aui:button-row>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<aui:button type="submit" value="<%=descriptionSubmit%>" />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</aui:button-row>
&nbsp;&nbsp; &nbsp;


my portliet
public class RecrodInterfacePortlet extends com.liferay.util.bridges.mvc.MVCPortlet {
&nbsp;&nbsp; &nbsp;public static final String PORTLET_NAME = Constant.DEFAULT_PORTLET_NAME_PREFIX + "RecrodInterfacePortlet";
&nbsp;&nbsp; &nbsp;private static Log LOGGER = LogFactoryUtil.getLog(RecrodInterfacePortlet.class);
&nbsp;&nbsp; &nbsp;public void record(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;String employeeId = ParamUtil.getString(actionRequest, Constant.ETR_RI_EMPLOYEE_ID).trim().toUpperCase();
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;double temperature = ParamUtil.getDouble(actionRequest, Constant.ETR_RI_TEMPERATURE);
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;String employeeName = RecordLocalServiceUtil.getEmployeeName(employeeId);
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;int measurementType = ParamUtil.getInteger(actionRequest, Constant.ETR_RI_MEASUREMENT_TYPE);
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;String measurementTypeStr = Constant.ETR_RI_MEASUREMENT_TYPE_EAR_DEFAULT;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (measurementType == 2) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;measurementTypeStr = Constant.ETR_RI_MEASUREMENT_TYPE_FOREHEAD_DEFAULT;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (employeeName == null || employeeName.trim().length() == 0) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LOGGER.info("employeeId:" + employeeId + "it not correct.");
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SessionErrors.add(actionRequest, "employeeId:" + employeeId + "it not correct.");
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;} else {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LOGGER.info("employeeId:" + employeeId + " temperature:" + temperature);
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;try {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;RecordLocalServiceUtil.record(employeeId, employeeName, temperature, measurementTypeStr);
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SessionMessages.add(actionRequest, Constant.ETR_RI_RECORD_SUCESS_MESSAGE_KEY);
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;actionRequest.setAttribute(Constant.ETR_RI_RECORD_SUCESS_TIME, CalendarHelper.getTimeDescriptionSubLong(new Date()));
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;} catch (Exception ex) {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LOGGER.error(ex);
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;}
as you can see, it's very simple mvc, and it's work fine, only in mobile device, we have to submit twice.
thank you.and now i try re-open the cookies. doesn't work.
Bwi Scarletake, modified 4 Years ago. Expert Posts: 327 Join Date: 12/20/10 Recent Posts
i fix this issue. i added session.enable.persistent.cookies=false
in my portal-ext.properties
thank you.