struts2 - struts 2 jqGrid not getting displayed -


i have read followed example showed in showcase of jqgrid struts2. grid not getting displayed. please me out. below code snippets. when type action name in url, displays me json. when type jsp path in url, not display me jqgrid. when view source of page, creates code jqgrid.

jsp file

<%@ 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> <%@ taglib prefix="s" uri="/struts-tags"%>  <%@taglib  prefix="sj" uri="/struts-jquery-tags" %> <%@taglib  prefix="sjg" uri="/struts-jquery-grid-tags" %> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title>  <sj:head jqueryui="true" jquerytheme="redmond"></sj:head> </head> <body>  <s:url id="remoteurl" action="/sreebhogstore/incomingrawmaterial1" />   <sjg:grid id="gridtable" caption="roles" datatype="json" href="%{remoteurl}" pager="true" gridmodel="gridmodel"  rowlist="10,15,20" rownum="5" rownumbers="true"  width="800" navigator="true" navigatorview="false" navigatordelete="false"   navigatoradd="false" navigatoredit="false" navigatorsearch="false"> <sjg:gridcolumn name="lotno" index="lotno" title="role name"  sortable="true" formatter="editrole" />  </sjg:grid>  </body> </html> 

struts 2 config

<package name="incomingrawmaterialmanagement" extends="struts-default, json-default"     namespace="/sreebhogstore"> <interceptors> <interceptor name="login" class="com.sreebhog.interceptors.logininterceptor" /> <interceptor-stack name="loginstack"> <interceptor-ref name="login" ></interceptor-ref> <interceptor-ref name="defaultstack" ></interceptor-ref> </interceptor-stack> </interceptors> <default-interceptor-ref name="loginstack"></default-interceptor-ref>  <action name="incomingrawmaterial1" class="com.sreebhog.actions.incomingrawmaterialaction">  <result name="success" type="json"></result>  </action>  </package> 

and here action class

public class incomingrawmaterialaction extends actionsupport implements loginrequired,sessionaware,errorsuccessmessages     ,servletrequestaware{  private static final long serialversionuid = 1l; private map<string, object> sessionmap; httpservletrequest request;  //for incoming raw material initialization private list<products> rawmaterials; private list<party> parties;  //for jqgrid private list<incomingrawmaterial> gridmodel; private integer rows = 0; //number of rows private integer page = 0; //get requested page. default grid sets 1. private string sort;  // sorting order - asc or desc private string sidx;  // index row - i.e. user click sort. private string searchstring;    // search string private string searchoper;  // search operation ['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc'] private integer total = 0;  // total pages private integer records = 0;    // record  public string execute() {  rows=5;  gridmodel = new arraylist<incomingrawmaterial>();  gridmodel.add(new incomingrawmaterial());  gridmodel.add(new incomingrawmaterial());  system.out.println("here--------------------------------------------------"); //calculate total pages query total =2;//(int) math.ceil((double)records / (double)rows);  return success; }  public string getjson() { system.out.println("json------------------------------------------------------"); return execute(); }  //getters , setters , override methods  //jqgrid getters , settters  } 

please note console messages not getting displayed. suspect jqgrid not calling action.

here list of jars included antlr-2.7.7.jar classmate-0.5.4.jar commons-collections-3.2.1.jar commons-fileupload-1.2.1.jar commons-io-1.3.2.jar commons-logging-1.0.4.jar dom4j-1.6.1.jar freemarker-2.3.15.jar hibernate-commons-annotations-4.0.1.final.jar hibernate-core-4.0.0.final.jar hibernate-jpa-2.0-api-1.0.1.final.jar javassist-3.12.1.ga.jar jandex-1.0.3.final.jar jboss-logging-3.1.0.cr2.jar jboss-transaction-api_1.1_spec-1.0.0.final.jar log4j-1.2.14.jar mysql-connector-java-5.1.3-rc-bin.jar ognl-2.7.3.jar servlet-api.jar struts2-convention-plugin-2.1.8.1.jar xwork-core-2.1.6.jar

**here important ones guess.**  struts2-core-2.1.8.1.jar struts2-jquery-grid-plugin-3.5.1.jar struts2-jquery-plugin-3.5.1.jar struts2-json-plugin-2.1.8.1.jar 

edit 1: able view grid still not loading json data. problem formatter attribute in 1 of sjg:column tag.

solved: solved problem myself. problem s:url tag. had no namespace defined. accessing link through .../jsp/index.jsp. looking action in /jsp itself. sorry trouble if any. hope discovery can in future.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -