Either I am just trying to do something that is impossible, or I do not know what I am doing. Please help me figure out which:
 
I have a page (home.jsp) that is a secured page through FORM based JAAS in jboss 3, Struts 1.1 and Tiles and all my data is being used in a body-text.jsp tile. I want to have a LINK from there to the different user services like updating user profile, account details, and other services.
When, when a user clicks one of these links, or selects a bookmark in their browser, it goes to updateProfile.jsp page that should be pre-populated with data based on this user Principal.
 
I have tried many different things according to the documentation I have seen, but nothing seems to actually work when I just bookmark one of these pages.
 
Here is what I have tried:
1. I have setup a form entry page with the action="" and then I have an action mapping for "/updateProfile".
Now I have accessed the page and try to access the DynaActionForm  that is defined for this form.
 
struts-config.xml:
        <form-bean  name="registrationForm"
                    dynamic="true"
                    type="org.apache.struts.validator.DynaValidatorActionForm">
            <form-property name="userId" type="java.lang.Long" size="25" />
            <form-property name="username" type="java.lang.String" size="25" />
            <form-property name="password" type="java.lang.String" size="25" />
 
            <form-property name="email" type="java.lang.String" size="25" />
            <form-property name="firstName" type="java.lang.String" size="25" />
            <form-property name="middleName" type="java.lang.String" size="25" />
            <form-property name="lastName" type="java.lang.String" size="25" />
            <form-property name="address1" type="java.lang.String" size="32" />
            <form-property name="address2" type="java.lang.String" size="32" />
            <form-property name="city" type="java.lang.String" size="32" />
            <form-property name="state" type="java.lang.String" size="32" />
            <form-property name="otherState" type="java.lang.String" size="32" />
            <form-property name="postCode" type="java.lang.String" size="32" />
            <form-property name="country" type="java.lang.String" size="32" />
 
            <form-property name="phone1" type="java.lang.String" size="25" />
            <form-property name="phone2" type="java.lang.String" size="25" />
            <form-property name="phone3" type="java.lang.String" size="25" />
            <form-property name="phone4" type="java.lang.String" size="25" />
 
            <form-property name="reminders" type="java.lang.Short" size="2" />
            <form-property name="preferedLanguage" type="java.lang.String" size="10" />
 
            <form-property name="ccnumber" type="java.lang.Integer" />
            <form-property name="ccexpmonth" type="java.lang.Short" />
            <form-property name="ccexpyear" type="java.lang.Short" />
            <form-property name="cctype" type="java.lang.String" />
            <form-property name="autobill" type="java.lang.Short" />
 
            <form-property name="creationDate" type="java.sql.Date" />
            <form-property name="renewalDate" type="java.sql.Date" />
            <form-property name="lastUpdate" type="java.sql.Date" />
            <form-property name="status" type="java.lang.Short" />
            <form-property name="FormData" type="com.baselogic.icoe.user.UserDto"/>
        </form-bean>
 

        <!-- Update a user registration -->
        <action path="/updateRegistration"
                type="com.baselogic.icoe.user.UserActions"
                parameter="method"
                name="registrationForm"
                scope="request"
                input="/updateRegistration.jsp"
                validate="true">
         <forward name="success" path="/updateRegistration.jsp" redirect="true" />
         <forward name="error" path="/error.jsp" redirect="true" />
        </action>
 
UserActions.java: updateRegistration method:
    public ActionForward updateRegistration( ActionMapping mapping
                                            ,ActionForm form
                                            ,HttpServletRequest request
                                            ,HttpServletResponse response
                                            )
    throws Exception
    {
        ActionErrors errors         = new ActionErrors();
        ActionForward targetPage    = null;
 
        try
        {
            IUserServices usd = this.getUserService();
 
            UserContainer existingContainer = getUserContainer(request);
 
            UserDto userDto = existingContainer.getUserDto();
            UserDto newUserDto = null;
 
            // if first time into jsp (ie. not an update), set up UserForm object
            if( form == null || ((DynaActionForm)form).get( Constants.FORM_UPDATE_KEY ) == null)
            {
                log.info("Initialize a User DynaActionForm."); // this never prints...
                newUserDto = usd.findUser( userDto.getUsername() );
                form = usd.dtoToForm( (DynaActionForm)form, (Object)newUserDto );
            }
            else
            {
                log.info("Updating a User DynaActionForm.");
                // update merchant with form data
                newUserDto = usd.updateRegistration( (DynaActionForm)form );
 
                existingContainer.setUserDto( newUserDto );
            }
 
            ((DynaActionForm)form).set( Constants.FORM_DATA_KEY,  newUserDto );
 
            targetPage = mapping.findForward(Constants.SUCCESS_FORWARD );
        }
  catch (TechnicalException te)
  {
      errors.add( ActionErrors.GLOBAL_ERROR, new ActionError( te.getMessage() ) );
   saveErrors(request, errors);
            targetPage = new ActionForward(mapping.getInput());
  }
  catch (BusinessException be)
  {
      errors.add( ActionErrors.GLOBAL_ERROR, new ActionError( be.getMessage() ) );
   saveErrors(request, errors);
 
            targetPage = new ActionForward(mapping.getInput());
  }
  catch (Exception e)
  {
      errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(e.getMessage()) );
   saveErrors(request, errors);
   targetPage = mapping.findForward(Constants.ERROR_FORWARD);
  }
 

        // report any errors to the user
        if (!errors.isEmpty())
        {
            // errors = ErrorFormatter.format(errors, resourceBundle);
            saveErrors(request, errors);
            return targetPage;
        }
 
        // Forward control to the specified success URI
        return (mapping.findForward(Constants.SUCCESS_FORWARD));
    }
 
body-text-jsp:
<%@ page contentType="text/html; charset=utf-8" %>
 
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ page import="com.baselogic.icoe.Constants" %>
 
<html:form action="" method="post">
<html:hidden property="method" value="updateRegistration"/>
 
<table width="100%" border="1" cellspacing="1" cellpadding="1">
  <tr bgcolor="#FFFF99">
 <td height="2" colspan="5">
     <img src="" width="8" height="8" alt="" border="0">
  Select Desired Username and Password:
    </td>
  </tr>
  <tr>
    <td colspan="5">
        Username: <bean:write name="registrationForm" property="FormData.username"/> <br />
        Password: <bean:write name="registrationForm" property="FormData.password"/> <br />
        creationDate: <bean:write name="registrationForm" property="FormData.creationDate"/> <br />
        renewalDate: <bean:write name="registrationForm" property="FormData.renewalDate"/> <br />
    </td>
  </tr>
  <tr>
    <td><bean:message key="reg.username"/></td>
    <td><input name="username" type="text" size="20" maxlength="25"></td>
 <td width="7" height="2">
     <img src="" width="7" height="2" alt="" border="0">
    </td>
    <td><bean:message key="reg.email"/></td>
    <td><input name="email" type="text" size="20" maxlength="50" value=""></td>
  </tr>
  <tr>
    <td><bean:message key="reg.password"/></td>
    <td><input name="password" type="password" size="20" maxlength="25"></td>
 <td width="7" height="2">
     <img src="" width="7" height="2" alt="" border="0">
    </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
There is more... But I don't think I need it here.
 
Is this a fair explaination of my issue?
 

Thank You
 
Mick Knutson
 
Sr. Designer - Project Trust
aUBS Warburg - Zürich
Office: +41 (0)1/234.42.75
Internal: 48194
Mobile: 079.726.14.26

 
Visit our website at http://www.ubswarburg.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.

Reply via email to