2012-10-18 55 views
0

在servlet的我用發送URL消息作爲參數

response.sendRedirect("index.jsp?msg=Login failed"); 

味精後?在重定向時發送消息。 如何做同樣的事情,與struts2的

由於重定向是通過在struts.xml

<result name="error">/index.jsp</result> 

我只是個初學者在Struts框架

+0

您顯示的結果不是重定向,而是前鋒。 –

回答

0
在一個延伸你的動作類

ActionSupport

addActionError("Login failed"); 

in your index.jsp:

<s:actionerror/> 
+0

thnx它工作和問題得到解決,感謝噸 – Javasist

0
<result name="error" type="redirect" > 
    <param name="location">index.jsp?msg=${actionMessage}</param> 
    <param name="parse">true</param> 
    <param name="encode">true</param> 
</result>