You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Peter Alfors <pe...@irista.com> on 2001/06/14 15:52:32 UTC

Re: struts-config.xml - How do I open a "success" path as a new window???

What happens when you execute this?

<td align="left"><a class="leftnav" href="myAction.do"
target="_blank"><bean:message key="icon.calendar"/></td>

I would think that this should do what you want??

Pete


>      -----Original Message-----
>      From: Linnea Ahlbeck [mailto:linnea.ahlbeck@appium.com]
>      Sent: Wednesday, June 13, 2001 1:52 AM
>      To: struts-user@jakarta.apache.org
>      Subject: struts-config.xml - How do I open a "success" path
>      as a new window???
>
>      Hi!!
>
>      I want to my path
>
>          <forward name="success" path="/InsertAddress.jsp"/>
>
>      to open the jsp-page as a new window/page ( like the html
>      tag
>
>      <td align="left"><a class="leftnav" href="http://...../"
>      target="_blank"><bean:message key="icon.calendar"/></td> )
>
>      Any ideas how to do this with struts???
>
>      Thanks / Linnéa
>
>
>

Re: struts-config.xml - How do I open a "success" path as a new window???

Posted by Peter Alfors <pe...@irista.com>.
When you say 'return', do you mean you want to close the new window?
Or do you want to open a new link in the original window?
If you just want to close the window, then you can use a javascript command such
as:  window.close()
However, if you want to open a link in the parent window, it is a bit more
tricky.
I wrote a quick test to see if it would work...Here is the code I used:

The parent page:

<HTML>
  <BODY>
     <form name="test1" id="test1" method="POST" target="_blank"
action="testOpenerUpdate.html">
        <INPUT type="submit" value="test setting window.opener URL">
     </form>
     <a href="javascript:window.open('testOpenerUpdate.html', 'testwindow',
location='yes')">test setting window.opener URL</a>
  </BODY>
</HTML>

the child page (testOpenerUpdate.html):

<HTML>
  <HEAD>
    <SCRIPT language="JavaScript">
    function setOpenerUrl(newUrl)
    {
      window.opener.document.location.replace(newUrl);
      window.close();
    }
    </SCRIPT>
  </HEAD>
  <BODY>
    <FORM name="myForm" id="myForm" method="POST">
       <INPUT type="button" name="test" id="test"
onClick="setOpenerUrl('http://www.lycos.com')" value="send parent window to
lycos">
    </FORM>
  </BODY>
</HTML>

It appears that when submitting a form to a target '_blank', that the new window
is not actually a child of the current window.  Therefore, you cannot refer back
to it.  However, if you use a javascript, open() call, then you do create an
actual child.

I know that this is not a complete solution for you, but hopefully it is a step
in the right direction??

Pete

Linnea Ahlbeck wrote:

> Hi Pete!!
>
> This works, I didn´t know that I could use the target attribute in the
> <html:form> tag! Thanks! Do you also know how to specify the "old window" as
> target from the second window , I would like to return to the first window
> when the actions here are done?
>
> /Linnéa
>
> ----- Original Message -----
> From: "Craig R. McClanahan" <cr...@apache.org>
> To: <st...@jakarta.apache.org>
> Sent: Thursday, June 14, 2001 7:33 PM
> Subject: Re: struts-config.xml - How do I open a "success" path as a new
> window???
>
> On Thu, 14 Jun 2001, Peter Alfors wrote:
>
> >
> > What happens when you execute this?
> >
> > <td align="left"><a class="leftnav" href="myAction.do"
> > target="_blank"><bean:message key="icon.calendar"/></td>
> >
> > I would think that this should do what you want??
> >
>
> You can also use the "target" attribute on an <html:form> or <html:link>
> tag:
>
>   <td align="left">
>     <html:link styleclass="leftnav" page="/myAction.do"
>                    target="_blank">
>       <bean:message key="icon.calendar"/>
>     </html:link>
>   </td>
>
> One advantage to this is that URL rewriting is automatically applied to
> maintain session state even if you're not using cookies.
>
> > Pete
> >
>
> Craig
>
> >
> > >      -----Original Message-----
> > >      From: Linnea Ahlbeck [mailto:linnea.ahlbeck@appium.com]
> > >      Sent: Wednesday, June 13, 2001 1:52 AM
> > >      To: struts-user@jakarta.apache.org
> > >      Subject: struts-config.xml - How do I open a "success" path
> > >      as a new window???
> > >
> > >      Hi!!
> > >
> > >      I want to my path
> > >
> > >          <forward name="success" path="/InsertAddress.jsp"/>
> > >
> > >      to open the jsp-page as a new window/page ( like the html
> > >      tag
> > >
> > >      <td align="left"><a class="leftnav" href="http://...../"
> > >      target="_blank"><bean:message key="icon.calendar"/></td> )
> > >
> > >      Any ideas how to do this with struts???
> > >
> > >      Thanks / Linnéa
> > >
> > >
> > >
> >


Re: enhancement for the Struts HTML library?

Posted by Martin Cooper <ma...@tumbleweed.com>.
You should take a look at David Winterfeldt's Struts Validator at:

http://home.earthlink.net/~dwinterfeldt/

This does most, if not all, of what you want.

