struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ruth, Brice" <br...@fiskars.com>
Subject Re: Store object in "application" scope
Date Mon, 03 Nov 2003 16:35:26 GMT
It ended up being one of those late Friday afternoon typos ... I was 
storing "navXml" in application scope and trying to use "xmlNav" in my 
JSP. Ooops!!

Nail, Evan Burke wrote:

>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:bruth@fiskars.com]
>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:bruth@fiskars.com] 
>>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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message