You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rajeshwari Godbole <rg...@gmail.com> on 2009/01/16 06:02:22 UTC
Specifying a target while using the tag
Hello all,
I'm trying to display the results of clicking on a link within an iframe on
the same page. I'm using the s:a tag referencing an s:url tag to create the
link (as I need to pass parameters from the previous page's forms to the
link's action). Currently, it displays the resulting page (that is a PDF
report) on a new page. How do I make it direct the result to an iframe on
the same page? Is there an equivalent of the target attribute that you get
in the HTML href tag? I've also tried embedding the entire s:url in the <a
href> tag but that does not work.
As always, any help is much appreciated. Thanks!
Here is a snippet of my code in the jsp:
<s:url id="url2" includeParams='none' action="chartView">
<s:param name="toDate">
<s:property value="toDate" />
</s:param>
<s:param name="fromDate">
<s:property value="fromDate" />
</s:param>
</s:url>
<ul>
<li><s:a href="%{url2}">View Chart</s:a></li>
<li><a
href="<s:url id='url2' includeParams='none'
action='chartView'><s:param name='toDate'><s:property value='toDate'
/></s:param><s:param name='fromDate'><s:property value='fromDate'
/></s:param></s:url>"
target="contentFrame">View Chart2</a></li>
</ul>
<iframe id="contentFrame" name="contentFrame" scrolling="no" align="center"
frameborder="0" width="520px"
height="750px" style="overflow:hidden;"></iframe>
Re: Specifying a target while using the tag
Posted by Wes Wannemacher <we...@wantii.com>.
On Fri, 2009-01-16 at 10:32 +0530, Rajeshwari Godbole wrote:
[snip]
>
> Here is a snippet of my code in the jsp:
>
> <s:url id="url2" includeParams='none' action="chartView">
> <s:param name="toDate">
> <s:property value="toDate" />
> </s:param>
> <s:param name="fromDate">
> <s:property value="fromDate" />
> </s:param>
> </s:url>
> <ul>
> <li><s:a href="%{url2}">View Chart</s:a></li>
> <li><a
> href="<s:url id='url2' includeParams='none'
> action='chartView'><s:param name='toDate'><s:property value='toDate'
> /></s:param><s:param name='fromDate'><s:property value='fromDate'
> /></s:param></s:url>"
> target="contentFrame">View Chart2</a></li>
> </ul>
>
> <iframe id="contentFrame" name="contentFrame" scrolling="no" align="center"
> frameborder="0" width="520px"
> height="750px" style="overflow:hidden;"></iframe>
I have been successful using the vanilla HTML 'a' tag with the <s:url.
Try this -
<a href="<s:url id='url2' includeParams='none' action='chartView'>
<s:param name='toDate' value='%{toDate}' />
<s:param name='fromDate' value='%{fromDate}' />
</s:url>" target="contentFrame">View Chart2</a>
--
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org