我的 Liferay 有问题。我正在执行以下操作:
function deleting() {
<portlet:actionURL var="deletePolyURL">
<portlet:param name="jspPage" value="/deletePoly.jsp" />
</portlet:actionURL>
<portlet:renderURL var="listingURL">
<portlet:param name="jspPage" value="/listing.jsp" />
</portlet:renderURL>
$.post(
"<%=deletePolyURL%>",
{
ids:ch.toString()
},
function(per) {
$("#WRAPlist").load("<%=listingURL%>");
}
);
}
已<div>
重新加载,但在此<div>
整个 Liferay 页面被加载,而不仅仅是我的页面,请参见图像的右侧。
我做错了什么?
deletePoly.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
{
//String st = request.getParameter("ids");
String st = ParamUtil.getString(request,"ids");
out.println("NE TORT");
String[] id_str;
id_str=st.split(",");
Class.forName("org.postgresql.Driver");
Connection connect= null;
connect = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgis","postgres","123456");
Statement state = null;
state = connect.createStatement();
int id;
String sql1="";
String sql2="";
for(int i=0;i<id_str.length;i++)
{
id=Integer.parseInt(id_str[i]);
sql1="DELETE FROM filestatus WHERE id=?";
PreparedStatement stmt1 = connect.prepareStatement(sql1);
stmt1.setInt(1, id);
stmt1.execute();
sql2="DELETE FROM filedata WHERE id=?";
PreparedStatement stmt2 = connect.prepareStatement(sql2);
stmt2.setInt(1, id);
stmt2.execute();
}
state.close();
connect.close();
Integer per=1;
out.println(per);
}
%>
列表.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
Class.forName("org.postgresql.Driver");
Connection conn= null;
conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgis","postgres","123456");
Statement sta = null;
sta = conn.createStatement();
String fileName= "";
Integer fileId=null;
String fileStatus ="";
ResultSet r=sta.executeQuery("SELECT id, name, status FROM filestatus");
String acc="Принят ";
while(r.next())
{
fileId=r.getInt("id");
fileName=r.getString("name");
fileStatus=r.getString("status");
if(fileStatus.equalsIgnoreCase(acc))
{
out.write("<input type='checkbox' class='myclass' id='check"+fileId+"' name='"+fileName+"' value='"+fileId+"'/><label for=check"+fileId+">"+fileName+"</label><br>");
}
else
{
out.write("<input type='checkbox' class='myclass' id='check"+fileId+"' name='"+fileName+"' value='"+fileId+"'/><label for=check"+fileId+" style='color:blue'>"+fileName+"</label><br>");
}
}
r.close();
sta.close();
conn.close();
%>
</body>
</html>
我刷新问题。