wood burning stoves 2.0*
The moose likes Other Application Frameworks and the fly likes about spring framework 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 » Other Application Frameworks
Bookmark "about spring framework" Watch "about spring framework" New topic
Author

about spring framework

sruthi das
Ranch Hand

Joined: Dec 28, 2007
Posts: 34
can any one help me how to implement multiactions in a single controller.
like add,view, update.
please help me.
thanks in advance.
Praveen Babu
Ranch Hand

Joined: Jul 30, 2006
Posts: 138
Hi,

You need to extend from org.springframework.web.servlet.mvc.multiaction.MultiActionController in order to aggregate multiple actions in a single class.

Regards,
P R A V E E N
sruthi das
Ranch Hand

Joined: Dec 28, 2007
Posts: 34
yes, I am using multiactioncontroller.
the problem is it is not going into the controller.
here is the xml file
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN/EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>


<bean id="propsResolver" class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver">
<property name="mappings">
<props>
<prop key="/add.html">add</prop>
<prop key="/view.html">view</prop>

</props>

</property>
</bean>

<bean id="paramMultiController" class="org.springframework.web.servlet.mvc.multiaction.MultiActionController">
<property name="methodNameResolver" ref="propsResolver"></property>
<property name="delegate" ref="addController"></property>
</bean>

<bean id="addController" class="bean.AddController"/>
<bean id="log" class="bean.Formbean"/>

</beans>
here add,view are methods in addcontroller.
help me how to solve.getting 404 error
Praveen Babu
Ranch Hand

Joined: Jul 30, 2006
Posts: 138
404 Error occurs when you have problems with your file path. Anyway, the following works fine for me.

<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/hello.htm">myController</prop>
<prop key="/second.htm">myController</prop>
</props>
</property>
</bean>


<bean id="myController" class="pkg.SimpleController">
<property name="methodNameResolver" ref="controllerResolver"/>
</bean>

<bean id="controllerResolver" class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver">
<property name="mappings">
<props>
<prop key="/hello.htm">handleHello</prop>
<prop key="/second.htm">handleSecond</prop>
</props>
</property>
</bean>

Regards,
P R A V E E N
sruthi das
Ranch Hand

Joined: Dec 28, 2007
Posts: 34
Thanq very much.
now my code is working
 
jQuery in Action, 2nd edition
 
subject: about spring framework
 
Similar Threads
How to display flash file(.swf) in java application?
Adding 1 row to specific section of a struts table using iterate tag
Drop down help
JDom doesn't support encoding="GBK"?
Action Form Problem