File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Calling Action method using struts-tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Calling Action method using struts-tags" Watch "Calling Action method using struts-tags" New topic

Calling Action method using struts-tags

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Could anyone tell me how you can call a specific method from an Action using the struts tags?

I have
<%@ taglib prefix="s" uri="/struts-tags" %>
in my JSP and was looking for something like s:link or s:button to call a specific method from the action (say UserAction.edit() or UserAction.delete()) but can not find anythign that works.

Cheers in advance

Ankit Garg

Joined: Aug 03, 2008
Posts: 9463

I think you are using Struts 2. In struts 2, while you define an action in your struts.xml file, you can also give the method that you want to be called. So you can define more than one mapping for your action that will call different methods...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
David Newton

Joined: Sep 29, 2008
Posts: 12617

The <s:url> tag has a "method" attribute.
I agree. Here's the link:
subject: Calling Action method using struts-tags
It's not a secret anymore!