ok here is what I am talking about. I have a form that takes in first name, last name, street address, city, state and zipcode. When I press on the button to enter that information into a database. I want the page to reload with clear input fields.
-Paul

Michael Jouravlev wrote:

What do you mean "clear out" and what do you mean by "reload"? If you
need a stateful component to obtain user data, and to be able to to
redisplay the page with error messages, and to store intermediate
data, and to correctly process Refresh and Back buttons, you might
want to take a look at the class that I put together last week:
http://struts.sourceforge.net/strutsdialogs

If you totally against storing data in the session, this class is not
for you, though ;-)

Michael.

P.S. Damn, that download counter did reset, when I updated the zip :-(
P.P.S. The live samples are not available right at this moment, the
server is down. It should be up soon.

On 6/13/05, Paul Goepfert <[EMAIL PROTECTED]> wrote:
I figured it out.  It was a stupid mistake, the mappings didn't match
between my struts-config and my Action Class.  By the way, the Dispacher
looks like a better way to handle actions.  I  don't suppose anyone
would know where I would call the reset method to clear out the form onn
a reload?

-Paul

Dave Newton wrote:

Paul Goepfert wrote:

[...]  try
      {
          session = request.getSession();
          action = request.getParameter("action");
          if(action.equals("enterInfo"))
          {
              return (mapping.findForward("enter"));
          }
          else if(action.equals("default"))
          {
              sorted = data.createSortedArray("ascending", "first");
              data.removeInsert(sorted);
              data.createContext(sorted);
              return (mapping.findForward("default"));
          }
          else
          {
              return  (mapping.findForward("sort"));
          }
      } [...]
This code reeks of code smell, regardless of any other issues,
especially if you have to do something similar in any other action.
This is, more or less, what DispatchAction (?) was created for. Here
you've duplicated controller logic inside an action, which is really
supposed to be a target of the controller.

So here you are expecting forwards named "enter", "default", and "sort".

<form name="menu" action=$link.setAction("Menu") method="get">
         <input type="hidden" name="action" value="menu">
menu

onchange="menu.action.value='enterInfo'"
$text.get("menuEnter")</label>
enterInfo

onchange="menu.action.value='default'">$text.get("menuDefault")</label>
default

onchange="menu.action.value='sort'">$text.get("menuSort")</label>
sort

<action path="/Menu"
              type="actions.MenuAction"
              name="menuForm"
              scope="request">
        <forward name="enterInfo"
                 path="/info.vm" />
        <forward name="default"
                 path="/results.vm" />
        <forward name="sort"
                 path="/sort.vm" />
</action>
Okay, so that looks good.

Have you done a sanity check with a plain 'ol action with a forward to
a JSP like Frank suggested?

Have you put in logging statements to make sure that the action
parameter is what you expect it to be when you hit your action?

Have you been able to get _any_ Velocity file to render, i.e., hit one
without going through Struts? An the related Have you checked on the
Velocity list to make sure you have the VelocityViewServlet set up
properly?

Have you checked the log files for error messages?

Dave



---------------------------------------------------------------------
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]



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

Reply via email to