• 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

jsp:getProperty not working

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following code in a jsp page:
<%=faq.getQuestion()%>
The expression prints out okay.
<jsp:getProperty name="faq" property="question"/>
But the getProperty which is suppose to be the equivalent, does nothing!
Any ideas why this should be?
See below for most of the code
<%@ page import="com.taglib.wdjsp.faqtool.*"
errorPage="error.jsp" %>
<jsp:useBean id="faq" class="com.taglib.wdjsp.faqtool.FaqBean" scope="request"/>
<%
FaqBean[] faqs = (FaqBean[])request.getAttribute("faqs");
%>
...
<tr><th colspan="2">FAQ Administration: Update Menu</th></tr>
<%
for (int i=0; i < faqs.length; i++) {
faq = faqs[i];
%>
<tr>
<td><input type="radio" name="id"
value='<%=faq.getID() %>'>
<%=faq.getID() %></td>
<td><%=faq.getQuestion()%> <jsp:getProperty name="faq" property="question"/>
</td>
</tr>
<% } %>
...
</form>
</html>
 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please see the way u are instatiating the bean. You are setting the scope as request, where as there is no object of the name "faq" in your request. The object that exists in the request is "faqs".
So a new object of name "faq" is formed and put in to the request, which probably has not set its question variable.
Please check this out.
-Kaustubh.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic