• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP-standard-action "useBean"

 
frank braunstein
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does this code:



Create a NEW Java Class named Person with the attribute name "userData" and the value "no name"?
OR
Does it create only a NEW property with an EXISTING Java-class, which can be get by using <jsp:getProperty...>?
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
frank braunstein wrote:


if already Person[userData] instance is in request then it wont create new Object as well as wont set the propert which is inside the body. otherwise, it create a new instance and set the property .

if you set like below
frank braunstein wrote:

if already Person[userData] instance is there in request .then it wont creat new Object.but it will override(set) the existing property(name) value.

Hope this helps
 
frank braunstein
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, i understood this as you mentioned, but why the hell im getting a blank page back then, after naming the servlet-attribute into something else, so that the standard-action-if-clause executes?

Let me clarify the look of my whole app.
the index.jsp gets some userInput:


the servlet sets attributes for each input-field:


and this is what the view-page looks like: It does work as long as a Attribute named "userData" is pre-set by the servlet, if this is not the case, (e.g. by renaming "userData" into "userData2" in the servlet) it creates a blank page with nothing in it, not even the html-part neither the scriplets nor the expressions.



And this is what Person-Class (Bean class) looks like:



I hope somebodys got the time to help me, i cant continue the damn exercises without your help!!!
 
frank braunstein
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found my mistake.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's considered polite to post what the problem was so that anyone else that comes across this post with similar issues can benefit from your solution.
 
frank braunstein
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:It's considered polite to post what the problem was so that anyone else that comes across this post with similar issues can benefit from your solution.


quite easy, i kept on reading the next 4 to 5 pages or so and then the book introduced the direct linking of a html-user-input-page and a JSP without servlets.

So to say, my problem was not solved, but it doesnt matter anymore since a working around with scriplets isn't needed anymore!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!