<af:commandButton text="Post Me" id="cb1">
<af:clientListener type="action" method="customPostHandler"/>
</af:commandButton>
<af:resource type="javascript">
function customPostHandler(event) {
var form = document.forms[0];
form.action = '/some-context-root/sampleservlet';
form.submit();
event.cancel();
}
</af:resource>
You can download the sample workspace from here.[Runs with Oracle JDeveloper 11g R1 PS2]
How to run this sample?
Run the login.jspx page. This page is pre-populated with values for user name and password fields, leave the default values as is. Click on 'Post Me' button. This in turn posts data to 'SampleServlet' which processes the posted data, and on success, request is getting redirected to welcome.jspx
No comments:
Post a Comment