Hey Brice, 

I would agree I don't think it's finding your bean, as a result its trying to 
instantiate a Document object, and of course being an interface Document doesn't like 
someone trying to instantiate it. 

If your object is in the app scope, your should just be able to use it. 

You could try doing a logic present tag and test to see if its really there. Otherwise 
you can always just enumerate through the attribute names/elements in the servlet 
context and see what's there. 

bn


-----Original Message-----
From: Ruth, Brice [mailto:[EMAIL PROTECTED]
Sent: Friday, October 31, 2003 2:47 PM
To: Struts Users Mailing List
Subject: Re: Store object in "application" scope


OK, I'm having very little luck with this. I'm trying to pre-parse an 
XML document that is used by a few different JSPs, so that each of them 
doesn't need to do a <c:import> and <x:parse> - I've checked the source 
for the JSTL XML ParseSupport class to see what its doing, and it seems 
pretty basic (I'm not using filters, so its a bit simpler). I save the 
org.w3c.dom.Document to application scope, then, within the JSP, I do:

<jsp:useBean id="varName" class="org.w3c.dom.Document"/>

I'm getting an exception thrown of type java.lang.InstantiationException 
... correct me if I'm wrong, but if its actually finding my object in 
Application scope, then it shouldn't be throwing this, right? Do I need 
the jsp:useBean at all? Or can I just start using $varName in my 
<x:forEach> statements, straight-away?

Wiebe de Jong wrote:

>I do the same thing. Here is a code snippet:
>
>public class AppStart extends HttpServlet {
>
>// this will execute at startup
>public void init() throws ServletException {
>
>  // province/state list
>  ArrayList provList = new ArrayList();
>
>  getServletContext().setAttribute("appProvList", provList);
>
>Wiebe de Jong
>http://frontierj.blogspot.com 
>
>-----Original Message-----
>From: Ruth, Brice [mailto:[EMAIL PROTECTED] 
>Sent: Friday, October 31, 2003 11:20 AM
>To: Struts Users Mailing List
>Subject: Store object in "application" scope
>
>I'm writing a servlet that will do some init jobs and I'd like to be 
>able to store some objects in "application" scope so that they are 
>visible from my JSPs - how best would I go about doing this from a 
>Servlet? My Servlet class is extending HttpServlet and I'm going to be 
>implementing the init(ServletConfig), mainly.
>
>Thanks!
>
>  
>

-- 
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



**********************************************************************
This e-mail is the property of Enron Corp. and/or its relevant affiliate and may 
contain confidential and privileged material for the sole use of the intended 
recipient (s). Any review, use, distribution or disclosure by others is strictly 
prohibited. If you are not the intended recipient (or authorized to receive for the 
recipient), please contact the sender or reply to Enron Corp. at [EMAIL PROTECTED] and 
delete all copies of the message. This e-mail (and any attachments hereto) are not 
intended to be an offer (or an acceptance) and do not create or evidence a binding and 
enforceable contract between Enron Corp. (or any of its affiliates) and the intended 
recipient or any other party, and may not be relied on by anyone as the basis of a 
contract by estoppel or otherwise. Thank you. 
**********************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to