On Page1.jsp, their is an Href link that calls the sendEmailAction. This action includes the look up of a piece of data in an arraylist via the index number passed from the Page1.jsp - it then forwards to Page2.jsp (where part of the email message body is entered by the user). This Page2.jsp then calls the same sendEmailAction - but the index parameter is now null (since it is not coming from the current page. My question is - how can I code this action to be able to continue to use it as it is now (called from Page1.jsp and from Page2.jsp) to be able to execute the exact same code (without losing parameters)? If this is not possible, what is the scenario I need to look at (2 separate actions, etc.) that will aloow me to accomplish the following functionality?
Snippet from action:
//get participation data
ArrayList partData = (ArrayList) session.getAttribute(JUVENILE_PARTICIPATION);
if (request.getParameter("indx") == null)
{
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("system.error.general"));
l4jCategory.warn("Parameter 'indx' not found in the user request.");
return mapping.findForward(FAILURE_FORWARD);
}
int indx = Integer.parseInt(request.getParameter("indx"));
JuvenileParticipationData pData = (JuvenileParticipationData) partData.get(indx);
String sendTo = pData.getContactEmail();
// use
test email or actual email
String email = OSCACfg.EMAIL_TEST?OSCACfg.EMAIL_TEST_ADDR:sendTo;
User sees list of items associated with a selected user on
jsp Page1. User selects one of the items (this is where I get my index). Jsp Page2 is rendered with information from Page1 and a lookup in the action to get the specific informatino associated with the detail record the user selected. User types some content and hits a submit button to send email. Same action is then called to actually send the email and display a success/fail page, depending on outcome.
Thanks so much for any light that can be shed on this topic.