Jay Roy
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
no, you write that. It specifies your mappings.
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.
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.
the example above just seperates the ui mappings from the application bean mappings.
ASKER
ok, so in the above example since user created a Application-servlet.xml file and defined the ParameterMethodNameResolve r 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
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
> Can i omit the Application-servlet.xml file and put its content in my spring-config file?
yes
ASKER
ok. got it.
thanks.
thanks.
ASKER
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