Redirect to a URL - How to do in JFS?
843844Apr 28 2008 — edited Apr 28 2008Hi,
I am new to JSF, and I am currently working on an application in which a click of submit button should redirect the page to another URL along with the login credentials, and should return back authorizing the login information.
the existing code has not implemented this, and the existing JSF code is,
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
<f:view>
<ui:page binding="#{EntryPage.page1}" id="page1">
<ui:html binding="#{EntryPage.html1}" id="html1">
<ui:head binding="#{EntryPage.head1}" id="head1">
<ui:link binding="#{EntryPage.link1}" id="link1" url="/resources/stylesheet.css"/>
</ui:head>
<ui:body binding="#{EntryPage.body1}" id="body1" style="-rave-layout: grid">
<ui:form binding="#{EntryPage.form1}" id="form1">
<div style="left: 60px; top: 0px; position: absolute">
<jsp:directive.include file="MainHeader.jspf"/>
</div>
<ui:panelLayout binding="#{EntryPage.layoutPanel1}" id="layoutPanel1" style="border-style: solid; border-color: rgb(204, 204, 204) rgb(204, 204, 204) rgb(204, 204, 204) rgb(204, 204, 204); background-color: rgb(204, 204, 204); height: 348px; left: 330px; top: 230px; position: absolute; width: 448px; -rave-layout: grid">
<ui:label binding="#{EntryPage.label1}" id="label1"
style="font-family: 'Arial','Helvetica',sans-serif; font-size: 12px; font-weight: bold; left: 80px; top: 124px; position: absolute" text="Gatorlink Id"/>
<ui:textField binding="#{EntryPage.userid}" id="userid" style="left: 160px; top: 120px; position: absolute"/>
<ui:label binding="#{EntryPage.label2}" id="label2" style="left: 90px; top: 183px; position: absolute" text="Password"/>
<ui:textField binding="#{EntryPage.password}" id="password" style="left: 160px; top: 180px; position: absolute"/>
<ui:button *action="#{EntryPage.loginButton_action}"* binding="#{EntryPage.loginButton}" id="loginButton"
style="font-family: 'Arial','Helvetica',sans-serif; font-size: 12px; font-weight: bold; height: 29px; left: 139px; top: 250px; position: absolute; width: 60px" text="Login"/>
<ui:button binding="#{EntryPage.cancelButton}" id="cancelButton"
style="font-family: 'Arial','Helvetica',sans-serif; font-size: 12px; font-weight: bold; height: 29px; left: 239px; top: 250px; position: absolute; width: 68px" text="Cancel"/>
<ui:staticText binding="#{EntryPage.staticText1}" id="staticText1"
style="color: rgb(0, 0, 255); font-family: 'Arial','Helvetica',sans-serif; font-size: 14px; font-weight: bold; left: 80px; top: 50px; position: absolute" text="Please enter your gatorlinkid and Password"/>
<ui:image binding="#{EntryPage.image1}" id="image1" style="left: 40px; top: 80px; position: absolute" url="/resources/triplebar.jpg" width="380"/>
</ui:panelLayout>
</ui:form>
</ui:body>
</ui:html>
</ui:page>
</f:view>
</jsp:root>
How to make this work -- clicking a button should redirect to a URL, and the control should return back to another URL. The corresponding JSP code would be the below. How do I merge with the JSF code above?
<form action="https://login.gatorlink.ufl.edu/authenticate.cgi" method="POST">
<input type="hidden" name="return" value="http://localhost:8080/Authentication/faces/gatorlink.jsp">
Thanks.