• 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

Is there something limiting the size of my jsp page?

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is actually a test situation. I'm programming a perl script to load a database and the input is a screen dump of message counts from another machine. I'm fairly certain I've got it, but I need to check it. The easiest way (visually) I could see to check the data from a table with 230 columns with 30+ character column names was to create a transposed html table in JSP. That is, display the rows as columns and columns as rows. Which I did like this:



The issue is my table, which should run for 230 "rows" runs for 220 and doesn't display anthing after it. Firefox says its waiting to the server, exploiter says something about an include after the table that doesn't load. It doesn't appear to be byte count related, because it chops the table whether I limit it to 1 column or display all 16... I think I can see enough to be confident in my data accuracy and I won't be posting near as my data for actual reports, but I'm vexed by this.
[ February 04, 2005: Message edited by: Jim Babcock ]
 
author & internet detective
Posts: 41860
908
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
Jim,
Could the database connection be timing out? Try copying the result set data into an ArrayList and looping through that in the JSP.

On a related note, it's good practice to keep code (especially database code) out of the JSP. A preferred solution is to process the data in a servlet and just use the JSP to display it.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More likely the http connection is timing out.
Browsers get tired of waiting for servers sometimes, servers get tired of waiting on cgi/servlet processes to complete as well.
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with Jeroen.
230 is not a huge no, or otherwise it is in damn bad position and a real tuning required.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeanne Boyarsky:
It's good practice to keep code (especially database code) out of the JSP. A preferred solution is to process the data in a servlet and just use the JSP to display it.



Everybody please paste it just on the top of their monitors.


Just want to add:
It's good practice to keep database code out of both JSP & Servlet. For DB stuff use some normal plain java classes or some mapping frameworks as you feel like.
[ February 06, 2005: Message edited by: Adeel Ansari ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Adeel Ansari:


Everybody please paste it just on the top of their monitors.


Just want to add:
It's good practice to keep database code out of both JSP & Servlet. For DB stuff use some normal plain java classes or some mapping frameworks as you feel like.

[ February 06, 2005: Message edited by: Adeel Ansari ]



Actually, this sounds like a good candidate for model 1 programming.
It's a small, limited scope, limited duration project that will never be sent to a designer for look and feel adjustments.

To me the strength of server side Java is it's flexibility. For large multi developer projects, j2ee give you the best range of options for breaking your projects into M, V, and C components. It also gives you the power to quickly script things together for tasks like this.

A lot of people, on this site, get jumped on for not using MVC, often when their questions had nothing to do with architecture. Scriptlets and Model I programming are not "incorrect" in all cases. If they were, the scriptlet tag would have been deprecated a long time ago. The ability to hack small apps together in a 'shell script' like environment without loosing any of the benefits of a compiled Java program is a powerful feature, and one that shouldn't be dismissed as wrong in all cases.

J2EE gives us the power to choose from many different architectures. The trick is knowing which tool to use for which job.
[ February 07, 2005: Message edited by: Ben Souther ]
 
Jim Babcock
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, I've been kind of frustrated trying to use model 2 with tomcat. I haven't been able to figure it out and I feel like I've been trying to learn in a vacuum. Tomcat's docs are hardcore model 2 in some sections, but only get you half way there, refering you to another section that's still written model 1.

I can't make jdbc resources work if my life depended on it... thats not entirely true, I can configure realm authorization (atleast the first user... other users I've added need to login 2-3 times, whats with that) and I can create a connection and execute a query in the jsp, but I can't query using a jdbc resource... not even using the authorization resource, even though its obviously working.

I've tried looking for tutorials or examples on the web or at the book store and everything is either model 1 or so tied to a specific product that I can't extend it into the generic template I need.

If anyone has any pointers or an idea why my authentication behaves so strangely, I'd appreciate it. I've always been a big java/OOP proponent, but with the success I've been having with Perl on the scripting end, I'm wondering if I should dump Tomcat for Apache/perl_mod...