--
Martin Cooper


----- Original Message -----
From: "Kwang-Shi Shu" <ks...@vill.com>
To: <st...@jakarta.apache.org>
Sent: Friday, June 15, 2001 8:43 AM
Subject: enhancement for the Struts HTML library?


> Hi,
>
> I used to use PBP Tag library that provides some nice features, such as
> whether the field is required, define the input pattern, convert the input
> to upper/lower case, etc. These features are more less for the front-end
> Java Script side. However, they are very convenient. Is there any way I
can
> have these features while using Struts HTML library, or do I have to
extend
> it? If possible, could we enhance the Struts HTML library to include these
> features?
>
> Thanks.
>
> Shu, Kwang-shi          | Tel 732-460-7848
> Village Networks, Inc.  | Fax 732-460-9851
> 246 Industrial Way West |
> Eatontown, NJ 078724    | email: kshu@vill.com
>
>
>



enhancement for the Struts HTML library?

Posted by Kwang-Shi Shu <ks...@vill.com>.
Hi,

	I used to use PBP Tag library that provides some nice features, such as
whether the field is required, define the input pattern, convert the input
to upper/lower case, etc. These features are more less for the front-end
Java Script side. However, they are very convenient. Is there any way I can
have these features while using Struts HTML library, or do I have to extend
it? If possible, could we enhance the Struts HTML library to include these
features?

	Thanks.

Shu, Kwang-shi          | Tel 732-460-7848
Village Networks, Inc.  | Fax 732-460-9851
246 Industrial Way West |
Eatontown, NJ 078724    | email: kshu@vill.com




Re: struts-config.xml - How do I open a "success" path as a new window???

Posted by Linnea Ahlbeck <li...@appium.com>.
Hi Pete!!

This works, I didn´t know that I could use the target attribute in the
<html:form> tag! Thanks! Do you also know how to specify the "old window" as
target from the second window , I would like to return to the first window
when the actions here are done?

/Linnéa

----- Original Message -----
From: "Craig R. McClanahan" <cr...@apache.org>
To: <st...@jakarta.apache.org>
Sent: Thursday, June 14, 2001 7:33 PM
Subject: Re: struts-config.xml - How do I open a "success" path as a new
window???




On Thu, 14 Jun 2001, Peter Alfors wrote:

>
> What happens when you execute this?
>
> <td align="left"><a class="leftnav" href="myAction.do"
> target="_blank"><bean:message key="icon.calendar"/></td>
>
> I would think that this should do what you want??
>

You can also use the "target" attribute on an <html:form> or <html:link>
tag:

  <td align="left">
    <html:link styleclass="leftnav" page="/myAction.do"
                   target="_blank">
      <bean:message key="icon.calendar"/>
    </html:link>
  </td>

One advantage to this is that URL rewriting is automatically applied to
maintain session state even if you're not using cookies.

> Pete
>

Craig


>
> >      -----Original Message-----
> >      From: Linnea Ahlbeck [mailto:linnea.ahlbeck@appium.com]
> >      Sent: Wednesday, June 13, 2001 1:52 AM
> >      To: struts-user@jakarta.apache.org
> >      Subject: struts-config.xml - How do I open a "success" path
> >      as a new window???
> >
> >      Hi!!
> >
> >      I want to my path
> >
> >          <forward name="success" path="/InsertAddress.jsp"/>
> >
> >      to open the jsp-page as a new window/page ( like the html
> >      tag
> >
> >      <td align="left"><a class="leftnav" href="http://...../"
> >      target="_blank"><bean:message key="icon.calendar"/></td> )
> >
> >      Any ideas how to do this with struts???
> >
> >      Thanks / Linnéa
> >
> >
> >
>




Re: struts-config.xml - How do I open a "success" path as a new window???

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 14 Jun 2001, Peter Alfors wrote:

> 
> What happens when you execute this?
> 
> <td align="left"><a class="leftnav" href="myAction.do"
> target="_blank"><bean:message key="icon.calendar"/></td>
> 
> I would think that this should do what you want??
> 

You can also use the "target" attribute on an <html:form> or <html:link>
tag:

  <td align="left">
    <html:link styleclass="leftnav" page="/myAction.do"
                   target="_blank">
      <bean:message key="icon.calendar"/>
    </html:link>
  </td>

One advantage to this is that URL rewriting is automatically applied to
maintain session state even if you're not using cookies.

> Pete
> 

Craig


> 
> >      -----Original Message-----
> >      From: Linnea Ahlbeck [mailto:linnea.ahlbeck@appium.com]
> >      Sent: Wednesday, June 13, 2001 1:52 AM
> >      To: struts-user@jakarta.apache.org
> >      Subject: struts-config.xml - How do I open a "success" path
> >      as a new window???
> >
> >      Hi!!
> >
> >      I want to my path
> >
> >          <forward name="success" path="/InsertAddress.jsp"/>
> >
> >      to open the jsp-page as a new window/page ( like the html
> >      tag
> >
> >      <td align="left"><a class="leftnav" href="http://...../"
> >      target="_blank"><bean:message key="icon.calendar"/></td> )
> >
> >      Any ideas how to do this with struts???
> >
> >      Thanks / Linnéa
> >
> >
> >
>