中国开发网: 论坛: 程序员情感CBD: 贴子 384387
wynnhjg: 这符合吗?
public ActionForward execute( ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response )
{
CheckoutShippingForm theForm = (CheckoutShippingForm)form;
String forward = Constants.FORWARD_FAILURE;
String title = theForm.getTitle();
String firstName = theForm.getFirstName();
String middleName = theForm.getMiddleName();
String lastName = theForm.getLastName();
String addressLine1 = theForm.getAddressLine1();
String addressLine2 = theForm.getAddressLine2();
String city = theForm.getCity();
String state = theForm.getState();
String zip = theForm.getZip();
String country = theForm.getCountry();
HttpSession session = request.getSession( true );
Profile shippingProfile =
(Profile)session.getAttribute( Constants.ATTRIBUTE_SHIPPINGPROFILE );
Order order =
(Order)session.getAttribute( Constants.ATTRIBUTE_ORDER );

if( order == null )
{
order = new Order();
}

if( shippingProfile == null )
{
shippingProfile = new Profile();
}

shippingProfile.setTitle( title );
shippingProfile.setFirstName( firstName );
shippingProfile.setMiddleName( middleName );
shippingProfile.setLastName( lastName );
shippingProfile.setAddressLine1( addressLine1 );
shippingProfile.setAddressLine2( addressLine2 );
shippingProfile.setCity( city );
shippingProfile.setState( state );
shippingProfile.setZip( zip );
shippingProfile.setCountry( country );
order.computeSubTotal();
order.computeCharges();
session.setAttribute( Constants.ATTRIBUTE_ORDER, order );
session.setAttribute( Constants.ATTRIBUTE_SHIPPINGPROFILE,
shippingProfile );

forward = Constants.FORWARD_PAYMENT;

return mapping.findForward( forward );
}
}

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录