• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Avneet Singh
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks man

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

Thanks
Avneet
 
reply
    Bookmark Topic Watch Topic
  • New Topic