Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7626373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:19:00+00:00 2026-05-31T05:19:00+00:00

I know how to use wildcard method invocation within struts.xml, but is it possible

  • 0

I know how to use wildcard method invocation within struts.xml, but is it possible to do this with annotations? If so how?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:19:01+00:00Added an answer on May 31, 2026 at 5:19 am

    You probably have it resolved by now, but for those looking for an answer, yes it is possible.

    For wildcard mapping, refer to: http://struts.apache.org/2.3.1.2/docs/wildcard-mappings.html

    To read params from the url, annotate your method with this:

    private String id;
    
    @Action(value = "edit/{id}",
            results={@Result(name = "success", location = "/WEB-INF/views/devices/edit.ftl")}
    )        
    public String edit() {  
        // do something
        return SUCCESS;
    }
    
    public void setId(String id) {
        this.id = id;
    }
    
    public String getId() {
        return id;
    }
    
    • You will need a getter/setter for the id parameter.
    • You need to specify the results since struts2 won’t know what to use for success for the url: …edit/123, hence the need to use @Result to point to your file. Kinda defits the purpose of the convention plugin there.

    In the case I want to redirect to a specific url, use this annotation:

    @Action(value = "index",
            results={@Result(name = "success", location = "/devices/edit/${entityId}", type = "redirect")}
        )
    

    You would need a getter/setter for the entityId (String in my case).

    You can also have advanced wilcard mapping, namespace wildcard mapping …

    Don’t forget to change the struts.xml and add the following constants.

    <!-- Used for advanced wilcard mapping -->
    <constant name="struts.enable.SlashesInActionNames" value="true"/>
    <constant name="struts.mapper.alwaysSelectFullNamespace" value="false"/>
    <constant name="struts.patternMatcher" value="regex" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use Spring Cache features but I don't know what dependedencies this
I know I use the asp FileUpload control for uploading a file but I
I know you use the C based networking API to do FTP communication but
I know and use eric meyer CSS reset, but is there any more things
I know how to use JSON to create objects, but there doesn't seem to
Does anyone know if it's possible to create my own wildcard certificate under Ubuntu?
I know this question has been asked several times on SO, but none of
I know I'm an idiot, but I can't pull the domain out of this
I'm not entierly sure how rngs currently work, but I know they use time
I know the use of server-side controls is a no-no in ASP.NET MVC, however

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.