It works!! Thanks.
When I said "sometimes" I mean sometimes the error appears in the log, and
sometimes no.
Maybe the level debug, maybe a log size too long.
Thank you dusty.
----- Original Message -----
From: dusty [via AppFuse]
To: Juan Antonio
Sent: Wednesday, May 19, 2010 7:21 AM
Subject: Re: Populate a select with a list from servletcontext
Try #attr.types
When you say sometimes, do you mean each time you load the page it works
sometimes and if you reload sometimes it works, or it never works?
Also, an ArrayList is a container so you don't need to initialize its size.
I don't think you are using the capacity parameter in the constructor the way
you think you are. Just types = new ArrayList() works fine.
-D
On May 18, 2010, at 8:57 PM, Juan Antonio wrote:
>
> Hello again:
>
> I have a jsp code like this:
>
>
> <div>
> <s:select name="type" list="#application.types" label="Tipo contenido:"
> />
> <div>
>
>
> Where I populate a select from the a ServletContext attribute:
>
>
> public class UserDataListener implements HttpSessionAttributeListener,
> ServletContextListener {
>
> ...
>
> public void contextInitialized(ServletContextEvent sce) {
>
> ServletContext servletContext = sce.getServletContext();
> types = new ArrayList(3);
> types.add(Constants.UNO);
> types.add(Constants.DOS);
> types.add(Constants.TRES);
> servletContext.setAttribute("types", types);
>
> }
>
> ...
> }
>
>
>
> Sometimes, I found a message like "Caught an exception while evaluating
> expression '#application.types": java.lang.NullPointException"
>
> I don't know what i am doing wrong (i copied the code from a struts 2
manual
> :confused: )
>
> Any clue?
>
> I also tried #application['types'], and still nothing.
>
> Thanks.
> --
> View this message in context:
http://appfuse.547863.n4.nabble.com/Populate-a-select-with-a-list-from-servletcontext-tp2222242p2222242.html
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
------------------------------------------------------------------------------
View message @
http://appfuse.547863.n4.nabble.com/Populate-a-select-with-a-list-from-servletcontext-tp2222242p2222289.html
To unsubscribe from Populate a select with a list from servletcontext, click
here.
--
View this message in context:
http://appfuse.547863.n4.nabble.com/Populate-a-select-with-a-list-from-servletcontext-tp2222242p2222658.html
Sent from the AppFuse - User mailing list archive at Nabble.com.