0
Im得到以下錯誤: String類型的方法valueOf(Object)不適用於參數(void)<%= loadProductListView( 「男人」, 「襯衫」)%>String類型的方法valueOf(Object)不適用於參數
在javascript中調用林方法loadProductListView:
<script>
$(document).ready(function() {
$("#idMenShirts").click(function() {
$("#idListView").html('');
<%=loadProductListView("men","shirt") %>
});
</script>
在這裏,我已經宣佈loadProductListView
<%!
public static void loadProductListView(String cat,String
type)
{
%>
<sql:setDataSource var = "snapshot" driver =
"oracle.jdbc.driver.OracleDriver"
url = "jdbc:oracle:thin:@localhost:1521:XE"
user = "system" password = "1234" />
System.out.println("connected for products");
<c:set var = "cat" value = "$(cat)"/>
<c:set var = "type" value = "$(type)"/>
<sql:query dataSource = "${snapshot}" var = "result">
SELECT product_name,product_desc,image_desc FROM
products WHERE product_category= ? and product_type=
?;
<sql:param value="${cat}" />
<sql:param value="${type}" />
</sql:query>
<script>
<c:forEach var = "row" items = "${result.rows}">
var img= <c:out value = "${row.image_desc}"/> +".jpg";
var name=<c:out value = "${row.product_name}"/>;
var desc=<c:out value = "${row.product_desc}"/>;
var pro_desc=<c:out value = "${row.image_desc}"/>+".jsp";
$("#one ul").append('<li class="ui-li-has-thumb"><a href="'+pro_desc+'" class="ui-btn ui-btn-icon-right ui-icon-carat-r">' +
'<img src="img/' + img + '" style="height: 80px;width: 80px;"/>' +
'<h2>' + name + '</h2>' +
'<p>' + desc + '</p>' +
'</a>' +
'</li >');
$('#one ul').listview('refresh');