This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

iFrame and struts  RSS feed

 
Krupa Eng
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • 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,
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • 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"
 
saranga rao
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • 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"/>
 
Dom Lassy
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • 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:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!