ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: STEVE on August 09, 2022, 09:15:18 pm
-
Dear Paramvir,
Tomcat only supports java. I can't use PHP because I can't configure the PDO to connect to PostgreSQL.
so I decided to transfer the PHP code to java code.
Although I don't know how to do that, I have to do change the PHP code to the java code.
Would you give me hints or related sample files like the attachments I uploaded?
i.e: how to send data and receive data between your grid and java code from the backend.
Best Regards,
Steve.
-
I am sure the sample files as below.
Please check it out.
Thank you in advance.
-
It's assumed that you are familiar with and have set up J2EE environment.
Java code is available for batch editing here: https://paramquery.com/pro/demos/editing_batch
You can modify it as per your requirements and kindly share issues faced if any.
Please note that java code is not available for Tree batch editing yet ( for which you had asked for PHP code earlier ).
-
Dear paramvir,
The java code didn't work. Even I imported these components.
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.jdbc.core.JdbcTemplate;
Error messages are below.
The type org.springframework.dao.support.DaoSupport cannot be resolved. It is indirectly referenced from required .class files
And, I need to know how to set up the pom.xml, web.xml, and servlet-context.xml on this problem.
Thank you.
-
I changed it as below.
public class ProductsListController extends JdbcTemplate {
But Still, the problem exists.
List<Product> products = getJdbcTemplate().query(
I have to make a function to resolve this problem
private JdbcTemplate getJdbcTemplate() {
// TODO Auto-generated method stub
return null;
}
I had to learn java to implement pqGrid to the existing home page does not support PHP to show the excel data.
I want to keep my promise to them.
But I am afraid to disappoint them.
-
I am trying to modify your sample java code.
I couldn't make it work.
I am attaching the files and two screenshots.
Its pattern is the MVC pattern.
Please check my files.
if you could give me the executable files I will be happy enough.
Thank you.
-
Hello?
I changed some codes.
Please check the below files
My questions are so simple regarding these files.
I want to know how to set the value of the URL of Ajax from pqGrid.
It really is difficult to match each other.
from product.jsp
$.ajax({
dataType: "json",
type: "POST",
async: true,
beforeSend: function (jqXHR, settings) {
grid.showLoading();
},
url: "/aa/products/batch", //for ASP.NET, java
data: { list: JSON.stringify(changes) },
to productController.java
@RequestMapping(value="/Products/clear", method=RequestMethod.GET)
public @ResponseBody String clear(HttpServletRequest request ){
HttpSession ses = fillInSession(request);
//ses.setAttribute("Products", "");
@SuppressWarnings("unchecked")
List<Products> Products = (List<Products>)ses.getAttribute("Products");
Products.clear();
return "";
}
@RequestMapping(value="/Products/batch", method=RequestMethod.POST)
public @ResponseBody String batch(@RequestParam String list, HttpServletRequest request ){
HttpSession ses = fillInSession(request);
Map<String, List<Products>> dlist = deserializeMap(list);
ArrayList<Products> updateList = (ArrayList<Products>)dlist.get("updateList");
ArrayList<Products> addList = (ArrayList<Products>)dlist.get("addList");
ArrayList<Products> deleteList = (ArrayList<Products>)dlist.get("deleteList");
this.updateList(updateList, ses);
this.addList(addList, ses);
this.deleteList(deleteList, ses);
return serializeMap(dlist);
}
@RequestMapping(value="/Products/get",method=RequestMethod.GET)
public @ResponseBody String Products(ModelMap model, HttpServletRequest request ){
HttpSession ses = fillInSession(request);
@SuppressWarnings("unchecked")
List<Products> products = (List<Products>)ses.getAttribute("Products");
String serializedProducts = serialize(products);
String responseStr = "{\"data\":" + serializedProducts + "}";
return responseStr;
}
-
url to get the products would be "/Products/get"
and url to post the changes would be "/Products/batch"
If records are not displayed in grid, I suggest you use debugging and set some breakpoints in your java code to find the issue.
-
I have trouble with a JSP file.
The CSS and JS files were not included
<link rel="stylesheet" href="../css/jquery-ui.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/query-ui.min.js"></script>
I put the json_exam.jsp file in the views folder beside the grid folder.
It works fine.
http://localhost:9080/aa/json_exam.jsp
-->
//localhost:9080/grid/ajax/jquery-ui.min.js
It is from the tomcat initiated with the eclipse tool.
It doesn't work due to an incorrect URL
http://localhost:8081/pgConn/json
--> it call json_exam.jsp file
--> this file refers to the js file below
http://localhost:8081/pgConn/js/jquery.min.js
--> 404 Error
Would you tell me how set the correct URL with some configuration in eclipse?
Please help me~
Many thanks for considering my request.
-
Hello?
I put the sample code of the product example in the webapp folder which is working on the tomcat.
I got an error message like this when I click the new button on the product sample code.
jquery.min.js:5
GET http://localhost:8081/product/get?pq_datatype=JSON&_=1661285986779 404
I want to know the reason why "pgConn" is disappeared.
http://localhost:8081/pgConn/product
And Why it doesn't work?
-
I forgot something important.
I got the error message from the eclipse console.
it was that "pgConn/product/gets" can not be resolved ..."
You gave me some advice to use the URL, "/product/gets"
I want to know the mechanism of the using URL between the Controller and JSP.
Thank you in advance.
-
Please help me~~~
-
grid is not able to display any records, dataModel.url option should be set to "/Products/get" because of this requestMapping
@RequestMapping(value="/Products/get",method=RequestMethod.GET)