File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to invoke method using controller class in spring

 
Mohan rvscas
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Friends,

How to invoke multiple method using controller class in spring.

if you have code or any web references please send me.

Thanks in advance.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you explain what you want to do ? What do you mean by "invoke multiple method using controller class" ?
 
Mohan rvscas
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir,

i want to call method that is inside the class. see MultiActionControllerEx1.java this java file that extends MultiActionController and it has one method add().

now i have jsp (redirect.jsp). in this jsp i have one anchor tag. it shoult call add method of the class (MultiActionControllerEx1.java) .

i have tried but i didn't get the output .

Error is occured like

HTTP Status 404 - /MultiActionSpring/user.htm/add

type Status report

message /MultiActionSpring/user.htm/add

description The requested resource (/MultiActionSpring/user.htm/add) is not available.
Apache Tomcat/6.0.20


i don't know how where i did the mistake .

This is my code .

redirect.jsp







MultiActionControllerEx1.java








dispatcher-servlet.xml








user.jsp







web.xml





sir this is what i have tried.

please give me the solution.

 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
/MultiActionSpring/user.htm/add ? Your DispatcherServlet is mapped to *.htm. The request associated to that URL will not be processed by the dispatcher. I see at least two problems
1. You defined a method name parameter called "method", but you are not using it
2. You mapped the controller to /user/*.htm but you are linking to user.htm in your JSP

I think you should change "<a href="user.htm/add">Add</a> " to something like "<a href="/yourcontext/user/something.htm?method=add">Add</a>", where "yourcontext" is the name of your application (should be set dynamically). I'm not sure it's wise to map the controller to /user/*.htm.
 
Mohan rvscas
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Dear Christophe,

now i made changes in mapping it works fine.

Thanks a lot.

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic