File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Changing target of commandLink in actionListener

 
Jeff Lindquist
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have an application that uses frames. I am trying to set up a commandLink using a target frame, but the necessity is that I need to determine which frame to use based on the method in the actionListener. Is this possible?

Basically what I want to do is this:



Where target isn't determined until after the actionListener, but of course this won't work as the target is determined much earlier.

Thanks for any help,

Jeff
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17626
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ActionListeners are overused. Their primary utility comes when you want to attach multiple actions to one command.

However, whether you employ an ActionListener or just a plain vanilla action, the value of the target AFTER all the action processing is completed should be what defines things unless I'm mistaken. So, in other words, just set the bean property in the actionListener and you should be OK.

It's one of the reasons that you code an EL value reference, rather than a static one-time expansion on original page display.
 
Jeff Lindquist
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim, thanks for replying.

I made the function "getTarget" output something and when I load the initial page it outputs the string, so the target is being set on page load and not once the action is finished processing unfortunately. That's the problem is I need to use the input from the page to determine the target, but from my testing and what I can tell the target needs to be determined on page load. That's the workaround I was hoping for.

Jeff
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17626
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darn. I was afraid of that. Welcome to the Ranch, BTW!

I think you'll probably need to do an AJAX thing then. Modify the generated element right before it gets sent to the action listener rather than in the action listener, because when the action listener gets done, the client is then going to zap the current page and begin outputting the new one, losing any changes done from that point on before they can be seen and acted on.
 
Jeff Lindquist
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darn, I was afraid of that.

Thanks Tim!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic