aspose file tools*
The moose likes Struts and the fly likes problems with html:select   - need help - struts tag library Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problems with html:select   - need help - struts tag library" Watch "problems with html:select   - need help - struts tag library" New topic
Author

problems with html:select - need help - struts tag library

Avneet Singh
Ranch Hand

Joined: Apr 25, 2006
Posts: 51
Hi

I am just trying to get hang of struts and the tag libraries provided with it . New to this concept .

gettin some errors while using the html:select tag in my jsp page .
Request all u guys to help me out with it .
Below is my code and the eror i get on the jsp page.

---jsp page -----
<%@ page language="java" import="java.util.*"%>
<%
System.out.println("inside index.jsp");
%>
<%@ taglib uri="/tags/taglib/struts-html" prefix="html"%>
<%@ taglib uri="/tags/taglib/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/taglib/struts-logic" prefix="logic"%>
<html:html>
<head>
<title>Struts tutorial</title>
</head>
<body>
<table>
<tr>
<td>This page uses tag library </td>
</tr>
<tr>
<td>
<html:select property="id">
<html ption value="1">option 1</html ption>
<html ption value="2">option 2</html ption>
<html ption value="3">option 3</html ption>
</html:select>
</td>
</tr>
</table>
</body>
</html:html>

--message on screen is ----

org.apache.jasper.JasperException: Exception in JSP: /index.jsp:19

16: </tr>
17: <tr>
18: <td>
19: <html:select property="id">
20: <html ption value="1">option 1</html ption>
21: <html ption value="2">option 2</html ption>
22: <html ption value="3">option 3</html ption>

Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

javax.servlet.ServletException: Cannot find bean under name org.apache.struts.taglib.html.BEAN
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.index_jsp._jspService(index_jsp.java:82)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

javax.servlet.jsp.JspException: Cannot find bean under name org.apache.struts.taglib.html.BEAN
org.apache.struts.taglib.html.SelectTag.calculateMatchValues(SelectTag.java:240)
org.apache.struts.taglib.html.SelectTag.doStartTag(SelectTag.java:200)
org.apache.jsp.index_jsp._jspx_meth_html_select_0(index_jsp.java:140)
org.apache.jsp.index_jsp._jspx_meth_html_html_0(index_jsp.java:111)
org.apache.jsp.index_jsp._jspService(index_jsp.java:75)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)



I am new to this technology so cant understand the error .
Need some urgent help as i need to implement this .
Thanks for all the help in advance .
Avneet
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'm afraid the error message in this case is not very intuitive, or very helpful to a newbie.

The main problem here is that you have not enclosed your <html:select> tag inside an <html:form></html:form> tag pair.

Once you do this, you still must make sure that the action you specify in the <html:form> tag has been defined in the struts-config.xml file, and that the ActionForm bean associated with that action has an "id" property, including a getId() and a setId() method.


Merrill
Consultant, Sima Solutions
Avneet Singh
Ranch Hand

Joined: Apr 25, 2006
Posts: 51
thanks merrill for ur input

will be kind of you if you can also tell me a bit more about action class and the servlet.
I am confused about the action servlet that we have to make and also form bean.
A norman java bean will be a form bean by extending to action class rt? , what i want to know is how will i initialize it in the struts-config.xml

Also where will i tell my application what action servlet it has to use to do buss logic .

I sound confused but wud appreciate a little help like may be a small code explaining what to do and how to .

Thanks man
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Avneet,

At this point in your learning of Struts, it would be a good idea to take a break from trying to develop your own application and spend some time just learning Struts. My advice is to step through one of the many hands-on tutorials on Struts just to get a feel for how it works and how it all comes together. You can find many by just Googling "Struts Tutorial". If you're using a particular IDE such as NetBeans or Eclipse, Include the name of your IDE in your search, and you will find some Struts tutorials specifically made for your IDE.

If after going through one or more of these tutorials you still have questions, let us know and we'll try to answer them.
Avneet Singh
Ranch Hand

Joined: Apr 25, 2006
Posts: 51
Thanks man

I am doin that nw , wil get back to you guys once im done with it .

Thanks
Avneet
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problems with html:select - need help - struts tag library