How to wtite pretty URL in Struts2.x?

后端 未结 1 1350
半阙折子戏
半阙折子戏 2021-01-17 03:40

I want to rewrite my URL in Struts2. Please help me out to do this. How can i customize as i want, i don\'t want to show my parameter that i am passing and also show action

1条回答
  •  伪装坚强ぢ
    2021-01-17 04:29

    If you don't want to show the parameter passing you could use this solution.

    To hide passed parameter actually you need to submit the form. You should prevent the default behavior of the click event and replace it with the form event.

    If you also want to show action with different name, you can use the above filter or wildcard mapping.

    Advanced Wildcards

    From 2.1.9+ regular expressions can be defined defined in the action name. To use this form of wild card, the following constants must be set:

    
    
    
    

    The regular expressions can be in two forms, the simplest one is {FIELD_NAME}, in which case the field with the FIELD_NAME in the action will be populated with the matched text, for example:

    
        
      /books/content.jsp
        
    
    

    0 讨论(0)
提交回复
热议问题