• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Struts 2: Prepopulating fields in a popup window.

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!

My current issue:
I have a link:


When the link is clicked it calls the function called UpdateUser().


All that is working fine, but I want to send along the id of the user who is logged in:



In the action class the the execute method calls the method getPersonById() (located in PersonService.java) and then sets the values of the forms attributes with the values from the Person object.
It works perfectly well when the link doesn't open a popup and looks like this:

I understand that the problem with the codesnippet that opens a popup is that there aren't any parameters being sent along.

Thus I've tried the following but now no popup is opened:
xxx.jsp

The above code has also been tried with '' instead of "".
When I surround the <s:url> tags with ' ' I get a popup, but there are no values in it. (The execute method isn't even called)
And changing the function to:


Any ideas?
Thanks
Alia
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do you need to pass a session variable in a URL? It's in the session. Get it in the action.
 
Alia Huss
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alright, I concede, that was a poor example.

If I instead have a table, with columns:


Each column has it's own date and in each column there might be a reservation, which has it's own id.
I want the link to open a popup, while the parent window stays as it was before the link was clicked.
And I want the fields of the popup to be populated with the values sent along with the URL.

Better?
Thanks
Alia
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you verified that the JavaScript method is getting a correct, complete URL?
 
Alia Huss
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It should. If I put the whole <s:url> in the href of the <a> tag, it sends me to the correct page with the correct values preset.
 
Alia Huss
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It works! Thanks.
 
get schwifty. tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic