• 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

When does jsp:setProperty get called?

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...and why does this not work:

------------------------------------------------------
<%@ page import="questiondb.ResponderBean" %>

<jsp:useBean id="responderBean" class="questiondb.ResponderBean" scope="session">
<jsp:setProperty name="responderBean" property="*"/>
</jsp:useBean>


<html>
<head>
<title>Quick Test!</title>
</head>
<body>
<form action="PersistenceServlet" method="POST">
Name: <input type="name" size="30"><br>
Email: <input type="email" size="30"><br>
<br><Br><input type="submit" value="Post it!">
</form>
</body>
</html>
---------------------------------

I bind it to the session, but when I hit my servlet, the beans entries are null (not the bean itself however). Why are name and email not populated?

When does the setProperty thing actually do its stuff?


Thanks,
Rog
 
Roger Graham
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
errata: above - first mistake is:

<input type="text" >>>name<<<="name">
<input type="text" >>>name<<<="email">

Anyway, I tried that, and still get nulls for the values.. So the question still stands if someone can help me.

Thanks!
 
Roger Graham
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unless I am mistaken, I think the idea is to do a HTTP POST to a JSP with these elements, then we can do the setProperty thing in the JSP we've sent the data to.... is this as dynamic as it gets? It seems annoying having a second 'receiver' JSP... can't we put everything in the same JSP?

Rog
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Roger Graham:

<jsp:useBean id="responderBean" class="questiondb.ResponderBean" scope="session">
<jsp:setProperty name="responderBean" property="*"/>
</jsp:useBean>



When you put a setProperty tag in the body of the use bean tag, it will only get called the first time the page is called. Usefull for initializing.

Take it out of the body and it will get excecuted every time.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic