Have you initialized an SqlMapClient in your code?
Driller, Jonathan (MSCIBARRA) wrote:
Hi, I am completely new to Ibatis, beans and the whole rationale
behind this and am struggling a bit.
I can connect to my bean but get nothing from Ibatis....no db info
gets returned.
Any clues as to what, likely very simple, thing I am doing incorrectly?
I have been reading the docs but can find no simple idiots guide...
My Map file piece:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="mbData">
<resultMap id=”test” class=”com.mb.pubweb.infoCenter”>
<result property=”title” column=”title”/>
</resultMap>
<select id=”setTitle” resultMap=”test”>
select title from infoCenter
</select>
</sqlMap>
My bean:
package com.mb.pubweb;
public class InfoCenter{
private String title = "initial title";
public String getTitle(){
return(title);
}
public void setTitle(String title){
this.title = title;
}
My JSP:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes/header/taglibsInc.jsp" %>
<html>
<%@ include file="/common/includes/header/headInc.jsp" %>
<body>
<jsp:useBean id="InfoCenter" class="com.mb.pubweb.InfoCenter" />
<%--jsp:setProperty name="InfoCenter" property="title" value='any ol
thang'/--%><br>
<jsp:getProperty name="InfoCenter" property="title" /> //resolves to
property that was set<br />
<c:out value="${InfoCenter.title}"/>//JSTL resolves to property that
was set<br />
<%= InfoCenter.getTitle() %>//SCRIPTLET resolves to property that was
set<br />
${InfoCenter.title}//JSTL resolves to property that was set<br />
</body>
</html>
I also have an xml config file for the database connection info, and
all are put into my
\build\webapp\WEB-INF\ibatis\infocenter directory and ANT has all the
stuff needed (Jar files) to build.
Any guidance *greatly* appreciated.
JD
------------------------------------------------------------------------
NOTICE: If received in error, please destroy and notify sender. Sender
does not waive confidentiality or privilege, and use is prohibited.
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.2.4/283 - Release Date: 3/16/2006