• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

iFrame and struts

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a jsp which contains a iFrame. Using javascript I want to change the src of the iframe to a struts action. How can I do that.

I was able to assign a jsp to the src from javascript, but how can I make the control go to my struts action which can then forward it to the jsp?

Thanks,
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A struts action can be called from anywhere by including the ".do" suffix. This calls the struts action servlet, which in turn calls the action class. So, in answer to your question, simply have your javascript change the source of the iframe to "myAction.do"
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys

WHile using the IFrame and call the struts action make sure "/" should not be use..

Here is the code where i used .. pls go through this..

In JSP page : -

<iframe style="width:380px; height:150px; border: groove;" frameborder="1" id="eventinfo" src="viewEventBasicView.do" >

</iframe>

in struts config

<action path="/viewEventBasicView"
type="com.micros.portal.backOffice.forecasting.MyForecastBasicViewEventBasicDispatchAction"
scope="request"
name="MyForecastBasicViewEventForm"
validate="false">
<forward name="showbasicevent"
path="/WEB-INF/backOffice/forecasting/myForecastBasicViewEventInfo.jsp"
contextRelative="true" />

</action>

=============
<form-bean name ="MyForecastBasicViewEventForm"
type = "com.micros.portal.backOffice.forecasting.MyForecastBasicViewEventForm"/>
 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by saranga rao:
WHile using the IFrame and call the struts action make sure "/" should not be use..
<iframe style="width:380px; height:150px; border: groove;" frameborder="1" id="eventinfo" src="viewEventBasicView.do" >

</iframe>



You should use url rewriting for the src attribute:
 
I do some of my very best work in water. Like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic