package com.yc.service;import java.util.List;import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.simple.SimpleJdbcCall;
import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
public class BaseService{
/**
 * 提供简单操作JDBC的类
 * 
 * */
@Autowired
protected SimpleJdbcTemplate simpleJdbcTemplate;
/**
 * 提供简单操作JDBC的类
 * 
 * */
@Autowired
protected JdbcTemplate jdbcTemplate;

我如何在JSP页面使用jdbcTemplate这个类?

解决方案 »

  1.   

    貌似是usebean,貌似可以传到jsp页面上
      

  2.   

    这个是在Spring的主配置中注入的,在后台用时,要注入到相应的service方法中,同时要写set get方法就可以用。但是LZ为什么要在JSP中用呢?
      

  3.   

    同问,为什么要在jsp页面上使用,你要知道,这个是后台与数据库连接用的。你把它放页面上,也就是说你跳过了业务处理,或者说跳过service层.你想干嘛?