• <i id='r6qbU'><tr id='r6qbU'><dt id='r6qbU'><q id='r6qbU'><span id='r6qbU'><b id='r6qbU'><form id='r6qbU'><ins id='r6qbU'></ins><ul id='r6qbU'></ul><sub id='r6qbU'></sub></form><legend id='r6qbU'></legend><bdo id='r6qbU'><pre id='r6qbU'><center id='r6qbU'></center></pre></bdo></b><th id='r6qbU'></th></span></q></dt></tr></i><div id='r6qbU'><tfoot id='r6qbU'></tfoot><dl id='r6qbU'><fieldset id='r6qbU'></fieldset></dl></div>
      <bdo id='r6qbU'></bdo><ul id='r6qbU'></ul>
    <tfoot id='r6qbU'></tfoot>
      <legend id='r6qbU'><style id='r6qbU'><dir id='r6qbU'><q id='r6qbU'></q></dir></style></legend>

      <small id='r6qbU'></small><noframes id='r6qbU'>

      1. 无法弄清楚如何 &lt;s:select&gt;

        Can#39;t figure it out how to lt;s:selectgt;(无法弄清楚如何 lt;s:selectgt;)

          <tbody id='7NrPs'></tbody>

        <small id='7NrPs'></small><noframes id='7NrPs'>

      2. <tfoot id='7NrPs'></tfoot>

          <i id='7NrPs'><tr id='7NrPs'><dt id='7NrPs'><q id='7NrPs'><span id='7NrPs'><b id='7NrPs'><form id='7NrPs'><ins id='7NrPs'></ins><ul id='7NrPs'></ul><sub id='7NrPs'></sub></form><legend id='7NrPs'></legend><bdo id='7NrPs'><pre id='7NrPs'><center id='7NrPs'></center></pre></bdo></b><th id='7NrPs'></th></span></q></dt></tr></i><div id='7NrPs'><tfoot id='7NrPs'></tfoot><dl id='7NrPs'><fieldset id='7NrPs'></fieldset></dl></div>
                • <bdo id='7NrPs'></bdo><ul id='7NrPs'></ul>
                  <legend id='7NrPs'><style id='7NrPs'><dir id='7NrPs'><q id='7NrPs'></q></dir></style></legend>
                • 本文介绍了无法弄清楚如何 &lt;s:select&gt;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  试图在 select 中获取公司列表,但它给了我一个错误.

                  Trying to get list of companies in select but it gives me an error.

                  type Exception report
                  
                  message tag 'select', field 'list', name 'workOrder.company': The requested list key          
                  'listAllCompanys' could not be resolved as a collection/array/map/enumeration/iterator
                     type.   Example: people or people.{name} - [unknown location]
                  
                  description
                     The server encountered an internal error that prevented it from fulfilling this request.
                  

                  例外:

                  org.apache.jasper.JasperException: tag 'select', field 'list', name 'workOrder.company': The requested list key 'listAllCompanys' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
                  org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:585)
                  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
                  

                  我的 workOrder.jsp 文件包含:

                  <s:select list="listAllCompanys"  listValue="companyName" name="workOrder.company"></s:select>
                  

                  当我有新的工作订单要添加时, select 中应该有一个可用的公司列表.

                  When I have a new work order to add, there should be a list of companies available in select .

                  更新:

                  这是我的 listAllCompanies() 方法

                  public List<Company> getCompanyList() {
                      return companyList;
                  }
                  
                  //////////////////////////////////////////
                  /////////////////////////////////////////
                  
                  public List<Company> getListAllCompanys() {
                      return listAllCompanys;
                  }
                  
                  private List<Company> listAllCompanys;
                  
                  public String listAllCompanys() throws Exception
                  {
                      CompanyDaoHibernate dao = new CompanyDaoHibernate();
                      listAllCompanys = dao.getListOfCompanys();
                  
                      return SUCCESS;
                  
                  }
                  

                  CompanyDAOHibernate:

                  public List<Company> getListOfCompanys()
                  {
                  
                      SessionFactory sf = HibernateUtil.getSessionFactory();
                      Session session =  sf.openSession();
                  
                       @SuppressWarnings("unchecked")
                      List<Company>  returnList =  (List<Company>)session.createCriteria(Company.class).list();
                      session.close();
                      System.out.println("Printing companies... "+returnList);
                      return returnList;
                  
                  }
                  

                  推荐答案

                  JSP 包含操作返回的选择标记.添加订单时,它应该有一个绑定到 bean 属性的 list 属性.它应该是值堆栈中的 top 对象.

                  The JSP contains a select tag returned by the action. When you add an order it should have a list attribute bound to the bean property. It should be a top object in the value stack.

                  在大多数情况下,在操作类中初始化该属性以更好地实现 准备接口你必须在其中编写prepare()方法并初始化列表.

                  In most cases initializing that property in the action class better to implement the preparable interface where you have to write prepare() method and initialize the list.

                  抛出异常是因为 s:select 标签的 list 属性不能为 null.在返回引用该变量的结果之前,您应该正确初始化用于标记的变量.

                  The exception is thrown because the list attribute of the s:select tag couldn't be null. You should properly initialize the variable used for the tag before returning a result that has references to that variable.

                  这篇关于无法弄清楚如何 &lt;s:select&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Java Bytecode Manipulation Library Suggestions(Java 字节码操作库建议)
                  Java CLI UI-design: frameworks or libraries?(Java CLI UI 设计:框架还是库?)
                  About the use of Beans.xml configuration file in Spring Framework application(关于Spring Framework应用中Beans.xml配置文件的使用)
                  What is the difference between Spring, Struts, Hibernate, JavaServer Faces, Tapestry?(Spring、Struts、Hibernate、JavaServer Faces、Tapestry 有什么区别?)
                  Are there any android application framework like spring?(有没有像spring这样的android应用程序框架?)
                  Java Swing based game framework. Any advice?(基于 Java Swing 的游戏框架.有什么建议吗?)
                  • <bdo id='7OByR'></bdo><ul id='7OByR'></ul>
                      <tbody id='7OByR'></tbody>
                  • <legend id='7OByR'><style id='7OByR'><dir id='7OByR'><q id='7OByR'></q></dir></style></legend>

                    <small id='7OByR'></small><noframes id='7OByR'>

                    <i id='7OByR'><tr id='7OByR'><dt id='7OByR'><q id='7OByR'><span id='7OByR'><b id='7OByR'><form id='7OByR'><ins id='7OByR'></ins><ul id='7OByR'></ul><sub id='7OByR'></sub></form><legend id='7OByR'></legend><bdo id='7OByR'><pre id='7OByR'><center id='7OByR'></center></pre></bdo></b><th id='7OByR'></th></span></q></dt></tr></i><div id='7OByR'><tfoot id='7OByR'></tfoot><dl id='7OByR'><fieldset id='7OByR'></fieldset></dl></div>
                      • <tfoot id='7OByR'></tfoot>