• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 216
  • Last Modified:

Help me!

I have a class ListBean. Include getMusic() method: get a field in DB:
public Vector getMusic() throws ModuleException
{
        Vector albums = new Vector();
        Connection con = null;
        Statement stmt = null;
        ResultSet rs = null;
        String sQuery = "";
       try
      {
      con = dataSource.getConnection();  
              //Thuc hien truy van du lieu
              stmt = con.createStatement();
      sQuery = "SELECT a FROM HE";
      rs = stmt.executeQuery(sQuery);
      while (rs.next())
      {
            TourDTO tD=new TourDTO();                        
            tD.setMaKH(rs.getString("a"));
            albums.add(tD);
      }
      }
      catch (SQLException se)
    {
        log.error("Error in retreiving albums.");
        log.error("SQL statement = " + sQuery);
        se.printStackTrace();
        ModuleException me = new ModuleException("error.db.sql");
       throw me;
  }
I want fill data into combox box over getMusic() method. Following code here:
/*******ListAction********/
ListBean lB=new ListBean(getDataSource(request, "HE"));
               Vector someBean= lB.getMusic();
               request.setAttribute("someBean", someBean);
      return mapping.findForward("list");
/*******Code into JSP page*****/
<logic:present name="someBean">
      <html:select property="someBean">
            <html:options collection="someBean" property="value" labelProperty="label"/>
      </html:select>
</logic:present>
When enter URL: "http://localhost:8080/Loginc/list.do" appear a error: "No getter method available for property value for bean under name someBean"
Althought I am declaring someBean property in ListForm class. I don't know why have this error. Everybody help me, please!Thanks very much.

0
khoa235
Asked:
khoa235
1 Solution
 
boonlengCommented:
Use the attribute "name" if you want to refer the bean in store request/session.
      <html:select property="someBean1">
           <logic:present name="someBean">
                <html:options name="someBean"/>
            </logic:present>
      </html:select>

Use attribute "property" if the collection declare in the formbean - ListForm
      <html:select property="someBean1">
            <html:options property="someBean"/>
      </html:select>
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now