Haulyn R. Jason wrote:
>
>>     > In case it is a, I would try the following settings:
>>     >
>>     > struts.action.extension=,,action
>>     >
>>
>>     
> 2.If I use Evans' way, it looks worked well but just need a "."..Struts
> do not have a solution for these?
>
> Thanks
>
>   

I thought this was supported by this version of Struts 2 but I never use
the DefaultActionMapper so I maybe a problem does exist there.

To fix:
1 create a custom action mapper copied from DefaultActionMapper.java
[link below]
2. enable it in struts.properties or struts.xml : ie.
struts.mapper.class = com.PatchedDefaultActionMapper
3. Apply a patch to the dropExtension method that accepts blank
extensions. Here is the updated method:

/**
* Drops the extension from the action name
*
* @param name
* The action name
* @return The action name without its extension
*/
String dropExtension(String name) {
if (extensions == null) {
return name;
}
Iterator it = extensions.iterator();
while (it.hasNext()) {
String value = (String) it.next();
if (value.length() > 0) {
String extension = "." + value;
if (name.endsWith(extension)) {
name = name.substring(0, name.length() - extension.length());
return name;
}
} else {
// allow a blank extension
if (!name.contains(".")) {
return name;
}
}
}
return null;
}

regards,
Jeromy Evans

[source]
http://svn.apache.org/viewvc/struts/struts2/tags/STRUTS_2_0_11_1/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java?view=markup


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to