Andy,
Put this in your jsp page. If you create a JSP
template file that includes this code and then use it
as a basis for developing new JSP pages, you will be
able to see what is in your request, session and
ActionMessages. I found it in this article on
javaboutique by Keld H. Hanson:
http://javaboutique.internet.com/tutorials/excep_struts/

Regards,

Richard


<%@ page import="java.util.*" %>
<%@ page import="org.apache.struts.*" %>
<%@ page import="org.apache.struts.util.*" %>
<%@ page import="org.apache.struts.action.*" %>

<%
  // Print all attributes in the request object
  out.println("<p><b>All Attributes in request
scope:</b>");
  Enumeration paramNames =
request.getAttributeNames();
  while (paramNames.hasMoreElements()) {
    String name = (String) paramNames.nextElement();
    Object values = request.getAttribute(name);
    out.println("<br> " + name + ":" + values);
  }
  
  // Print all attributes in the session object
  out.println("<p><b>All Attributes in session
scope:</b>");
  paramNames = session.getAttributeNames();
  while (paramNames.hasMoreElements()) {
    String name = (String) paramNames.nextElement();
    Object values = session.getAttribute(name);
    out.println("<br> " + name + ":" + values);
  }

  out.println("<p><b>Data in ActionMessages:</b>");

  // Get the ActionMessages 
  Object o =
request.getAttribute(Globals.MESSAGE_KEY);
  if (o != null) {
    ActionMessages ae = (ActionMessages)o;

    // Get the locale and message resources bundle
    Locale locale = 
     
(Locale)session.getAttribute(Globals.LOCALE_KEY);
    MessageResources messages = 
      (MessageResources)request.getAttribute
      (Globals.MESSAGES_KEY);

    // Loop thru all the labels in the ActionMessage's
 
    for (Iterator i = ae.properties(); i.hasNext();) {
      String property = (String)i.next();
      out.println("<br>property " + property + ": ");

      // Get all messages for this label
      for (Iterator it = ae.get(property);
it.hasNext();) {
        ActionMessage a = (ActionMessage)it.next();
        String key = a.getKey();
        Object[] values = a.getValues();
        out.println(" [key=" + key + 
          ", message=" + 
          messages.getMessage(locale,key,values) + 
          "]");
      }
    }
  }
%>

--- Andy Engle <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> Is there a way to simply print out session values,
> such as through the
> bean:write tag or something like that?  If there is,
> could you please
> share?  It seems like it should be easily done, but
> I can't find
> anything that describes how to.
> 
> Thanks!
> 
> 
> Andy
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

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

Reply via email to