■
リダイレクト時のパラメータってどうやって付けるんでしょうか?
パラメータが動的だと、struts-config.xml に書けないしね。
私はこんなの作って使っていますが。
import java.util.Iterator; import java.util.Map; import java.util.TreeMap; import org.apache.struts.action.RedirectingActionForward; /** * パラメータ付きリダイレクト. * Tiles を採用した path には使えない. */ public class RedirectingParameterForward extends RedirectingActionForward { /** * パラメータ保持用. **/ protected final Map parameters_ = new TreeMap(); /** * アンカー名. **/ protected String anchorName_ = ""; /** * コンストラクタ. **/ public RedirectingParameterForward() { super(); } /** * コンストラクタ. * * @param path リダイレクトパス **/ public RedirectingParameterForward(String path) { super(path); } /** * パラメータ追加. * * @param name パラメータ名 * @param value パラメータ値 **/ public void addParameter(String name, String value) { parameters_.put(name, value); } /** * アンカー名設定. * . * * @param name アンカー名 **/ public void setAnchorName(String anchorName) { anchorName_ = anchorName; } /** * パス取得. * * @see org.apache.struts.config.ForwardConfig#getPath() * @return パス */ public String getPath() { final StringBuffer strBuf = new StringBuffer(this.path); if (parameters_.size() > 0) { final Iterator i = parameters_.keySet().iterator(); String tempKey, tempValue; tempKey = (String) i.next(); tempValue = (String) parameters_.get(tempKey); strBuf.append("?"); strBuf.append(tempKey); strBuf.append("="); strBuf.append(tempValue); while (i.hasNext()) { tempKey = (String) i.next(); tempValue = (String) parameters_.get(tempKey); strBuf.append("&"); strBuf.append(tempKey); strBuf.append("="); strBuf.append(tempValue); } } if (anchorName_.length() > 0) { strBuf.append("#"); strBuf.append(anchorName_); } return strBuf.toString(); } }