Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in jsp:getProperty  RSS feed

 
Gayani Kanchana
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • 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}">

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

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

thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you using <jsp:getproperty> in place of the EL?
 
paritosh ranjan
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • 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());
%>
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!