struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Viggio, Alex" <Alex.Vig...@globalcrossing.com>
Subject Hijacking ActionErrors to display in frames
Date Tue, 14 Jan 2003 18:05:10 GMT
I'm having a problem due to the frame-based layout of one of our pages.
Because the framing page (w/ the frameset/frames definition) gets the
request first, the ActionErrors in the request don't make it down to the
sub-frame pages. Is it possible to "hijack" the action errors via a scriplet
in the framing page that forwards the ActionErrors (as ActionErrors) along
to one or more framed JSPs.

I found the following posting, but I'd prefer to forward the actual
ActionErrors instead of just an HTML string representation.

Anyone have experience with this? What is the identifying name for the
ActionErrors object in the request?

Thanks,
- Alex

*** http://www.mail-archive.com/struts-user@jakarta.apache.org/msg22734.html
***

Solved: ActionErrors within frames manually forwarded

----------------------------------------------------------------------------
----

From: holger.wiechert 
Subject: Solved: ActionErrors within frames manually forwarded 
Date: Tue, 05 Feb 2002 10:42:10 -0800 

----------------------------------------------------------------------------
----

Well, after an eternity, the problem found was
that the ApplicationResources property "errors.header" 
had a value with double quotes in it (like <font color="red">).
That spoiled the src string in the frame page.

Have fun,
Holger

-----Urspr√ľngliche Nachricht-----
Von:    holger.wiechert@web.de [SMTP:holger.wiechert@web.de]
Gesendet am:    Dienstag, 5. Februar 2002 12:37
An:     struts-user@jakarta.apache.org
Betreff:        ActionErrors within frames manually forwarded

Hi,

I've spent some time checking the list for this issue,
but I could only find related topics, that didn't really help. 
In case that this has been answered before, please ignore it
and send me a link.

I think that there must be something I've missed
when using the Struts validation feature within frames.
In short: I'm trying to manually retrieve and "forward" the ActionErrors
within a frame definition page (which is the "input" page
for a mapping). But those manually set request parameters
are gone when I access them.

The situation is as follows:

The page myframe.jsp consists of two frames: 
mynavigation.jsp and myContent.jsp. 
myContent.jsp is the JSP that is validated. 
In case that a validation error (ActionError) occurs,
the follwoing (relevant) events occur (correct me if I'm wrong)
- Struts puts the ActionErrors I created within validate into the request
- a forward to the "input" page is done as defined in the struts-config (in
  my case the "action" entry is:
    <action  path="/myContentActionPath"
             type="some.SomeAction"
             name="contentForm"
             scope="session"
             validate="true"
             input="/myframe.jsp">
      <forward name="back" path="/somePrev.jsp"/>
      <forward name="next" path="/someNext.jsp"/>
    </action>

  so it leads to the frame page.
- within the myframe.jsp, two new requests are created: one for each frame

But I think I should still be able to access the request with the
ActionErrors
within the frame definition page. So in myframe.jsp I could do something
like:

myframe.jsp:
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html>
<head>
  <html:base/> 
  <title>MyTitle</title>
        <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<frameset cols="150,*" frameborder="no" border="0" framespacing=0> 
  <frame src="myNavigation.jsp" NAME="Menue">
  <frame src="myContent.jsp?manuallySetParam=<html:errors 
property="myErrorProperty"/>" NAME="content">
  </frameset>
<noframes>
</noframes> 
</html:html>


in order to retrieve the ActionError String for property "myErrorProperty"
within the content page:

myContent.jsp:

...

<P> <%= request.getParameter("manuallySetParam") %> </P>

....


This - I agree - doesn't look elegant, but at least it should work.

If I have the input page defined as a pure jsp (no frames),
the html:errors are retrieved as expected.

Are there any ideas, why the parameter "manuallySetParam" does not
contain the error message of key "myErrorProperty" ?

Help and/or design suggestions greatly appreciated!

Thanks in advance,
Holger

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message