File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Trouble accessing a singleton within a JSP page! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Trouble accessing a singleton within a JSP page!" Watch "Trouble accessing a singleton within a JSP page!" New topic
Author

Trouble accessing a singleton within a JSP page!

Roger Graff
Ranch Hand

Joined: May 29, 2001
Posts: 112
I'm having a dandy of a time trying to get an instance to a singleton within my jsp page. This singleton contains the a HashMap of field labels of the input fields. Anyhoo, when I call the singleton's getInstance() method, the app pretty much hangs, no errors that I can see. I'm using Visual Age 4.0 WTE and a Model 2 architecture. Here's the code for the JSP:

-------------------------------------------
<HTML>
<HEAD>
<TITLE>hello.jsp</TITLE>
</HEAD>
<BODY>

<%@ page import="service.ContentService" %>
<jsp:useBean id="bean" scope="page" class="bean.HelloBean" />
<H1>Who are you?</H1> <br>
<!-- this is what's causing it not to respond -->
<% ContentService service = ContentService.getInstance(); %>
<input type="text" value="<%=bean.getName()%>" >
</BODY>
</HTML>
Roger Graff
Ranch Hand

Joined: May 29, 2001
Posts: 112
Nevermind. I had a compile problem in an underlying class that was the root of the problem. I'm curious as to why my ContentService class compiled in the first place, but that is another matter all together!
 
wood burning stoves
 
subject: Trouble accessing a singleton within a JSP page!