Results 1 to 1 of 1

Thread: <jsp:setProperty name="x" property="*"/>

Threaded View

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Resolved <jsp:setProperty name="x" property="*"/>

    I was trying to find different ways to set bean properties from request parameter values and then get bean properties to be displayed. The code block below should work but i saw an alternate way which i provided in the the last code block. The only thing i don't understand is the property attributes * value. With my code you can clearly see how the beans properties are set via the request params, then retrieved, whereas in the bottom example it seems like there is somthing going on under the sheets. With this line <cut value="${userInfo.userName}" how is the link between the html component and the bean property acheived? It seems the * enables the beans properties to be set and read at the same time but does it also allow the request parameter to be grabbed?
    Code:
     <jsp:useBean id="userInfo" class="com.ora.jsp.beans.userinfo.UserInfoBean"/>
       
     <jsp:setProperty name="userInfo" property="userName"
          value="${param.userName}"/>
     
     <jsp:getProperty name="userInfo" property="userName"/>
    Code:
     <jsp:useBean id="userInfo" 
       class="com.ora.jsp.beans.userinfo.UserInfoBean">
        <jsp:setProperty name="userInfo" property="*" />
     </jsp:useBean>
     
     <c:out value="${userInfo.userName}" /><br>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width