Dear all,
I have a Registration form, when user click a Sign in button, the
OrderAction.java is supposed redirect it to another page, but
currently it stay on the same page (the registration form).
Please refer to the following codes:
-- OrderAction.java
/** @struts.action name="OrderForm" path="/onlinepayment_portlet/reg"
* scope="session"
* input="/portlet/onlinepayment_portlet/reg.jsp"
*
* @struts.action-forward name="/onlinepayment_portlet/reg"
path="/onlinepayment_portlet/reg.jsp"
* @struts.action-forward name="/onlinepayment_portlet/user_info"
path="/onlinepayment_portlet/user_info.jsp"
*/
public class OrderAction extends PortletAction{
/*
public ActionForward execute(ActionMapping mapping,ActionForm
form, HttpServletRequest request, HttpServletResponse response) throws
IOException,ServletException{
return mapping.findForward("success");
}
*/
public ActionForward execute(
ActionMapping mapping, ActionForm form,
HttpServletRequest req,
HttpServletResponse res)
throws Exception {
//Get form and initialize only if number list not empty
OrderForm orderForm = (OrderForm) form;
String pw = orderForm.getPassword().trim();
String emailaddr = orderForm.getEmailAddress().trim();
if (pw.length() > 0 && emailaddr.length() > 0 ) {
return
mapping.findForward("/onlinepayment_portlet/user_info");
}
else
return
mapping.findForward("/onlinepayment_portlet/user_info");
}
public ActionForward render(
ActionMapping mapping, ActionForm form,
PortletConfig config,
RenderRequest req, RenderResponse res)
throws Exception {
OrderForm orderForm = (OrderForm)form;
return mapping.findForward("/onlinepayment_portlet/user_info");
}
}
-- reg.jsp:
<%@ include file="/html/portlet/onlinepayment_portlet/init.jsp" %>
<bean:define id="email_address" name="OrderForm"
property="emailAddress" type="java.lang.String" />
<html:form action="/onlinepayment_portlet/reg" method="post"
focus="emailAddress">
<table border="0" cellspacing="5" cellpadding="0">
<tr>
<td nowrap><div class="jc_tran_title_text"><bean:message
key="form.email_address"/></div></td>
</tr>
<tr>
<td nowrap>
<html:text name="OrderForm" property="emailAddress" size="50" />
</td>
</tr>
<tr>
<td nowrap>
</td>
</tr>
<tr>
<td nowrap><div class="jc_tran_title_text">Password</div></td>
</tr>
<tr>
<td nowrap>
<input type="password" name="custPassword" size="50" value=""
class="jc_tran_input">
</td>
</tr>
<tr>
<td nowrap>
</td>
</tr>
<tr>
<td nowrap>
</td>
</tr>
<tr>
<td nowrap>
<html:submit><bean:message key="button.sign_in"/></html:submit>
</html:form>
<html:submit><bean:message key="button.new_visitor"/></html:submit>
<html:submit><bean:message key="button.cancel_checkout"/></html:submit>
</td>
</tr>
</table>
-- user_info.jsp
<%@ include file="/html/portlet/onlinepayment_portlet/init.jsp" %>
<bean:define id="first_name" name="OrderForm" property="firstName"
type="java.lang.String" />
<bean:define id="last_name" name="OrderForm" property="LastName"
type="java.lang.String" />
<bean:define id="shipping_address" name="OrderForm"
property="shippingAddress" type="java.lang.String" />
<bean:define id="billing_address" name="OrderForm"
property="billingAddress" type="java.lang.String" />
<html:form action="/onlinepayment_portlet/user_info" method="post"
focus="emailAddress">
<table border="0" cellspacing="5" cellpadding="0">
<tr>
<td nowrap><div class="jc_tran_title_text"><bean:message
key="form.firstname"/></div></td>
<td nowrap> <html:text name="OrderForm" property="firstName"
size="50" /> </td>
<td nowrap><div class="jc_tran_title_text"><bean:message
key="form.lastname"/></div></td>
<td nowrap> <html:text name="OrderForm" property="lastName"
size="50" /> </td>
</tr>
<tr> <td nowrap> </td> </tr>
<tr> <td nowrap><div class="jc_tran_title_text"><bean:message
key="form.email_address"/></div></td> </tr>
<tr> <td nowrap> <html:text name="OrderForm" property="emailAddress"
size="50" /> </td>
</tr> <tr> <td nowrap> </td> </tr>
<tr> <td nowrap><div class="jc_tran_title_text">Password</div></td> </tr>
<tr> <td nowrap> <input type="password" name="custPassword"
size="50" value="" class="jc_tran_input"> </td>
</tr> <tr> <td nowrap> </td> </tr>
<tr> <td nowrap> </td> </tr>
<tr> <td nowrap>
<html:submit><bean:message key="button.sign_in"/></html:submit>
</html:form>
<html:submit><bean:message key="button.new_visitor"/></html:submit>
<br>
<br>
<html:submit><bean:message key="button.cancel_checkout"/></html:submit>
</td>
</tr>
</table>
Your help is much appreciated.
Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]