struts - opening new sized window

R

Raycaster

Using Struts, I have a form displayed for a user to edit values. Now
next to a text area, I have a label which is a link that opens a new
window that displays a grid of available values for the text box. The
user clicks on a value and the popup window closes and fills in the
parent window with the selected value. This all works fine, but I want
to do is open the popup window with a specific size ( using javascript,
you specify the width and height ). I am lost at how to do this.
Perhaps I am even doing this the wrong way, but I am not sure how else
to do this. I am hoping someone has some advice on this. Here is how I
do it:

On the edit form, I have the following link:
<a href="chainLookupAction.do" target="Chain">Chain Lookup</a>

As you can see I use the target parameter to open the popup in a new
browser. The chainLookupAction.do action retrieves the data from the
database and sends the List to the new jsp. To compensate for this, I
have this in the popup window:

<script>
self.resizeTo(400,600);
</script>

The only problem I have in all this, is the popup window opens up, but
it opens up full screen and then resizes to the correct size. The
resize of the window can be quite annoying to the user and so I was
trying to get the new window to open without resizing, I want it to
open already resized.
Anyway, I hope this makes sense. I appreciate any help. Thanks.
 
A

Andrew Thompson

Using Struts, I have a form displayed for a user to edit values. Now
next to a text area, I have a label which is a link that opens a new
window that displays a grid of available values for the text box. The
user clicks on a value and the popup window closes and fills in the
parent window with the selected value. This all works fine, but I want
to do is open the popup window with a specific size ( using javascript,
you specify the width and height ). I am lost at how to do this.

Good. Don't do it.

Unless you can also get lots of cash from refactoring it back to
a single window app. later when the clients realise that half
their customers who just installed IE SP2, the Google ToolBar,
another browser with pop-up blockers (read most released within
last 12 months) etcetera cannot use the application.
 
B

Brock Heinz

Andrew Thompson said:
Good. Don't do it.

Unless you can also get lots of cash from refactoring it back to
a single window app. later when the clients realise that half
their customers who just installed IE SP2, the Google ToolBar,
another browser with pop-up blockers (read most released within
last 12 months) etcetera cannot use the application.

Without asking anything concerning the requirements - this: 'Good.
Don't do it.' is a bit harsh. True, most browsers will now block
popups. But with intranet applications, coding an applictation in
this manner is certainly acceptable.

Now although this isn't a 'java' issue, your requirement can be
accomplished using Javascript:

<html>
<head>
<script type="text/javascript">
function openwindow(ipt)
{
window.open(ipt,"new_window","toolbar=no, location=no,
directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes,
copyhistory=yes, width=400, height=400,top=0,left=0");
}
</script>
<body>
<a href="javascript:eek:penwindow('http://www.google.com')">Open!</a>
</body>
</html>

Brock
 
A

Andrew Thompson

Without asking anything concerning the requirements - this: 'Good.
Don't do it.' is a bit harsh.

Consider it a question as to the application requirements that
were not stated.
..True, most browsers will now block
popups. But with intranet applications, coding an applictation in
this manner is certainly acceptable.

Until the IT department installs SP2 across the desktops and the
entire application breaks.
Now although this isn't a 'java' issue, your requirement can be
accomplished using Javascript:

Presuming Javascript is enabled or available on the particular UA.

Though that is rather foolhardy to recommend without warning of the
accessibility issues it raises. (Are you ready to be sued by a
web visitor/employee who is visually impaired and uses a screen
reader with no JS?)
<a href="javascript:eek:penwindow('http://www.google.com')">Open!</a>

And that is the wrong way to do it in any case.
<http://www.jibbering.com/faq/#FAQ4_24>
 
R

Raycaster

Well fortunately, I am in development stage where I am just building
the prototype and I can make any changes I want ( I am also the only
developer so I have free reign ) and all the points you all brought up
are valid and highly appreciated. The problem I have is I have an
existing application ( client/server ) that users have been using for
years and they are very reluctant to change so what I was doing was
building the web app that looks and feels like what they are use to,
but to be honest, that should not be a good reason so I am going to
build it the "correct" way. This is why I post my questions to forums
like these, I always get quality feedback, thank you all for the
comments.

Ok, one final question then, would it also be bad to, instead of
opening up a popup window, to send the results to a different frame? As
a web designer, I always hear how frames are bad, blah blah blah, but
for the requirement mentioned in my previous post, I would like to
display the "lookup" data below the current row. The reason for this
is because I want the user to be able to see the existing values for
the record they are editing as they are picking a "lookup" value. I
know how to do this, I am now asking if that is considered bad design
to do this.
 
A

Andrew Thompson

..frame? (snip)
..I
know how to do this, I am now asking if that is considered bad design
to do this.

Best asked on a site design group. I would normally recommend
comp.infosystems.www.authoring.site-design, but it would make
sense to add the information re user base that you did, and the
folks who post there are not very conducive to dealing with
web-page matters that exist on an intranet.

So, I'll take a tab at it.

Frames are less problematic than pop-ups. There are no blockers
for frames. Frames still present some accessibility/usability
issues though. E.G. navigating the frames using the keyboard.

Having said that, I have intentions of using 'evil' frames for
presenting content (hundreds of documents) off CD. It is not
a perfect solution, but workable for my purposes ..hopefully.

I would recommend frames over pop-ups, assuming those are the
only practical options for your web-app.

HTH
 
S

Sudsy

Raycaster wrote:
existing application ( client/server ) that users have been using for
years and they are very reluctant to change so what I was doing was
building the web app that looks and feels like what they are use to,
but to be honest, that should not be a good reason so I am going to
build it the "correct" way. <snip>

Good for you! Why some people feel that you have to duplicate a windows
app in Java is quite beyond me. Your users are not (typically) idiots!
They'll figure out the "new" way and, if you do it right, will likely
soon prefer it to the old way.
Ok, one final question then, would it also be bad to, instead of
opening up a popup window, to send the results to a different frame? As
a web designer, I always hear how frames are bad, blah blah blah, but
for the requirement mentioned in my previous post, I would like to
display the "lookup" data below the current row. The reason for this
is because I want the user to be able to see the existing values for
the record they are editing as they are picking a "lookup" value. I
know how to do this, I am now asking if that is considered bad design
to do this.

One mechanism I see used at a number of sites involves making a number
of trips back to the server to update pop-up menu selections. For example,
go to napaonline.com. After you select the vehicle year and make the
form is submitted and returns with a selection box containing all the
models corresponding to the specified year/make. In fact, if you look at
the source you'll find a form called yearmake_form which is submitted
once completed.
Since you're apparently creating an internal app, multiple trips to the
server shouldn't seriously impact performace. Plus it's more of a "work-
flow" approach, which I like.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top