Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 73665 invoked from network); 7 Feb 2008 11:13:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Feb 2008 11:13:40 -0000 Received: (qmail 80113 invoked by uid 500); 7 Feb 2008 11:13:30 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 79996 invoked by uid 500); 7 Feb 2008 11:13:29 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 79977 invoked by uid 99); 7 Feb 2008 11:13:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Feb 2008 03:13:29 -0800 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of zimowski74@gmail.com designates 72.14.246.251 as permitted sender) Received: from [72.14.246.251] (HELO ag-out-0708.google.com) (72.14.246.251) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Feb 2008 11:12:59 +0000 Received: by ag-out-0708.google.com with SMTP id 35so7917392aga.11 for ; Thu, 07 Feb 2008 03:13:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=4ZZJe4ByJqz5aBbcsE5YiHTtOwBnJiY2hozv5WZ2eS0=; b=K+uiRG+O3cUEG1KP5kbL7FuCtiOOMUPgnockcrrXUrHHCB/YHphR8TMWwfnRcazFyQoX6VBrswiJHBPHdJc4i2wcw5JQExqq2bfan+XfE5YO03IXxPlxNQy9cZ89kiWs98DjX/8njpc09tUsCjWgMMOZ4AGcEzc6sPxnUXybrQ4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=I2G9BXPlHJIfWEgzU9ziIYm/E8z+qPsaQND0C+waf7AYVkmemftznKrWIfW8h9fOTANouXYCvBhm/NLHoRSbWRLS7sIDHQZKdjZqIwoCabgnd8OXVT+B/ZNLn1Eh64HGW0jq7uulqQ7dGPQriJnFihJfvyEXo8fu14vpCqTU7wY= Received: by 10.114.173.15 with SMTP id v15mr5892148wae.63.1202382783892; Thu, 07 Feb 2008 03:13:03 -0800 (PST) Received: by 10.114.110.16 with HTTP; Thu, 7 Feb 2008 03:13:03 -0800 (PST) Message-ID: <7c6c1dd90802070313s1dce9eceg9ea68d9346bd366b@mail.gmail.com> Date: Thu, 7 Feb 2008 05:13:03 -0600 From: "Adam Zimowski" To: user-java@ibatis.apache.org Subject: Re: iBATIS give me an ERROR In-Reply-To: <15330504.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <15330504.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org First, build your resources only once, not every time you handle request. You can do this with a factory class that gets called on servlet initialization. As to your problem, you are loading a different file than you have. Make sure your sqlMap.xml is in the same location where java class which loads it, and change it from "SqlMapConfig.xml" to "sqlMap.xml" PS. Are you familiar with DAO pattern? Use it. http://java.sun.com/blueprints/patterns/DAO.html -adam On Feb 7, 2008 3:56 AM, satya_08 wrote: > > I am trying to develop a small web application , > > Here is the structure of my app-------------> > C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\TestStripes > There is a jsp file , > under C:\Program Files\Apache Software Foundation\Tomcat > 5.5\webapps\TestStripes directory . > > The content of the jsp is > ******************************************************************************* > <%@ page contentType="text/html;charset=UTF-8" language="java" %> > <%@ taglib prefix="stripes" > uri="http://stripes.sourceforge.net/stripes.tld"%> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > > > LOGIN PAGE > > > >

UserID and LOGIN

