• Post Reply Bookmark Topic Watch Topic
  • New Topic

A java bean question

 
jite eghagha
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On click i want to set a bean property to a name.

<A href="#" onclickz="if (buildTab('sandrine'))
{
<%= simple.SetName('Sandrine')%>
};return true">
</A>

When this bean is set, i plan to access that value from a second page.

Though i'm unable to setName(), i'm still able to use myBean.getName() in the second page. (i can get my default value ....null)

How do i set a bean value onclick? My set method has no effect.

[ September 05, 2008: Message edited by: jite eghagha ]
[ September 05, 2008: Message edited by: jite eghagha ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35709
410
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jite eghagha:
How do i set a bean value onclick? My set method has no effect.

As it shouldn't. The JavaScript and Java code run at different times. First the page renders with all the Java code. Then the user clicks on the JavaScript. If you view the source of the generated HTML page, you'llsee that what you think it is happening is not in fact being generated.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this article to learn how JSPs work.
 
jite eghagha
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne, i looked at the generated code and now understand the page renders all the Java code first. But, i'll have to do some reading to truely understand the generated code.

Thanks Bear, i'll read the article over night, then see whats what in the morning.

thanks for the article.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jite eghagha:
Thanks Jeanne, i looked at the generated code and now understand the page renders all the Java code first. But, i'll have to do some reading to truely understand the generated code.
Jeanne wasn't suggesting you look at the generated Java code, but at the HTML that is being sent to the browser. Particularly, the JavaScript in question.
 
jite eghagha
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you,

This is what caused my misunderstanding,Tab view, it's a means for dynamically creating new tabs.


Am i correct in saying that the script in this page,Tab View, embeds already existing html into a page, and that there is no need to request anything from a server.

If what i just said is correct, suppose i wanted to build a new tab, but not from an html page that already exists. I want fresh content from a server, by fresh content i mean a document generated on a server. What technology is best suited to do this, a Servlet? and if so are the any articles you would refer me to.

thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!