This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes html:select Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:select" Watch "html:select" New topic
Author

html:select

khizar dheen
Greenhorn

Joined: May 30, 2007
Posts: 13
This is error i am facing for 2 days
Kindly suggest me wat to do

javax.servlet.ServletException: No getter method available for property table for bean under name TableBean
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.jsp.table_jsp._jspService(table_jsp.java:81)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)

Action Class:
package com.yourcompany.struts.Action;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;


public class tableDisplayAction extends Action{
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws SQLException {

javax.sql.DataSource ds=getDataSource(request);
Connection con=ds.getConnection();
Statement stmt=null;
ResultSet rs=null;
ArrayList list=new ArrayList();
try {

stmt=con.createStatement();

String Query="select * from tab";

rs = stmt.executeQuery(Query);
if (rs!= null)
{
while(rs.next())
{
list.add(rs.getString("TNAME"));

}
request.setAttribute("TableBean",list);
System.out.println("TableDisplayValue----"+list);

}
}
catch(SQLException e)
{

e.printStackTrace();
}

con.close();

return mapping.findForward("Table");
}
}

Form Bean:
package com.yourcompany.struts.ActionForm;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public class TableForm extends ActionForm {

private String table;

public String getTable() {
return table;
}

public void setTable(String table) {
this.table = table;
}
public void reset(ActionMapping mapping,HttpServletRequest request,HttpServlet response){
table="";
}

}

Jsp Page:<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean"
prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html"
prefix="html"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html:html>
<html:form action="table" method="post">
<html:select property="table">
<html ptions collection="TableBean"
property="table" labelProperty="table"/>
</html:select>
</html:form>
</html:html>

Advance Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Change

to

For more information on the htmlptions tag see the heading options in this link.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html:select
 
Similar Threads
struts help needed for error No getter method
Please help me ..
html:select html:options error, no getter. please help
Please help me ..
No getter method for property