• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What technique to use in place of a pop up?

 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I have heard that it is considered bad to use javascript pop ups in struts/jsp code due to pop up blockers.
I am not sure what a good alternative would be. I have a struts app running under Tomcat 5. Someone recommended using hidden div's, and then when the user clicks on an icon, the div becomes visible, but this seems like a lot of unecessary code in the jsp since you never know what will be clicked on (I have about 30 rows of data, and each row would need its own div if I did it this way).
Any recomendations?
Thanks,
Kim
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since the JSP is generating the HTML for those rows, it should be able to generate a div for each of them. It's just a matter of programming, isn't it? Doesn't matter if there's one row or 30 or 150.
 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, but I was under the impression that a jsp page that gets too big may have trouble compiling. So, I thought having one pop up that all of the rows could use would keep the jsp much smaller than having one div per row.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've used popup windows in programming web applications, and have found that as long as your popup window is triggered by some action of the user such as clicking on a link, most popup blockers won't interfere. They will interfere if there is some sort of automatic process that opens up a popup when the page is loaded or in some other way that was not directly initiated by the user.

I've also used the hidden div technique, and that's a good option as well. If you want to use the same hidden div for all your popups, you can do that as well. Just use JavaScript to dynamically change the size, location, and content of the div.

However, I wouldn't worry about hitting the upper size limit on your JSP just based on the hidden divs unless your page is otherwise very large or complex.
[ September 05, 2007: Message edited by: Merrill Higginson ]
 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks so much for everyone's input. I would like to stick with the div method since I have it working, I just keep worrying that at some point I am going to tip the scales with this big JSP file.

It is definately the most complex jsp I have ever had to write. The file kim.jsp compiles to kim_jsp.java 505KB, and kim_jsp.class 236 KB. This seems very big to me but the page does render fine and behave fine, so guess it is OK. I thought I had read someplace that a compiled jsp shouldn't exceed 64 KB. Have you heard this or do I have the number wrong ?
 
Paul Clapham
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's definitely true that there's an upper limit to the size of a Java class (which is what you end up with after you compile your JSP). I'm not sure of the nature of that limit.

However if you have a loop in your JSP, that just compiles to a loop in the Java class. It doesn't matter how many times the loop is executed when you run the JSP. (If that was a factor in your concern.)

But complexity is a problem in itself, even if it does compile successfully. JSPs are hard to read at the best of times. It's not easy to break up a JSP into modules, but could you for example write a custom tag to do things that appear repetitively in your JSP code? I don't believe that would reduce the size of the compiled class, but it would reduce the complexity of the code.
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another aspect of size is how large the generated HTML page is. Particularly if you have any users on dialup. Even if it is a loop in the JSP, it gets downloaded one character at a time.

I echo the above in that sometimes a pop-up makes sense. I haven't had any issues with launching pop-ups in response to the user clicking a link (tested through IE 7.)
reply
    Bookmark Topic Watch Topic
  • New Topic