首先进入preference_frame.jsp页面 依次执行 到editPreference.jsp页面得不到
1.preference_frame.jsp
<iframe id="preferenceFrame" src="viewpreference.do" marginwidth="0" marginheight="0" frameborder="0" width="882" height="430"
allowtransparency="allowTransparency"></iframe>
2.ViewUserPreferenceAction
public class ViewUserPreferenceAction extends BaseAction { public ActionForward executeAction(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws BaseException {
/*
略
*/
return mapping.findForward("modifypreference");
}}
3.editPreference.jsp
<html><head></head><body>${preference!=null}
<%
System.out.println("page====preference==="+request.getAttribute("preference"));
%>
<table width="864" border="0" align="center" cellpadding="0" cellspacing="10">
/* 略*/
<c:if test="${preference!=null}">
<div id="flash">
<font color="red">您已成功更改信息 !</font>
<a href="javascript:;" onClick="hide()" class="close"><font
color="red">x</font> </a>
</div>
</c:if>
</table>
</body>
</html>
4.EditUserPreferenceAction.java
public class EditUserPreferenceAction extends BaseAction { public ActionForward executeAction(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws BaseException {
/* 略 */
request.setAttribute("preference", "success");
System.out.println("preference===="+request.getAttribute("preference"));
return mapping.findForward("modifypreference");
}}
5.struts-config.xml
<action path="/editpreference" forward="/account/preference_frame.jsp"/>
<action path="/modifypreference" forward="/account/editPreference.jsp"/> <action path="/viewpreference" type="com.pingoe.struts.action.account.ViewUserPreferenceAction">
<forward name="modifypreference" path="/modifypreference.do"/>
</action>
<action
attribute="editUserPreferenceForm"
input="/account/editPreference.jsp"
name="editUserPreferenceForm"
path="/editUserPreference"
scope="request"
type="com.pingoe.struts.action.account.EditUserPreferenceAction">
<forward name="modifypreference" path="/modifypreference.do"/>
</action>
1.preference_frame.jsp
<iframe id="preferenceFrame" src="viewpreference.do" marginwidth="0" marginheight="0" frameborder="0" width="882" height="430"
allowtransparency="allowTransparency"></iframe>
2.ViewUserPreferenceAction
public class ViewUserPreferenceAction extends BaseAction { public ActionForward executeAction(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws BaseException {
/*
略
*/
return mapping.findForward("modifypreference");
}}
3.editPreference.jsp
<html><head></head><body>${preference!=null}
<%
System.out.println("page====preference==="+request.getAttribute("preference"));
%>
<table width="864" border="0" align="center" cellpadding="0" cellspacing="10">
/* 略*/
<c:if test="${preference!=null}">
<div id="flash">
<font color="red">您已成功更改信息 !</font>
<a href="javascript:;" onClick="hide()" class="close"><font
color="red">x</font> </a>
</div>
</c:if>
</table>
</body>
</html>
4.EditUserPreferenceAction.java
public class EditUserPreferenceAction extends BaseAction { public ActionForward executeAction(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws BaseException {
/* 略 */
request.setAttribute("preference", "success");
System.out.println("preference===="+request.getAttribute("preference"));
return mapping.findForward("modifypreference");
}}
5.struts-config.xml
<action path="/editpreference" forward="/account/preference_frame.jsp"/>
<action path="/modifypreference" forward="/account/editPreference.jsp"/> <action path="/viewpreference" type="com.pingoe.struts.action.account.ViewUserPreferenceAction">
<forward name="modifypreference" path="/modifypreference.do"/>
</action>
<action
attribute="editUserPreferenceForm"
input="/account/editPreference.jsp"
name="editUserPreferenceForm"
path="/editUserPreference"
scope="request"
type="com.pingoe.struts.action.account.EditUserPreferenceAction">
<forward name="modifypreference" path="/modifypreference.do"/>
</action>
楼主【quxiuer】截止到2008-07-29 15:19:04的历史汇总数据(不包括此帖):
发帖的总数量:9 发帖的总分数:90 每贴平均分数:10
回帖的总数量:18 得分贴总数量:4 回帖的得分率:22%
结贴的总数量:9 结贴的总分数:90
无满意结贴数:3 无满意结贴分:60
未结的帖子数:0 未结的总分数:0
结贴的百分比:100.00% 结分的百分比:100.00%
无满意结贴率:33.33 % 无满意结分率:66.67 %
敬礼!
<forward name="modifypreference" path="/modifypreference.do"/>
</action>
不需要转那么多回吧
改成,
<action path="/viewpreference" type="com.pingoe.struts.action.account.ViewUserPreferenceAction">
<forward name="modifypreference" path="account/editPreference.jsp"/>
</action>
你可以扩大一下范围利用session取值!
我觉得得修改下面的东西
<action
attribute="editUserPreferenceForm"
input="/account/editPreference.jsp"
name="editUserPreferenceForm"
path="/editUserPreference"
scope="request"
type="com.pingoe.struts.action.account.EditUserPreferenceAction">
<forward name="modifypreference" path="/account/editPreference.jsp"/>
</action>但还是不行
<%
System.out.println("page====preference==="+request.getAttribute("preference"));
%> 打印有值 页面上
<c:if test="${preference!=null}">
<div id="flash">
<font color="red">您已成功更改信息 ! </font>
<a href="javascript:;" onClick="hide()" class="close"> <font
color="red">x </font> </a>
</div>
</c:if> 没有执行
<action path="/editpreference" forward="/account/preference_frame.jsp"/> <action path="/modifypreference" forward="/account/editPreference.jsp"/> <action path="/viewpreference" type="com.pingoe.struts.action.account.ViewUserPreferenceAction">
<forward name="modifypreference" path="/modifypreference.do"/>
</action>
<action
attribute="editUserPreferenceForm"
input="/account/editPreference.jsp"
name="editUserPreferenceForm"
path="/editUserPreference"
scope="request"
type="com.pingoe.struts.action.account.EditUserPreferenceAction">
<forward name="modifypreference" path="/modifypreference.do"/>
</action>
System.out.println("page====preference==="+request.getAttribute("preference"));
%>和<c:if test="${preference!=null}">
<div id="flash">
<font color="red">您已成功更改信息 ! </font>
<a href="javascript:;" onClick="hide()" class="close"> <font
color="red">x </font> </a>
</div>
</c:if>之间的语句对request有操作呀,建议检查一下别外<c:if test="${preference!=null}"> ....部分换成<%..%>形式,不知道能不能执行
实在不行,只能像楼上说的放在Session中了
<c:if test="${preference!=null}">
<div id="flash">
<font color="red">您已成功更改信息 ! </font>
<a href="javascript:;" onClick="hide()" class="close"> <font
color="red">x </font> </a>
</div>
</c:if>
换成了
<%
if (request.getSession().getAttribute("preference")!=null) {
%>
<div id="flash">
<font color="red">您已成功更改信息 !</font>
<a href="javascript:;" onClick="hide()" class="close"><font
color="red">x</font> </a>
</div>
<%} %>
也不行
但是重新从preference_frame.jsp进入页面就显示 您已成功更改信息 !
你是说在<action path="/modifypreference" forward="/account/editPreference.jsp"/>
这个action中再传一下值是吧
很有道理 我试试吧