Thanks for your suggestions
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would be quite a tangent if the Tomcat docs did try to cover MVC. It would also be a duplication of effort since there are already so many tutorials out there.

I have a very primitive example of the MVC architecture at:
http://simple.souther.us

Also Chapter 15 in "Core Servlets and Java Server Pages" covers this:
http://csajsp-chapters.corewebprogramming.com/CSAJSP-Chapter15.pdf

A Google search like:
http://www.google.com/search?hl=en&q=MVC+TUTORIAL&btnG=Google+Search
will also yield a lot of information on the subject.

IMHO: There is no better architecture than the MVC pattern for separating the concerns of your app by developer skillsets. It's certainly worth the effort to learn and you would be selling yourself short by not giving it an honest shot before abandoning J2EE for mod_perl.

Good-Luck and welcome to J2EE
-Ben
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
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

Originally posted by Adeel Ansari:

Just want to add:
It's good practice to keep database code out of both JSP & Servlet. For DB stuff use some normal plain java classes or some mapping frameworks as you feel like.



I completely agree. The reason I often neglect to mention this is that I consider it a multi-step process.
1) Get database code out of JSP
2) Get code out of JSP
3) Get database code out of Servlet
4) Get database code into own layer
5) [optional] Substitute database layer with mapping framework

I feel that you are better off by completing any of these steps. Obviously, they aren't going to happen in one day. I wouldn't expect someone new to Java to have a database layer, but it's a good direction to head in.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While I can't argue with Ben that in some simple cases a Model 1 architecture is appropriate, I never receommend it because too may people seem to think that the Model 1 architecture means no architecture, and use it as a license to put Java processing code directly on the pages. The real difference betseen Model 1 and Model 2 is merely in what is serves as the controller: JSPs or servlets respectively. In either architecture, processing code should be relegated to Java classes and out of the JSP pages.

Also, using the Tomcat documentation to try and learn web application structure and best practices is like using your oven's manual to learn to make the French mother sauces. Don't dismiss a Model 2 architecture before finding a good source for info on it.
[ February 07, 2005: Message edited by: Bear Bibeault ]
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ben Souther:
J2EE gives us the power to choose from many different architectures. The trick is knowing which tool to use for which job.



Actually, here I am with Jeanne. As she said that it would be difficult for a beginer to figure out the best. So, we usually advice MVC 1 first, then MVC 2, then MVC 2+some other design patterns, and so forth . . so forth.

But offcourse I agree with you, Ben.
[ February 07, 2005: Message edited by: Adeel Ansari ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:

Also, using the Tomcat documentation to try and learn web application structure and best practices is like using your oven's manual to learn to make the French mother sauces.



The French Mother Sauces....
Analogies don't get any better than that.
[ February 07, 2005: Message edited by: Ben Souther ]
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Is there a way to implement MVC without RequestDispatcher? When using a RequestDispatcher the controller servlet need to know which jsp to forward to; however, in some other MVC approach, the view will find out by itself when the model is updated and update itself automatically. This will be easier to build a model with mulitple views.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In an HTTP environment the view is never intelligent.
After all, the view cannot push data to the display device, so having it update itself is rather pointless as noone would ever get to see the updated data before contacting the controller to request data...
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Chit Ming Chong:
Hi all,

Is there a way to implement MVC without RequestDispatcher? When using a RequestDispatcher the controller servlet need to know which jsp to forward to; however, in some other MVC approach, the view will find out by itself when the model is updated and update itself automatically. This will be easier to build a model with mulitple views.




The request dispatcher needs to know which JSP but it doesn't need to be hard coded. I have servlets that read an outputType parameter and depending on it's value forward to either a JSP that prints HTML or a JSP that prints csv data. You could make it even more dynamic by taking the name of the view JSP as a parameter.
reply
    Bookmark Topic Watch Topic
  • New Topic