You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mu Mike <mi...@hotmail.com> on 2004/04/16 12:08:32 UTC

still about

I mentioned this problem here days ago, and I asked the difference between 
redirect and forward here yesterday, but I m still at a loss to know why I 
got the exception

see: my.jsp is my jsp file , it exists in another jsp file which refers 
myjsp.jsp by an 
<iframe> ,that is <iframe src="myjsp.jsp"/>

my.jsp

<form name="myform" action ="/myapp/myaction.do" target="_self" >
...
</form>

<input type="button" value="submit" onclick="submit()"/>

<jsp:include page="myhtml.html"/>


<script>
function submit()
{
  myform.submit();

}



this is my action mapping

        <action path="/myapp/myaction"
            type="com.mypackage.myaction"
            name="myform"
            scope="session">
            <forward name="success" path="/myjsp.jsp"/>
        </action>


the action myaction does nothing than to modify the content of myhtml.html 
so when I forwarded back to myjsp.jsp, it shows different content.

I clicked the button on my jsp page, it throws "response already committed" 
exception, why?
and it indeed doest now always throw the exception, but it throws actually 
sometime.


I really want to know why, can anyone help?

_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。  http://www.hotmail.com  


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


Re: still about

Posted by Christian Bollmeyer <ja...@christianbollmeyer.de>.
On Friday 16 April 2004 12:08, Mu Mike wrote:

Hi,

probably I don't fully grok what's your exact
problem. What I get is that you have an <iframe>
plus a jsp page that's intended to be displayed
there. Forgetting about the <iframe> for the
moment, let's have a closer look at my.jsp.
I see a <form> that calls something, but also
an <input> tag outside the form declaration.
Then, there's JavaScript code that submits
the form. This, even if it works, is improvable
style. <input> tags should be embedded in
<forms>, and a button that does a submit
should be specified a such (type="submit").
Doing so would not only relieve you from
being dependant on JavaScript (which always
should be considered as something 'on top'
and not available in a web application, for
the user can easily turn it off), but achieve
the same behavior in a HTML specs compliant
manner. Fix this first. Then, considering the
action declaration, you may successfully update
myjsp.jsp this way, but the <iframe> on top
may not get aware of the change. You have
to update the whole page and have the <iframe>
load the fresh content implicitly. Don't know
where the 'session already commited' error
stems from, but this seems to be another
problem and neither related to Struts or
the Servlet API in general. I hate <iframes>,
but have done them in and out. As I already
started citing www.anwalt4you.com here,
I'll stick to it, and it just happens the SearchEngine
module uses an <iframe> for displaying seach
results. It definitely works (but also uses
JavaScript :-(, you can look at the HTML 
sources how I did it in the end, for I forgot).
Anyway. All in all, I doubt your problem is
related to JSP includes in any way. If you're in
doubt, we heavily used Tiles, and that is just
a (brilliant) enhancement of the
RequestDispatcher.include() mechanism
which is the basis for the <jsp:include>
tag as well. But fix the other problems
first.

HTH,
-- Chris.


> I mentioned this problem here days ago, and I asked the difference
> between redirect and forward here yesterday, but I m still at a loss
> to know why I got the exception
>
> see: my.jsp is my jsp file , it exists in another jsp file which
> refers myjsp.jsp by an
> <iframe> ,that is <iframe src="myjsp.jsp"/>
>
> my.jsp
>
> <form name="myform" action ="/myapp/myaction.do" target="_self" >
> ...
> </form>
>
> <input type="button" value="submit" onclick="submit()"/>
>
> <jsp:include page="myhtml.html"/>
>
>
> <script>
> function submit()
> {
>   myform.submit();
>
> }
>
>
>
> this is my action mapping
>
>         <action path="/myapp/myaction"
>             type="com.mypackage.myaction"
>             name="myform"
>             scope="session">
>             <forward name="success" path="/myjsp.jsp"/>
>         </action>
>
>
> the action myaction does nothing than to modify the content of
> myhtml.html so when I forwarded back to myjsp.jsp, it shows different
> content.
>
> I clicked the button on my jsp page, it throws "response already
> committed" exception, why?
> and it indeed doest now always throw the exception, but it throws
> actually sometime.
>
>
> I really want to know why, can anyone help?
>
> _________________________________________________________________
> ÏíÓÃÊÀœçÉÏ×îŽóµÄµç×ÓÓÊŒþϵͳ¡ª MSN Hotmail¡£  http://www.hotmail.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

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