You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Mok <mo...@hotmail.com> on 2001/10/03 17:33:17 UTC

SSL revisited again

Hi

There was a previous discussion in regards to catering for SSL redirection.
These emails are listed on Ted's website (www.husted.com). I took the
suggestions from these discussion and managed to implement the SSL
redirection. However I realise that beans assigned to the request object
disappear after redirection but beans assigned to the session stays.

My shopping cart check out scenario.

 customer_mailing_address.jsp --> checkAddressAction.do -->
customer_creditcard_detail.jsp --> processCreditCardAction.do -->
confirmpurchase.jsp.

STRUTS-Config.xml

    <action    path="/checkout1"   type="checkOutAction.do"
attribute="customerForm"
              scope="request" validate="false">
      <forward name="success"
path="/jsp/customer_mailing_address.jsp"/>
    </action>
    <action    path="/checkout2"   type="checkAddressAction.do"
attribute="customerForm"
              scope="request" validate="false">
      <forward name="success"
path="/jsp/customer_creditcard_detail.jsp"/>
    </action>
    <action    path="/checkout3"   type="processCreditCardAction.do"
attribute="customerForm"
              scope="request" validate="false">
      <forward name="success"              path="/jsp/confirmpurchase.jsp"/>
    </action>

We have a requirement to secure the browser when the guest enters their
credit card info on the customer_creditcard_detail.jsp and to unsecure the
browser when displaying the purchase confirmation confirmpurchase.jsp.

Hence I placed some code in checkAddressAction to 'redirect' the protocol
from "http" to "https" which works however all the "<bean:write ../>"
statement fails in the customer_creditcard_detail.jsp as the redirection
clears out all request attribute (this is what I observe or I could be
totally wrong). Similarly I placed some code in processCreditCardAction.do
to convert the protocol from "https" back to "http", again the "<bean:write
../>" in confirmpurchase.jsp fails. When I change the scope to "session"
both pages work.

    <action    path="/checkout1"   type="checkOutAction.do"
attribute="customerForm"
              scope="session" validate="false">
      <forward name="success"
path="/jsp/customer_mailing_address.jsp"/>
    </action>
    <action    path="/checkout2"   type="checkAddressAction.do"
attribute="customerForm"
              scope="session" validate="false">
      <forward name="success"
path="/jsp/customer_creditcard_detail.jsp"/>
    </action>
    <action    path="/checkout3"   type="processCreditCardAction.do"
attribute="customerForm"
              scope="session" validate="false">
      <forward name="success"              path="/jsp/confirmpurchase.jsp"/>
    </action>

Personally I would not use scope="session" but in this case I have no other
choice. I would like to hear how you would go about overcoming this scenario
(ie still be able to pass beans to the jsp via the request object instead of
the session object) ?

Thanks in advance.


Michael Mok
www.teatimej.com


Re:

Posted by ma...@tumbleweed.com.
The <html:select> tag is designed to work in cooperation with the form bean,
so that the option which is initially selected is determined from the form
bean, and the value selected at form submit time is set in the form bean
prior to perform() being called.

If you want to have a select tag that is unrelated to a form bean, then you
should use the regular HTML <select> tag, and not the Struts <html:select>
tag.

Hope this helps.

--
Martin Cooper


----- Original Message -----
From: "Roumen Ganeff" <ga...@wizcom.bg>
To: <st...@jakarta.apache.org>
Sent: Wednesday, October 03, 2001 8:41 AM
Subject: <html:select>


> Hi
>
> I am trying to display a <select>,  which will be for informational
purposes
> only, and thus is not connected to the form I am currently displaying. It
> fills in the <options> correctly, but the <select> itself demands to have
> "property='something'". When I write it, it tries to look it up against
the
> current ActionForm that is being displayed, and fails miserably. I move it
> outside the <form> tag, it still complains.
> now, I can write this with a simple <select>, and generate the options
with
> a <iterate>, or write e custom tag for this <select>.. but.. Is there a
> problem in Struts, or am being stupid?
>
> Thanx
> Ganeff
>



Posted by Roumen Ganeff <ga...@wizcom.bg>.
Hi

I am trying to display a <select>,  which will be for informational purposes
only, and thus is not connected to the form I am currently displaying. It
fills in the <options> correctly, but the <select> itself demands to have
"property='something'". When I write it, it tries to look it up against the
current ActionForm that is being displayed, and fails miserably. I move it
outside the <form> tag, it still complains.
now, I can write this with a simple <select>, and generate the options with
a <iterate>, or write e custom tag for this <select>.. but.. Is there a
problem in Struts, or am being stupid?

Thanx
Ganeff