Question

None of ajax tags are working in my code. I simply wants to use tabbedpanel,but it is not showing. My code is :

tabbedpanel.jsp :

    <%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="/struts-dojo-tags" prefix="sx" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<sx:head debug="true" cache="false" compressed="false" />

<title>Insert title here</title>
</head>
<body>
<s:form>
<sx:tabbedpanel id="tabContainer">
   <sx:div id="one" label="Tab 1" theme="ajax">
  first tab<br><br>
  </sx:div>

  <sx:div id="two" label="Tab 2" theme="ajax">
   second Tab<br><br>
  </sx:div>
      </sx:tabbedpanel>
      <s:submit value="submit" ></s:submit>
      </s:form>
</body>
</html>

and tabs.java:

    package com.heman;

import com.opensymphony.xwork2.ActionSupport;

public class tabs extends ActionSupport {

    @Override
    public String execute() throws Exception {
        // TODO Auto-generated method stub
    return SUCCESS;
    }
}

and struts.xml :

<?xml version="1.0" encoding="UTF-8"?>

<struts>
<package name="tabb" extends="struts-default">
<action name="tab" class="com.heman.tabs">
<result name="success">tabbedpanel.jsp</result>
</action>
</package>
</struts>

It is not showing up in tabbed panels but it simple shows on same place.

Was it helpful?

Solution

Dojo tags are deprecated, use jQuery tags

<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
<head>
  <link href="<s:url value="/css/template_styles.css"/>" type="text/css" rel="stylesheet">
  <sj:head jqueryui="true" />
  <title></title>
</head>
<sj:tabbedpanel id="localtabs" cssClass="list">
    <sj:tab id="tab1" target="jsp" label="JSP Code"/>
    <sj:tab id="tab2" target="javascript" label="JavaScript"/>
  <sj:tab id="tab3" target="java" label="Java"/>
    <div id="jsp">JSP</div>
    <div id="javascript">JavaScript</div>
    <div id="java">Java</div>
</sj:tabbedpanel>

Look up a plugin registry to download jQuery plugin.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top