spring mvc question

D

Daniel

Hi all,

I am new to Spring and I have a question relating to the MVC portion of
Spring.

I have a web page that contains several buttons (<input type="submit"...)
inside a form. There is an associated controller class mapped to this jsp
page that contains the buttons. My question is, can an abstract controller
be used here (of course, I am extending that class)?

Secondly, how do I tell which of the multiple buttons was pressed? I went
into handleRequestInternal() and there is an HttpServletRequest passed in as
a parameter, but I could not tell which button was pressed by calling the
request's getParameter() method. In previous projects that did not use
Spring, I was able to iterate through the request's getParameterNames() and
figure out which button by looking for the button's name. Is Spring removing
this information from the request? Also, is handleRequestInternal() getting
called each time the user gets to this page, and does each user get a new
instance of a controller or is it a controller being shared across users? Is
handleRequestInternal() the "main" method that gets executed by controller
(the one that does the work), and if so, how does it know if it's being
called the first time by a user and if it's a postback (assuming it gets
called each time a user hits the page)?

I should ask, is this the proper way to do it in Spring (extending an
abstract controller and then using the request's getParameterNames() to
figure out which button was pushed)? Am I going about it the wrong way to
begin with, and if so, what is the proper way in terms of extending the
right controller and getting info on which button was pushed?

If there is a better way, for my curiosity, I would like to know why the
request's getParameterNames() is not working the way I expected.

Sorry for a very long question and thanks in advance!

Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top