• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Second call to Struts action

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Mark Brothers
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A nice hidden item on the jsp has solved my problem. Its good to have coworkers with vast amounts of experience and knowledge - Thanks to Cory!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic