Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Working with a second window in Struts

 
Martin Riedl
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's see if i'm able to describe this correctly In German this would be much easier.
We are currently discussing possibilities to work with 2 different windows in our Struts-Application. What we went to do is: we have a Form in Windows1
where you can type in a search pattern for users and search for all matching users by submitting one button. The result of the search should be displayed as a List of differnet users in Windows2 with every single user as link. By clicking one of the users Windows2 should be closed and the TextBox of Windows one should be updated with the whole username.
I'm sure it can be achieved by using some JavaScript - but i'm not a friend of JavaScript.
Any suggestions or solutions? Maybe some of you already worked with different windows in Struts?
Thx in advance
Martin
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This cannot be achieved with struts. Struts (Java) is working only on server side. This means it doesn't know anything about different windows
on the client. When you look what happens when you submit a form you will
that. You submit the form, so your browser opens a connection to the webserver and transmits the data. The servlet is receiving the request, performs some actions and then returns the response. So you see how should the server know:
1. how much windows are open
2. how to contact the window
 
Uwe Barthel
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
A bit OT.
Open your window's with JavaScript and give they names.
And within your links fill the 'taget=""' with the name of the 2. window.
The browser know the target and 'printed' the stream to this window-handle.
thx
Uwe Barthel
[ December 16, 2003: Message edited by: Uwe Barthel ]
 
Bruno Dery
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could also probably force your second window to refresh at certain intervals using a simple html tag and that window would ask for the results of the search action... But then, it's a fixed time, so the search might fall in between this refresh time, which would make it look slower than it really is, not the mention the annoying 'click' noise when a window refreshes by itself
I'd say the only way to really make it dynamic is to use javascript... It can be evil, but using it carefully shouldnt cause problems.
 
Bruno Dery
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually in that second window you could have something like a progress bar, which basicly uses the refresh trick No javascript would then be needed, unless you progress bar thing uses javascript
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic