This one might have gotten buried in the morning download of email, has
anyone looked at this problem?  Thanks.  :)

- Mark

-----Original Message-----
From: Mark Ahnell [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 05, 2003 12:52 AM
To: [EMAIL PROTECTED]
Subject: Accessing ActionMapping in JSP


I have recently migrated from 1.0 to 1.1 and have been having a problem with
accessing the ActionMapping in my JSP.  I have a custom ActionMapping,
HACActionMapping, which I have added several getters and mutators.

With version 1.0, I used this code in my JSP:

<%
  ActionMappings actionMappings =
(ActionMappings)application.getAttribute(Action.MAPPINGS_KEY);

  HACActionMapping hacMapping =
(HACActionMapping)actionMappings.findMapping("/tmsLogin"); // Path hard
coded for example
  if (hacMapping == null) {
    %>  <%=(new String("** hacMapping Null** "))%> <%
  } else {
    %>  <%=hacMapping.isLoginRequired()%> <%
  }

%>

This works, when there is only one struts-config.xml.  In Struts 1.1,
ActionMappings has been deprecated, and I don't know how to code this for
1.1.

I am also using the new module functionality for my application.  When a
user logs in, they are switched to another module using a SwitchAction.  So,
there are three struts-config files for my app.  After I log in, I am now in
a new module with a new struts-config-pp.xml.  If I use the old
ActionMappings way, I only have access to the mappings that are in my
default sturts-config.xml.  This was confirmed, when I placed this piece of
code in my JSP

<%
  String[] allMappings = actionMappings.findMappings();
  out.println("*X*\n");
  for (int j=0; j < allMappings.length; j++)
    out.println(allMappings[j]+"\n");
  out.println("*X*\n");
%>

When this ran, it only produced a list of actions in my default
struts-config.xml.  Does someone know how I would code this using modules,
in 1.1?  I have converted all items that needed to be converted for 1.1,
i.e., created new config/moduleName entires in my web.xml, and removed the
"mapping" parameter in web.xml and replaced it with an entry in
<action-mapping type="com.xxx.HACActionMapping".  Thanks in advance.

- Mark Ahnell


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to