You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by "Driller, Jonathan (MSCIBARRA)" <Jo...@mscibarra.com> on 2006/03/17 00:01:43 UTC
setup help requested
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.
Re: setup help requested
Posted by Larry Meadors <lm...@apache.org>.
If you have never used Java before, don't expect miracles - if this is
your first Java project, I think you will be suprised at how much
"plumbing" code and configuration you are doing just to get "hello
world" from a database to a web page.
I would strongly suggest that you look at some of the tutorials on
Rick Reumann's http://www.learntechnology.net/ site - those are
pretty good starting points.
Larry
On 3/16/06, Driller, Jonathan (MSCIBARRA)
<Jo...@mscibarra.com> 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.
>
RE: setup help requested
Posted by Meindert <me...@pastelebusiness.com>.
Are you using recent example code to learn it?
You are pointing to the wrong URL for the DTD;
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-2.dtd">
MEINDERT
-----Original Message-----
From: Beemsterboer Software [mailto:hans@beemsterboer-software.nl]
Sent: 17 March 2006 01:12 AM
To: user-java@ibatis.apache.org
Subject: Re: setup help requested
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
>
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.2.4/283 - Release Date: 16/03/2006
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.2.4/283 - Release Date: 16/03/2006
Re: setup help requested
Posted by Beemsterboer Software <ha...@beemsterboer-software.nl>.
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
>