80

CommandLineRunner 里得到的数据页面接收不到

方法没问题,但获取到的值传不过去

 @Component
public class JobCLR implements CommandLineRunner  {
     protected final Logger logger = LoggerFactory.getLogger(JobCLR.class);
  @Autowired
        private JobService js;
      @Override
        public void run(String... args) throws Exception {
           System.out.println(">>>>>>>>>>>>>>>服务启动执行,执行加载数据等操作<<<<<<<<<<<<<");
          /* List<String> jobsListindex=js.queryHotJob(1);*/
        List<Jobs>  jobsList= js.selectByHeat1();
           ModelAndView mav =new ModelAndView("/");   
           mav.addObject("jobsList",jobsList);

           for(Jobs l :jobsList) {
           System.out.println(l);

           }
        } 

}

页面

 <a class="zxzw_fen clearfix"
                        th:classappend="${ jobsListindex.index } % 2 == 0  ? '' : 'mr_0'"
                        href="" th:each="jobsList,jobsListindex:${jobsList}">
         <div class="zxzw_fen_01 clearfix">

    <b th:utext="|<i>|+${jobsList.jobPosition}+|</i>&nbsp;[|+${jobsList.jobAddress}+|]&nbsp;&nbsp;${jobsList.jobReleaseTime}|"></b>
                 <span th:text="${jobsList.jobSalary}">24-36万</span>
         </div>
         <div class="zxzw_fen_02 clearfix">
                 <span  th:text="${jobsList.jobEmployAddress}"></span>
         <i  th:text="${jobsList.jobWelfare}">绩效奖金</i> <i>带薪年假</i>
                        </div>
                    </a>
查看全部
qq_37852473
qq_37852473
2018/09/27 06:37
  • spring
  • commandlinerunner
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

3个回复