struts2与ext一起用,找不到action

这是跳转页面

Ext.onReady( function() {
		//Ext.Msg.alert('ext','welcome you!');
		var addPanel = function(btn, event) {
			var n;
			n = tabPanel.getComponent(btn.id);
			if(n) {
				tabPanel.setActiveTab(n);
				return;
			}
			n = tabPanel.add( {
				id : btn.id,
				title : btn.id,
				html : '<iframe width=100% height=100% src=' + btn.id + ' />',
				//autoLoad : '',
				closable : 'true'
			});
			tabPanel.setActiveTab(n);
		}

		var item1 = new Ext.Panel( {
			title : 'Category管理',
			//html : '<empty panel>',
			cls : 'empty',
			items : [ 
				new Ext.Button({
					id : 'Category-list',
					text : 'Category列表',
					width : '100%',
					listeners : {
						click : addPanel
					}

				}),

				new Ext.Button({
					id : 'test',
					text : 'Test',
					width : '100%',
					listeners : {
						click : addPanel
					}

				})

				]
		});

		var item2 = new Ext.Panel( {
			title : 'Accordion Item 2',
			html : '<empty panel>',
			cls : 'empty'
		});

		var item3 = new Ext.Panel( {
			title : 'Accordion Item 3',
			html : '<empty panel>',
			cls : 'empty'
		});

		var item4 = new Ext.Panel( {
			title : 'Accordion Item 4',
			html : '<empty panel>',
			cls : 'empty'
		});

		var item5 = new Ext.Panel( {
			title : 'Accordion Item 5',
			html : '<empty panel>',
			cls : 'empty'
		});

		var accordion = new Ext.Panel( {
			region : 'west',
			margins : '5 0 5 5',
			split : true,
			width : 210,
			layout : 'accordion',
			items : [ item1, item2, item3, item4, item5 ]
		});

		var tabPanel = new Ext.TabPanel( {
			region : 'center',
			enableTabScroll : true,
			deferredRender : false,
			activeTab : 0,
			items : [ {

				title : 'index',

				//html : 'aaaaaa'
				autoLoad : 'Category-add.jsp'
			} ]
		});

		var viewport = new Ext.Viewport( {
			layout : 'border',
			items : [ accordion, tabPanel ]
		});

	});

这是配置文件

<package name="front" namespace="/" extends="struts-default">
		<!-- <default-action-ref name="Category-list"></default-action-ref> -->
    	<action name="Category-list" class="com.lch.bbs2009.action.CategoryAction">
    		<result>/admin/Category-list.jsp</result>
    	</action>
    </package>
    
	<package name="admin" namespace="/admin" extends="struts-default">
		
		<action name="index">
			<result>/admin/index.html</result>
		</action>
		
        <action name="*-*" class="com.lch.bbs2009.action.{1}Action" method="{2}">
            <result name="success">/admin/{1}-{2}.jsp</result>
            <result name="input">/admin/{1}-{2}.jsp</result>
        </action>

    </package>

这是文件目录

解决方案:

在html : '<iframe width=100% height=100% src=' + btn.id + '/>',中加入namespace变为

  html : '<iframe width=100% height=100% src="admin/' + btn.id + '.action" />',这样,火狐,ie,谷歌,都可以成功跳转了。

感谢今天白天一直帮我的那些人,刚刚突然想到可能是使用了ext的原因导致在火狐谷歌上进不了action,然后百度,终于让我找到了答案,这是找到答案的地址http://www.debugease.com/j2ee/169211.html,十分感谢!

  

原文地址:https://www.cnblogs.com/ligui989/p/3218910.html