This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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 Building Microservices this week in the Design 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!
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Trouble accessing a singleton within a JSP page!
 
It's not a secret anymore!