• 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

IllegalStateException on page load

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a simple index page the i am using as my application entry point. I need this page to call a servlet then return an array of brands to fill in on my home page. Now i alwyas get this error and sometimes the brands never fill in on the page. I have searched and tried different things o found on the web. In the html file i commented the different ways i have tried but still get the same result. Is there a better way to try to do what i am doing or do i just have a syntax error?

Thanks,
John

exception


index.jsp


Servlets






Edited by: jonnyd9191 on Oct 2, 2008 2:56 AM
 
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
You are trying to forward after you have emitted some output. No can do.
 
Bear Bibeault
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

Originally posted by John Schretz:
I need this page to call a servlet then return an array of brands to fill in on my home page.


You're doing it backwards. Servlets should call JSPs, not the other way around.

Please see this article for information on accepted best practice web application constructs.
[ October 01, 2008: Message edited by: Bear Bibeault ]
 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, but this jsp page is my entry point. so when i go to www.mypage.com this is the first page called. I then am calling the servlet so i can load my home.jsp page with the proper information. Is there a way that when i go to www.mypage.com the first thing executed is the servlet?

thanks
john
 
Bear Bibeault
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
YOu can set any resource to be the welcome file. Please read up on this concept in the deployment descriptor.
 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, i have tried that before.
In my web xml, i did servlet mapping
Then in the welcome file tags i entered the mapped servlet.
This did not work.

<welcome-file>
//mapped servlet here
</welcome-file>
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Two redirects in the JSP and one in the servlet

I think you should rework your design, take a good look at the link provided by Bear above, reduce the coupling or the code above will be a maintenance nightmare in near future.

Hope this helps
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic