• Post Reply Bookmark Topic Watch Topic
  • New Topic

beans and javascript  RSS feed

 
Uma Vinodh
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a bean which holds a list.

I want to access that list and modify the list size in the script.

how to access a bean in script.

can anyone help me in this?

Thanks,
Uma.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. The bean is on the server and the script is on the client.

Maybe you should explain specifically what you are trying to do.
 
Uma Vinodh
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a bean
<bean:define id="CntList" name="identificationActionForm" property="countyData" type="java.util.Collection"/>

I want to modify the size of this bean in javascript.

Thanks,
Uma.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As this has more to do with JSP than with JavaScript, moved to the JSP forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please see this article to understand why that cannot be.

The bean is defined on the server while the JSP is executing in order to send a plain old HTML page to the browser. Once at the browser, it's just an HTML page like any other and the fact that it was created by a JSP is moot.

Again, what are you really trying to do? Why do you want to adjust the collection from script?
 
Uma Vinodh
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to confuse you.

What I am trying to do is..

If the state field in the mailing address is Minnesota, I need to display all the counties in MN as a drop down list.
If some other state , I need to display just 'out of state' in the list.

So I need to modify the size of the collection if the state is not MN.

Thanks,
Uma.
 
Albareto McKenzie
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Uma, I think your last post is more confussing either, I don't understand what you are trying to do, I mean, you talk about mailing address and states but is the first reference you do to them and sincerly, it's quite difficult to imagine, please be clear and maybe is also a good idea to paste here some code to clarify things
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, changing the bean (even if you could do it) isn't going to have any effect on the page at that point. The bean is long gone, You'll need to change the select element (and its option elements) directly in script. Once the page is sent to the browser, your ability to set up the page using JSP/Struts mechanisms is long gone.

Have you read the article?


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