`
yaozuodaoforfly
  • 浏览: 119048 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Wildcards

 
阅读更多

 

As an application grows in size, so will the number of action mappings. Wildcards can be used to combine similar mappings into one more generic mapping.

The best way to explain wildcards is to show an example and walk through how it works. This example modifies a conventional mapping to use wildcards to match all pages that start with /edit:

<action name="/edit*" class="org.apache.struts.webapp.example.Edit{1}Action">
    <result name="failure">/mainMenu.jsp</result>
    <result>{1}.jsp</result>
</action>

The "*" in the name attribute allows the mapping to match the request URIs /editSubscription, editRegistration, or any other URI that starts with /edit, however /editSubscription/add would not be matched. The part of the URI matched by the wildcard will then be substituted into various attributes of the action mapping and its action results replacing {1}. For the rest of the request, the framework will see the action mapping and its action results containing the new values.

Mappings are matched against the request in the order they appear in the framework's configuration file. If more than one pattern matchesthe last one wins, so less specific patterns must appear before more specific ones. However, if the request URL can be matched against a path without any wildcards in it, no wildcard matching is performed and order is not important. Also, note that wildcards are not greedy, meaning they only match until the first occurrence of the following string pattern. For example, consider the following mapping:

<action name="List*s" class="actions.List{1}s">
  <result>list{1}s.jsp</result>
</action>

This mapping would work correctly for the URI ListAccounts but not ListSponsors, because the latter would turn into this configuration:

<action name="ListSpons" class="actions.ListSpons">
  <result>listSpons.jsp</result>
</action>
   
   
   
分享到:
评论

相关推荐

    Efficient string matching with wildcards and length constraints

    文章提出了一种名为SAIL1(String Matching with Wildcards and Length Constraints)的高效算法,该算法能在非线性时间内返回模式`P`在文本`T`中的每一次出现,并且只需要线性的额外空间。具体来说,对于长度为`n`...

    K_Generic--Bounds Wildcards知乎回答1

    在Java泛型中,通配符(Wildcards)和边界(Bounds)是为了解决类型兼容性和灵活性的问题。通配符允许我们定义泛型类型的限制,而边界则指定了这些限制的具体范围。 1. 为什么要使用通配符和边界? 在Java中,泛型...

    基于Python的stable-diffusion-webui-wildcards随机tag生成器设计源码

    该项目是一款基于Python的stable-diffusion-webui-wildcards随机tag生成器设计源码,包含571个文件,涵盖了562个文本文件、2个Python源代码文件、1个Git忽略文件和1个Markdown文件,以及相关的图像和文档资源。...

    Shell Compatible Wildcards-开源

    Shell 兼容的通配符(Wildcards)是编程领域中的一个重要概念,特别是在命令行界面和脚本编写中。在给定的标题“Shell Compatible Wildcards - 开源”中,我们关注的是一个开源项目,它提供了跨平台的通配符匹配功能...

    String matching with wildcards.rar_deerg91_jumpi9a_matched_带通配符的

    (大一计算机新生作业)带通配符的字符串匹配 输入两个字符串(不包含空格)用空格分开,前一个字符串中含有通配符‘*’和‘?’,其中‘*’可代替任意长度的字符串,'?'可代替任一字符,若前者与后者匹配,输出...

    VclZip pro v3.10.1

    Sometimes when using wildcards and recursing directories, there was no reporting of progress. This will be fired each time a file matches as the file list is being built while recursing directories. ...

    php-wildcards:PHP 中的简单通配符

    通配符 ... ... use ddliu\wildcards\ Wildcards ; $ wildcards = new Wildcards ( 'http://google.com/search/*' ); var_dump ( $ wildcards -&gt; match ( 'http://google.com/search/php' )); // true

    Privacy-preserving wildcards pattern matching protocol for IoT applications

    Privacy-preserving wildcards pattern matching protocol for IoT applications

    A BIT-PARALLEL ALGORITHM FOR SEQUENTIAL PATTERN MATCHING WITH WILDCARDS

    In addition, existing algorithms based on bit-parallelism cannot handle a pattern that has only one pattern character between successive wildcards and the minimum local length constraints are zer

    正则表达式完全指南

    can think of regular expressions as wildcards on steroids You are probably familiar with wildcard notations such as txt to find all text files in a file manager The regex equivalent is txt "&gt;A regular...

    DBVIEW,DB数据库查看

    DBF Viewer 2000 v1.97 is the powerful tool for ...find with wildcards, sort, replace with wildcards, add, delete/recall, print, copy/paste records and fields, pack, append from text files, zap records.

    Java泛型和集合-英文版

    3. 泛型的子类型和通配符(Subtyping and Wildcards):在泛型中,子类型(Subtyping)和通配符(Wildcards)是用来表达不同类型之间关系的概念。通配符使用问号(?)表示未知类型,而带有extends的通配符(比如List...

    VCLZip pro 4.51_1 压缩/解压缩控件(含源码)

    NoCompress (STORE) List (tell VCLZip which files to just store (use wildcards too) Set your own temp directory Plenty of events Long filenames, even the 16 bit VCLZip/VCLUnZip Includes ...

    wgetwin-1_5_3_1-binary.rar_ wgetwin-1_Connections_ftp binary_wge

    Matching of wildcards and recursive mirroring of directories are available when retrieving via FTP. Both HTTP and FTP retrievals can be time-stamped, thus Wget can see if the remote file has changed ...

    Java1.5泛型指南中文版(Java1.5Gene....pdf

    通配符可以分为bounded wildcards 和 unbounded wildcards 两种。 5. 泛型方法 泛型方法是指使用泛型类型参数的方法。例如,`public static &lt;T&gt; T identity(T t) { return t; }` 定义了一个名为 identity 的泛型...

    DevExpressVCL14.2.2补丁包〖修复BUG〗

    FindPanel - The % and _ wildcards work when the UseExtendedSyntax property is disabled 此BUG说明地址:https://www.devexpress.com/Support/Center/Question/Details/T191219 3、FindPane的BUG; It's for ...

    ActiveMQ中文手册

    2.6.7 Wildcards 23 2.6.8 Async Sends 23 2.6.9 Dispatch Policies 24 2.6.10 Message Cursors 25 2.6.11 Optimized Acknowledgement 25 2.6.12 Producer Flow Control 26 2.6.13 Message ...

    论文研究-求解PMWOC问题的位并行算法.pdf

    带有灵活通配符和One-Off条件的模式匹配问题(pattern matching with flexible wildcards and One-Off condition,PMWOC)具有重要的理论意义和实际应用价值。给定带灵活通配符的模式和文本,目标是在线的计算模式在...

    ActiveMQ应用与实例1

    此外,ActiveMQ还支持Ajax、CXF、Axis等Web服务框架,以及RESTful API,提供了Message Groups、Virtual Destinations、Wildcards和Composite Destinations等功能,增强了消息路由的灵活性。 ActiveMQ的特性包括: ...

    SQLPrompt_7.4.0.471

    Latest version 7.4.0.471 This build of SQL Prompt includes: ...SQL Prompt no longer expands wildcards for ambiguous column lists (forum) Fix performance issue with licensing (forum)

Global site tag (gtag.js) - Google Analytics