As Omnipresent and Shashi already said, you must encode the ampersand as &
so that the forward
definition looks like this:
<forward name="sample" path="/sample.do?button=default&value=text" />
However, the URLs defined in your struts-config.xml
are frozen, and if you need to dynamically change a value or add another parameter, you can do it by creating a new ActionForward
based on the forward that you get from mapping.findForward()
.
ActionForward forward = mapping.findForward("sample");
StringBuilder path = new StringBuilder(forward.getPath());
path.append("?id=");
path.append(someobject.getId());
path.append("&value=");
path.append(getValue());
return new ActionForward(path.toString());