< html:frame /> html tag

< html:frame /> html tag

Previous Home Next

 

This tag renders an HTML <frame> element which is similier to performed by the <html:link> tag for the href attributeis.

This tag have following attributes :-

  • action :-This is URL where form will be submitted. This contains the actual content-relative URI of the destination of this transfer.
  • bundle :-This attributes specifies a MessageResources key of the resource bundle defined in the struts-config element .
  • forward
  • frameName
  • frameBorder etc.

 

Directory Structure of FrameTagExample in Struts 1.3 Using MyEclipse IDE




index.jsp

<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<html>
<head>
<title><bean:message key="label.title"/></title>
</head>
<body>
<h3><bean:message key="label.header"/></h3>
<h3><bean:message key="label.frame1"/></h3>
</body>
</html>

web.xml

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >
 
<web-app>
  <display-name>Maven Struts Examples</display-name> 
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>
        org.apache.struts.action.ActionServlet
    </servlet-class>
    <init-param>
        <param-name>config</param-name>
        <param-value>
         /WEB-INF/struts-config.xml
        </param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet> 
  <servlet-mapping>
       <servlet-name>action</servlet-name>
       <url-pattern>*.do</url-pattern>
  </servlet-mapping> 
</web-app>

struts-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC 
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
  <form-beans>
  </form-beans>
  <global-exceptions />
  <global-forwards />
  <action-mappings >
    <action path="/frame" type="org.apache.struts.actions.ForwardAction" parameter="/index.jsp"/>
		<action path="/frameAction" type="org.r4r.struts.FrameAction">	
         <forward name="success" path="/frame2.jsp"/>
		</action>
  </action-mappings>
  <message-resources parameter="org.r4r.struts.ApplicationResources" />
</struts-config>

FrameAction.java

package org.r4r.struts;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class FrameAction extends Action {
	public ActionForward execute(ActionMapping mapping,ActionForm form,
		HttpServletRequest request,HttpServletResponse response) throws Exception{
		return mapping.findForward("success");
	}
}

ApplicationResources.properties

# Resources for parameter 'org.r4r.struts.ApplicationResources'
# Project Struts1.3_FrameTagExample
#label message
label.title=Struts html:frame tag example
label.header=Struts html:frame tag example
label.frame1 = This is Frame First 
label.frame2 = This is frame Second

frame1.jsp

<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<html>
<head>
<title><bean:message key="label.title"/></title>
</head>
<body>
<h3><bean:message key="label.header"/></h3>
<h3><bean:message key="label.frame1"/></h3>
</body>
</html>

frame2.jsp

<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<html>
<head>
<title><bean:message key="label.title"/></title>
</head>
<body>
<h3><bean:message key="label.header"/></h3>dfgdgdgdd
<h3><bean:message key="label.frame2"/></h3>
</body>
</html>

Output




Previous Home Next