• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSON Gridview is not working with struts2

 
Parth Pateld
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Sir,

I am trying to use <sjg> tag for displayiong table in grid view in strust2.

it is like, when the user do login it will come to welcome.jsp and on welcome.jsp i have put a link "PatientData" when the user click on it, he will get list of patients with name and code. but when I click on PatientData link i got following error in browser.

I am using struts2-core 2.3.4.jar, struts2-jquery-grid-pulgin3.5.1.jar and this lib are included in my project.




Temp1.java


CustomerData.java is GETTER SETTER method class, which will set person code and name.

Temp2.java


PatientData.jsp file content


Looking for your reply.
Untitled.png
[Thumbnail for Untitled.png]
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has nothing to do with Swing. Moving this to the Struts forum.
 
Parth Pateld
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ranganathan Kaliyur Mannar wrote:This has nothing to do with Swing. Moving this to the Struts forum.


Hello Sir, Can I get reply for my post ?
 
Yogesh Lonkar
Ranch Hand
Posts: 94
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Change your method name getServiceDetails , try not to use get*** in action method as many times it is found that they are called twice if result type is json.
2. Your are using result type json in wrong manner <result name="success" type="json">/jsp/PatientData.jsp</result> you can not treat it as a type dispatcher.refer this link Struts2-json-plugin-docs
 
Parth Pateld
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yogesh Lonkar wrote:1. Change your method name getServiceDetails , try not to use get*** in action method as many times it is found that they are called twice if result type is json.
2. Your are using result type json in wrong manner <result name="success" type="json">/jsp/PatientData.jsp</result> you can not treat it as a type dispatcher.refer this link Struts2-json-plugin-docs


Hello Sir,

Thanks for your reply.
I am new to struts2 and I want to know how to redirect JSON data in jsp file.
If class ABC and its action name is abc and result type is json then i will get json formated data in abc.action in browser, but hoe to use that data into jsp file.
 
Yogesh Lonkar
Ranch Hand
Posts: 94
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this situation create Getter and Setter for your bean gridBean and change result of action to
this way when patinetData action is called you will get json object in result. you can check Json object by directily calling /patinetData in browser for handling Json in Gridtag refere this GridTag Wiki
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic