Sebastian,
I'm not sure what the "it" your are referring to is when you wrote,
"I always thought if I pass a actionform to the JSP and it sets the actionform after user clicks
submit, the values will be updated in the scope."
The JSP is run on the server and generates the html that is sent to the browser. When you click the submit button, an HTML form is sent to your Action class specified in the action mapping that corresponds to the action attribute of the form. It is in this action and the form bean that is configured for the action that the form values are processed.


Some code that might help debugging your jsps and actions is the inspectmessages.jsp from this article:http://javaboutique.internet.com/tutorials/excep_struts/

I sometimes put this code at the bottom of all my jsps as I am developing b/c it shows what values are available to the JSP. Once I finish developing the page, I delete it.

<%@ 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) +
          "]");
      }
    }
  }
%>

-Richard

At 01:25 AM 8/25/2004, you wrote:
Hi Richard

>From what you describe below, we need to put it into the scope again
after action class receives the actionform? I always thought if I pass a
actionform to the JSP and it sets the actionform after user clicks
submit, the values will be updated in the scope. Weird, my application
should break in that case..I must be doing something wrong but somehow
it still works..

Sebastian Ho


On Wed, 2004-08-25 at 14:54, Richard Yee wrote:
> Muhammad,
> The JSP is evaluated on the server and then sent to the browser. When you
> change a value on the web page, you submit the form to an Action class
> which then takes the form properties and should update your collection and
> then persist it or put it in request or session scope. You can then forward
> to another JSP to re-display the updated collection.
>
> -Richard
>
> At 11:44 PM 8/24/2004, you wrote:
> >Hello,
> >
> >I have a collection of a perticular type of bean. I am displaying the
> >values of fields in each bean (bean values are of type strings, boolean
> >etc.) inside a logic:iterate. The problem is when I change any value in the
> >webpage, the bean in the collection does not get updated. Can anyone guide
> >me how to accomplish this?
> >
> >Thanks for your time and effort
> >
> >Regards,
> >Muhammad Momin Rashid.
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >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]
>
>



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

Reply via email to