Link to home
Start Free TrialLog in
Avatar of Jay Roy
Jay RoyFlag for United States of America

asked on

spring UI with controller

hi guys
I have a basic question in spring framework.
I have 4 buttons on a jsp page: add, save, delete, update. Each of those 4 buttons when clicked should invoke methods in controller. So i guess i need only one controller with 4 methods right?
add () , save () , delete ()  and  update() , will that be correct?

how do i map the buttons to the methods? i.e when user click on the add button, add() should be invoked in controller.
(In struts we used dispatch action class, not sure how we do in spring)

Any sample code in implimenting this scenario would greatly help.

thanks

ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jay Roy

ASKER

thanks for the link, its pretty handy. have  a question

in this line :   3> Change in Application-servlet.xml

Is Application-servlet.xml file an in-built file provided by spring in addition to web.xml and spring-config.xml?

thanks
no, you write that. It specifies your mappings.
Avatar of Jay Roy

ASKER

ok, so what xml files do we need for spring which we need to modify:

web.xml
spring-config.xml
application-servlet.xml

anythig else?
thanks

thanks.
you can put your mappings in whatever files you want. you just need to tell spring which files to load.
the example above just seperates the ui mappings from the application bean mappings.
Avatar of Jay Roy

ASKER

ok, so in the above example since user created a Application-servlet.xml file and defined the ParameterMethodNameResolver class in it which does the job of mapping 'parametres' with method names, is Application-servlet.xml  registered anywhere else? How does spring know user has created
Application-servlet.xml ?

Can i omit the Application-servlet.xml  file and put its content in my spring-config file?

thanks
what the file is named is irrelevant

> Can i omit the Application-servlet.xml  file and put its content in my spring-config file?

yes
Avatar of Jay Roy

ASKER

ok. got it.
thanks.