wood burning stoves 2.0*
The moose likes Struts and the fly likes enter key LookupDispatchAction issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "enter key LookupDispatchAction issue" Watch "enter key LookupDispatchAction issue" New topic

enter key LookupDispatchAction issue

Vicky Pandya
Ranch Hand

Joined: Dec 16, 2004
Posts: 148
When cursor is in one of the text fields and have multiple buttons on the page, it throws

javax.servlet.ServletException: Request[/myAction] does not contain handler parameter named 'method'. This may be caused by whitespace in the label text.

All my actions extend LookupDispatchAction. how to overcome this issue? I want this to behave like other common web apps, when you hit enter, I want it to submit first button. anyone?
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

It should be submitting the first button. My guess is that you will get that error even if you clicked the first button.

A good workman is known by his tools.
Vicky Pandya
Ranch Hand

Joined: Dec 16, 2004
Posts: 148
no. it doesn't submit first button. On hitting enter it throws an error I mentioned in first post saying no parameter found, meaning it doesn't pick up method name as first submit button. No error while clicking on the button. any ideas?
[ October 19, 2005: Message edited by: Vicky Pandya ]
Vicky Pandya
Ranch Hand

Joined: Dec 16, 2004
Posts: 148
does anyone have an idea about this? Whoever uses LookupDispatchAction should have encountered same "enter key" issue. If focus is on any of the forms fields and you hit enter, it will throw an error as I mentioned in first post.

Is there any magic javascript anyone has written which picks up first button as submit when you hit enter key??
It is sorta covered in the JavaRanch Style Guide.
subject: enter key LookupDispatchAction issue
Similar Threads
LookupDispatchAction and enter key
One forum, dynamic action on submit
text typing in jTextBox
How to handle ENTER key event in JTextArea
When to use DispatchAction and when to use LookUpDispatchAction?