> > > > > > > > > > > > > > > > > > > > > >
User ID:
Password:
> >
Result:${actionBean.result}
>
> > > > ******************************************************************************* > Under WEB-INF , there are two sub directory > 1)lib > 2)classes > Under lib I have included all the necessary jars , such as > :commons-logging.jar,cos.jar,ibatis-3.0.677.jar, > jstl.jar,log4j-1.2.9.jar,mysql-connector-java-5.0.4-bin.jar,standard.jar > & stripes.jar > > Under classes directory there is my UserPassActionBean.java file and > SqlMapConfig.xml and SqlMap.xml files > > The UserPassActionBean.java is -----------> > ******************************************************************************* > > package net.sourceforge.stripes.user_validation; > > import net.sourceforge.stripes.action.ActionBean; > import net.sourceforge.stripes.action.ActionBeanContext; > import net.sourceforge.stripes.action.DefaultHandler; > import net.sourceforge.stripes.action.Resolution; > import net.sourceforge.stripes.action.StreamingResolution; > // import net.sourceforge.stripes.validation.Validatable; > import net.sourceforge.stripes.validation.ValidationError; > import net.sourceforge.stripes.validation.ValidationErrorHandler; > import net.sourceforge.stripes.validation.ValidationErrors; > import net.sourceforge.stripes.action.ForwardResolution; > > > import com.ibatis.sqlmap.client.*; > import com.ibatis.common.resources.Resources; > import com.ibatis.common.logging.*; > > > import java.io.StringReader; > import java.util.List; > import java.io.*; > import java.util.*; > > public class UserPassActionBean implements ActionBean, > ValidationErrorHandler > { > private ActionBeanContext context; > /* @Validate(required=true) */private String user_id; > /* @Validate(required=true) */private String password; > private String result; > > public ActionBeanContext getContext() { return context; } > public void setContext(ActionBeanContext context) { > this.context = context; } > > public Resolution handleValidationErrors(ValidationErrors > errors) throws Exception > { > StringBuilder message = new StringBuilder(); > for (List fieldErrors : > errors.values()) > { > for (ValidationError error : fieldErrors) > { > message.append("
firebrick;\">"); > > message.append(error.getMessage(getContext().getLocale())); > message.append("
"); > } > } > return new StreamingResolution("text/html", new > StringReader(message.toString())); > } > /** Handles the 'submit' event, check the validation and > returns the result. */ > /* @DefaultHandler public Resolution submit() > { > String result = String.valueOf(user_id + password); > return new StreamingResolution("text", new > StringReader(result)); > } */ > > // Standard getter and setter methods > public String getUser_id() { return user_id; } > public void setUser_id(String user_id) { this.user_id = > user_id; } > > public String getPassword() { return password; } > public void setPassword(String password) { this.password = > password; } > public String getResult() { return result; } > public void setResult(String result) { this.result = result; } > > /** An event handler method that adds number one to number > two. */ > @DefaultHandler > public Resolution submit() > { > > try > { > String resources = "SqlMapConfig.xml"; > Reader reader = > Resources.getResourceAsReader(resources); > SqlMapClient sqlMapper = > SqlMapClientBuilder.buildSqlMapClient(reader); > Map m = new HashMap(1); > m.put("a",user_id); > password = > (String)sqlMapper.queryForObject("out_example",m); > result = user_id + password; > } > catch(IOException ex) > { > // System.out.println(ex.getMessage()); > ex.printStackTrace(); > } > catch(Exception ex) > { > // System.out.println(ex.getMessage()); > ex.printStackTrace(); > } > return new ForwardResolution("/index.jsp"); > } > > > } > ******************************************************************************* > It gives an error of reading Reader reader = > Resources.getResourceAsReader(resources); > The content of the sqlMap.xml is > ******************************************************************************* > > PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" > "http://ibatis.apache.org/dtd/sql-map-2.dtd"> > > > > > > resultClass="String"> > {call usp_sel_ggl_users_passwd(?)} > > > > > ******************************************************************************* > & the content of the SqlMapConfig.xml is > ******************************************************************************* > > PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN" > "http://ibatis.apache.org/dtd/sql-map-config-2.dtd"> > > > > > > > > > > > > > value="jdbc:mysql://189.160.100.72/_db" /> > > > > > > > > > > > > > ******************************************************************************* > Please Help me ,,, > > Thanks > > Satya > > -- > View this message in context: http://www.nabble.com/iBATIS-give-me-an-ERROR-tp15330504p15330504.html > Sent from the iBATIS - User - Java mailing list archive at Nabble.com. > >