I'm using Tuckey UrlRewrite in combination with a Struts2 application.
I'm trying to convert following URL:
/promotions/abcdef-987
to /dopromotions/detail
passing variable id
as 987
.
My rewrite rule is as follows:
<rule>
<from>^/(promoties|promotions)/([0-9a-zA-Z\-_]+)-([0-9]+)$</from>
<set type="parameter" name="id">$3</set>
<to>/dopromotions/detail</to>
</rule>
And my Struts2 Action has following getters and setters:
private Integer id;
public void setId(Integer id){
this.id = id;
}
public Integer getId(Integer id){
return id;
}
However, the variable never gets entered. When debugging, I can't find id
anywhere in the parameter or attribute scope.
I've tried removing type="parameter"
. This puts id
in the attribute scope, but it doesn't get entered in my variable Integer id
.