I have a JSF 1.2 page which has radio buttons to choose one of 2 options. I have a jQuery function to submit the form with a change in action, but give this error.
javax.servlet.ServletException: viewId:/buildVehicle.jsf - View /buildVehicle.jsf could not be restored.
root cause
javax.faces.application.ViewExpiredException: viewId:/buildVehicle.jsf - View /buildVehicle.jsf could not be restored.
com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:189)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
Here is the jQuery function which submits to to render the same view with some change in request param:
var make = $('input:radio[name=selectMake]:checked').val(); //returns NI/IN
$("form#buildVehicleForm").attr("action", "/buildVehicle/buildVehicle.jsf?action=initTrim&make=" + make);
$('form#buildVehicleForm').submit();
In the JSF page I am using simple HTML radio buttons. I cannot change it to JSF <h:selectOneRadio>
component, because the HTML code that was given to me, it is not easy to convert to JSF code.
<div class="filedItem margin-10px floatLeft">
<input type="radio" id="id1" name="selectMake" onchange="changeMake()" value="N" />
</div>
<div class="filedItem margin-10px floatLeft">
<input type="radio" id="id2" name="selectMake" onchange="changeMake()" value="I" />
</div>