• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Problem in jsp:getProperty

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am developing a web application using netbeans 5.5. I need to load elements stored in vector to a dropdownlist. im using jsp:getProperty to reurn the vetor object in my bean class. However i cannot iterate through vector. im using JSTL foreach tag to do so. Following is my code.
------------------------------------------------------------------
<jsp:useBean id="user1" scope="request" class="Beans.UserBean" />

<jsp:getProperty name="user1" property="region" /></p>

<c:forEach var="region1 " begin="" items="${user1.region}">

<c:out value="${region1}"/><br>
</c:forEach>

-----------------------------------------------------------
region is my vector
Pls Help.

thanks
 
Sheriff
Posts: 67753
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why are you using <jsp:getproperty> in place of the EL?
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gayani
As you said
im using jsp:getProperty to reurn the vetor object in my bean class.

This is a common misconception,jsp:getProperty is used to print the value of the property.It doesn't gives you access to that property as it seems to do with a name like "getProperty".But the sole purpose of jsp:getProperty is to print the property.

The following actions instruct the JSP engine to print out the values of the state and the zip properties of the address bean:
<jsp:getProperty name="address" property="state" />
<jsp:getProperty name="address" property="zip" />

They are equivalent to the scriptlet code:
<%
out.print(address.getState());
out.print(address.getZip());
%>
 
Willie Smits increased rainfall 25% in three years by planting trees. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic