Discussion:
Executing action in a new tab?
sd9
2009-02-02 02:47:43 UTC
Permalink
Hi,

I have a form with a submit button which performs an action.
On the same form I have link which is supposed to perform another action to
upload an image to the server.

I want the uploading action to be performed on a new page. Which means that
when I click the "upload image" link, I want a new browser tab to open, and
I want the uploading action to be executed there.
Is this possible?
I tried this:
<s:url action=
<s:param name="id" value="Upload Image" /></s:url>">


But it doesn't work!
--
View this message in context: http://www.nabble.com/Executing-action-in-a-new-tab--tp21783256p21783256.html
Sent from the Struts - User mailing list archive at Nabble.com.
Dave Newton
2009-02-02 03:09:16 UTC
Permalink
Post by sd9
I want the uploading action to be performed on a new page. Which means that
when I click the "upload image" link, I want a new browser tab to open, [...]
Making a new *tab* open can be problematic; just search the web for
"javascript open tab". Not a Struts question, though; that'd be a
JavaScript issue.

Dave
Martin Gainty
2009-02-02 03:57:26 UTC
Permalink
a fairly good example is located at http://www.blueskyworkshop.com/topics/JavaScript-Pages/examples/Dojo-Tabs-With-Code.phponce you get it working ping me offline to wire into strutsMartin ______________________________________________ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. > Date: Sun, 1 Feb 2009 22:09:16 -0500> From: ***@yahoo.com> To: ***@struts.apache.org> Subject: Re: Executing action in a new tab?> > sd9 wrote:> > I want the uploading action to be performed on a new page. Which means that> > when I click the "upload image" link, I want a new browser tab to open, [...]> > Making a new *tab* open can be problematic; just search the web for > "javascript open tab". Not a Struts question, though; that'd be a > JavaScript issue.> > Dave> > > ---------------------------------------------------------------------> To unsubscribe, e-mail: user-***@struts.apache.org> For additional commands, e-mail: user-***@struts.apache.org>
_________________________________________________________________
Windows Live™ Hotmail®:…more than just e-mail.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_explore_012009
Dave Newton
2009-02-02 05:13:08 UTC
Permalink
Post by Martin Gainty
a fairly good example is located at http://www.blueskyworkshop.com/topics/JavaScript-Pages/examples/Dojo-Tabs-With-Code.php
That opens a new browser tab?

Dave
sd9
2009-02-02 12:49:48 UTC
Permalink
Errr....I doubt if that'd work...I'm looking for struts 2 tags.
How do you use this dojo tab thing. Never heard of it....
Post by Martin Gainty
a fairly good example is located at
http://www.blueskyworkshop.com/topics/JavaScript-Pages/examples/Dojo-Tabs-With-Code.phponce
you get it working ping me offline to wire into strutsMartin
______________________________________________ Disclaimer and
confidentiality note Everything in this e-mail and any attachments relates
to the official business of Sender. This transmission is of a confidential
nature and Sender does not endorse distribution to any party other than
intended recipient. Sender does not necessarily endorse content contained
action in a new tab?> > sd9 wrote:> > I want the uploading action to be
performed on a new page. Which means that> > when I click the "upload
image" link, I want a new browser tab to open, [...]> > Making a new *tab*
open can be problematic; just search the web for > "javascript open tab".
Not a Struts question, though; that'd be a > JavaScript issue.> > Dave> >
Post by Martin Gainty
--------------------------------------------------------------------->
_________________________________________________________________
Windows Live™ Hotmail®:…more than just e-mail.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_explore_012009
--
View this message in context: http://www.nabble.com/Executing-action-in-a-new-tab--tp21783256p21789120.html
Sent from the Struts - User mailing list archive at Nabble.com.
mitch gorman
2009-02-05 14:01:22 UTC
Permalink
Post by sd9
Is this possible?
<s:url action=
<s:param name="id" value="Upload Image" /></s:url>">
But it doesn't work!
mitch gorman
2009-02-05 15:03:49 UTC
Permalink
wow... having a real issue this morning with sending replies before
i'm actually ready... guess the coffee hasn't made it down to the
fingers, yet...
Post by sd9
Is this possible?
perhaps it is (i have no idea if there's javascript to explicitly
open a tab), but that's certainly going to be browser-dependent. you
can definitely cause a new window to be opened... for *me*, that would
cause a tab to open, since that's how i've got FF set up. someone still
using IE6, however, would be SOL, w.r.t. tabs.
Post by sd9
<s:url action=
<s:param name="id" value="Upload Image" /></s:url>">
But it doesn't work!
well, as you can see, your example didn't really show up very well.

you'll want to do your actual link using a regular anchor tag, not
the s:a tag. that's because the s:a tag (at least according to
http://struts.apache.org/2.x/docs/a.html) surprisingly doesn't support
the (HTML) target= attribute, which is what you need.

so, you'd just need something like this:
<a target="_new" href="#"
onclick="window.open('//url/for/uploading', ...);">Upload Image</a>

if you needed to pass params from the form to the upload URL, then
you could use:

<s:url action="uploadAction.do" id="uploadurl">
<s:param name="param1" value="value1" />
<s:param name="param2" value="value2" />
...
</s:url>
<a target="_new" href="#" onclick="window.open('<s:property
value="#uploadurl" />', ...);">Upload Image</a>


HTH.

(anyone got an explanation why there's not target attribute for the
s:a tag? fine, maybe call it "htmlTarget", so there's less confusion
between it and the "targets" attribute, for the ajax s:a tag. still,
i'm really surprised to discover that it's missing...)
Dave Newton
2009-02-05 16:55:14 UTC
Permalink
Post by mitch gorman
(anyone got an explanation why there's not target attribute for the
s:a tag? fine, maybe call it "htmlTarget", so there's less confusion
between it and the "targets" attribute, for the ajax s:a tag. still,
i'm really surprised to discover that it's missing...)
Probably because the <s:a...> tag is, as the documentation states,
really for the Ajax theme. AFAICT the canonical way to make non-Ajax
links in a JSP is to create the URL via <s:url...> and use HTML anchor tags.

Dave

Loading...