*More cleaned code for understanding.*
I am not sure what is wrong. I tried alot.
**PROBLEM:** *this.getId() is not set thus generating error*
**URL generated which is fine. I need that.**
http://localhost:8000/1_Struts2_Tiles_mvn/person/edit/8
**Enabled in struts.xml**
<constant name="struts.enable.SlashesInActionNames" value="true"/>
<constant name="struts.mapper.alwaysSelectFullNamespace"
value="false"/>
<constant name="struts.patternMatcher" value="regex"/>
**URL is generated in simple Grid. Setter/Getter are in Action Class**
<s:url id="editURL" action="edit/%{id}" > </s:url>
<s:a href="%{editURL}"><i
class="icon-edit"></i></s:a>
**struts.xml**
<package name="person" namespace="/person" extends="tiles-default">
<interceptors>
<interceptor-stack name="byPassValidation">
<interceptor-ref name="params"/>
<interceptor-ref name="validation">
<param
name="excludeMethods">getAllPersons,getPersonById,input,back,cancel,browse</param>
</interceptor-ref>
<interceptor-ref name="workflow">
<param
name="excludeMethods">getAllPersons,getPersonById,input,back,cancel,browse</param>
</interceptor-ref>
</interceptor-stack>
</interceptors>
<action name="edit/{id}" class="com.myapp.action.PersonAction"
method="getPersonById">
<interceptor-ref name="byPassValidation"/>
<result name="success"
type="tiles">/person.edit.tiles</result>
</action>
</package>
**Action Class Method**
private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getPersonById() throws Exception {
LOG.debug("getPersonById() = {} executed---->>>>",
this.getId());
person = personDAO.get(this.getId());
return SUCCESS;
}
**ERROR:**
java.lang.NullPointerException
com.myapp.action.PersonAction.getPersonById(PersonAction.java:61)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
**CONSOLE:**
07:39:24,424 DEBUG DefaultActionProxy:68 - Creating an
DefaultActionProxy for namespace /person and action name edit/8
07:39:24,425 DEBUG AbstractMatcher:68 - Attempting to match 'edit/8' to
a wildcard pattern, 2 available
07:39:24,425 DEBUG AbstractMatcher:68 - Value matches pattern
'edit/{id}'
07:39:24,428 DEBUG ParametersInterceptor:68 - Setting params
07:39:24,428 DEBUG DefaultWorkflowInterceptor:68 - Skipping
Interceptor... Method [getPersonById] found in exclude list.
07:39:24,429 DEBUG DefaultActionInvocation:68 - Executing action method
= getPersonById