我想在我的网络应用程序中使用漂亮/干净的URL. 我想要以下网址: http://mydomain.com/myapp/calculator ..解决: com.mydomain.myapp.action.CalculatorActionBean 我尝试用以下代码覆盖NameBasedActionResolver:
我想要以下网址:
http://mydomain.com/myapp/calculator
..解决:
com.mydomain.myapp.action.CalculatorActionBean
我尝试用以下代码覆盖NameBasedActionResolver:
public class CustomActionResolver extends NameBasedActionResolver { public static final String DEFAULT_BINDING_SUFFIX = "."; @Override protected String getBindingSuffix() { return DEFAULT_BINDING_SUFFIX; } @Override protected List<String> getActionBeanSuffixes() { List<String> suffixes = new ArrayList<String>(super.getActionBeanSuffixes()); suffixes.add(DEFAULT_BINDING_SUFFIX); return suffixes; } }
并将其添加到web.xml:
<servlet-mapping> <servlet-name>StripesDispatcher</servlet-name> <url-pattern>*.</url-pattern> </servlet-mapping>
这让我:
http://mydomain.com/myapp/Calculator.
但:
>一个流浪的“.”既不漂亮也不干净.
>类名仍然在URL中大写..?
>那仍然留给我* .jsp ..?是否有可能摆脱.action和.jsp?
@UrlBinding( “/运算部”)