Re: Expression Language ${initParam.whatever} not working
Am 10.02.2020 22:43, schrieb Richard Monson-Haefel: Thanks, Mark. Your explanation was good but the code didn't do it. Then try ${pageContext.servletConfig.getInitParameter("greeting_color")} Felix On Mon, Feb 10, 2020 at 12:10 PM Mark Thomas wrote: On 10/02/2020 18:03, Richard Monson-Haefel wrote: > Hi Simon, > > Thanks for the response but I don't think that is the issue. I can use the > instead, but I want to use the initParam for the JSP page > which is named and mapped in the element. Perhaps I'm still > missing something. The EL implicit object initParam holds the *ServletConext*'s init params, not the Servlet's. You probably want something like (untested) ${ pageContext.servletConfig.initParameter("greeting_color") } Mark > > On Mon, Feb 10, 2020 at 12:00 PM Simon Funnell > wrote: > >> In your web.xml you want: >> >> >> greeting_color >> green >> >> >> I think you have defined an initialization parameter for the servlet, not >> the context. >> >> On Mon, 10 Feb 2020 at 17:54, Richard Monson-Haefel < >> monsonhae...@gmail.com> >> wrote: >> >>> Hi, >>> >>> Tomcat version: 9.0.30 >>> Operating System: macOS 10.15.2 >>> >>> While I can access my initParam vis a JSP scriptlet I cannot access the >>> same initial paramter EL expression. >>> >>> Here is the JSP code I'm using >>> >>> >>> >>> >>> >> %>">Hello ${param.name} from hello.jsp >>> >>> >>> color is ${initParam["greeting_color"]} >>> >>> >>> >>> Here is my web.xml declaring the initial parameters >>> >>> http://xmlns.jcp.org/xml/ns/javaee"; >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >>> xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee >>> http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd >> " >>> version="4.0" >>> metadata-complete="true"> >>> >>> >>> >>> >>> HiJsp >>> /hello.jsp >>> >>> greeting_color >>> green >>> >>> >>> >>> HiJsp >>> /hola/* >>> >>> >>> >>> Here is the output (source) >>> >>> >>> >>> >>> Hello richard from >>> hello.jsp >>> >>> color is >>> >>> >>> >>> I don't understand why the JSP expression <%= %> works but the EL >>> expression ${ } doesn't. I've tried many variations and other EL >> implicit >>> objects I've tried worked fine. >>> >>> What am I missing? >>> >>> The WAR is attached for your convenience. >>> >>> >>> >>> -- >>> Richard Monson-Haefel >>> https://twitter.com/rmonson >>> https://www.linkedin.com/in/monsonhaefel/ >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >>> For additional commands, e-mail: users-h...@tomcat.apache.org >> > > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Expression Language ${initParam.whatever} not working
Thanks, Mark. Your explanation was good but the code didn't do it. On Mon, Feb 10, 2020 at 12:10 PM Mark Thomas wrote: > On 10/02/2020 18:03, Richard Monson-Haefel wrote: > > Hi Simon, > > > > Thanks for the response but I don't think that is the issue. I can use > the > > instead, but I want to use the initParam for the JSP page > > which is named and mapped in the element. Perhaps I'm still > > missing something. > > The EL implicit object initParam holds the *ServletConext*'s init > params, not the Servlet's. > > You probably want something like (untested) > > ${ pageContext.servletConfig.initParameter("greeting_color") } > > Mark > > > > > > On Mon, Feb 10, 2020 at 12:00 PM Simon Funnell > > wrote: > > > >> In your web.xml you want: > >> > >> > >> greeting_color > >> green > >> > >> > >> I think you have defined an initialization parameter for the servlet, > not > >> the context. > >> > >> On Mon, 10 Feb 2020 at 17:54, Richard Monson-Haefel < > >> monsonhae...@gmail.com> > >> wrote: > >> > >>> Hi, > >>> > >>> Tomcat version: 9.0.30 > >>> Operating System: macOS 10.15.2 > >>> > >>> While I can access my initParam vis a JSP scriptlet I cannot access the > >>> same initial paramter EL expression. > >>> > >>> Here is the JSP code I'm using > >>> > >>> > >>> > >>> > >>> >>> %>">Hello ${param.name} from > hello.jsp > >>> > >>> > >>> color is ${initParam["greeting_color"]} > >>> > >>> > >>> > >>> Here is my web.xml declaring the initial parameters > >>> > >>> http://xmlns.jcp.org/xml/ns/javaee"; > >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > >>> xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee > >>> > http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd > >> " > >>> version="4.0" > >>> metadata-complete="true"> > >>> > >>> > >>> > >>> > >>> HiJsp > >>> /hello.jsp > >>> > >>> greeting_color > >>> green > >>> > >>> > >>> > >>> HiJsp > >>> /hola/* > >>> > >>> > >>> > >>> Here is the output (source) > >>> > >>> > >>> > >>> > >>> Hello richard from > >>> hello.jsp > >>> > >>> color is > >>> > >>> > >>> > >>> I don't understand why the JSP expression <%= %> works but the EL > >>> expression ${ } doesn't. I've tried many variations and other EL > >> implicit > >>> objects I've tried worked fine. > >>> > >>> What am I missing? > >>> > >>> The WAR is attached for your convenience. > >>> > >>> > >>> > >>> -- > >>> Richard Monson-Haefel > >>> https://twitter.com/rmonson > >>> https://www.linkedin.com/in/monsonhaefel/ > >>> > >>> - > >>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > >>> For additional commands, e-mail: users-h...@tomcat.apache.org > >> > > > > > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > -- Richard Monson-Haefel https://twitter.com/rmonson https://www.linkedin.com/in/monsonhaefel/
Re: Expression Language ${initParam.whatever} not working
On 10/02/2020 18:03, Richard Monson-Haefel wrote: > Hi Simon, > > Thanks for the response but I don't think that is the issue. I can use the > instead, but I want to use the initParam for the JSP page > which is named and mapped in the element. Perhaps I'm still > missing something. The EL implicit object initParam holds the *ServletConext*'s init params, not the Servlet's. You probably want something like (untested) ${ pageContext.servletConfig.initParameter("greeting_color") } Mark > > On Mon, Feb 10, 2020 at 12:00 PM Simon Funnell > wrote: > >> In your web.xml you want: >> >> >> greeting_color >> green >> >> >> I think you have defined an initialization parameter for the servlet, not >> the context. >> >> On Mon, 10 Feb 2020 at 17:54, Richard Monson-Haefel < >> monsonhae...@gmail.com> >> wrote: >> >>> Hi, >>> >>> Tomcat version: 9.0.30 >>> Operating System: macOS 10.15.2 >>> >>> While I can access my initParam vis a JSP scriptlet I cannot access the >>> same initial paramter EL expression. >>> >>> Here is the JSP code I'm using >>> >>> >>> >>> >>> >> %>">Hello ${param.name} from hello.jsp >>> >>> >>> color is ${initParam["greeting_color"]} >>> >>> >>> >>> Here is my web.xml declaring the initial parameters >>> >>> http://xmlns.jcp.org/xml/ns/javaee"; >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >>> xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee >>> http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd >> " >>> version="4.0" >>> metadata-complete="true"> >>> >>> >>> >>> >>> HiJsp >>> /hello.jsp >>> >>> greeting_color >>> green >>> >>> >>> >>> HiJsp >>> /hola/* >>> >>> >>> >>> Here is the output (source) >>> >>> >>> >>> >>> Hello richard from >>> hello.jsp >>> >>> color is >>> >>> >>> >>> I don't understand why the JSP expression <%= %> works but the EL >>> expression ${ } doesn't. I've tried many variations and other EL >> implicit >>> objects I've tried worked fine. >>> >>> What am I missing? >>> >>> The WAR is attached for your convenience. >>> >>> >>> >>> -- >>> Richard Monson-Haefel >>> https://twitter.com/rmonson >>> https://www.linkedin.com/in/monsonhaefel/ >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >>> For additional commands, e-mail: users-h...@tomcat.apache.org >> > > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Expression Language ${initParam.whatever} not working
Hi Simon, Thanks for the response but I don't think that is the issue. I can use the instead, but I want to use the initParam for the JSP page which is named and mapped in the element. Perhaps I'm still missing something. On Mon, Feb 10, 2020 at 12:00 PM Simon Funnell wrote: > In your web.xml you want: > > > greeting_color > green > > > I think you have defined an initialization parameter for the servlet, not > the context. > > On Mon, 10 Feb 2020 at 17:54, Richard Monson-Haefel < > monsonhae...@gmail.com> > wrote: > > > Hi, > > > > Tomcat version: 9.0.30 > > Operating System: macOS 10.15.2 > > > > While I can access my initParam vis a JSP scriptlet I cannot access the > > same initial paramter EL expression. > > > > Here is the JSP code I'm using > > > > > > > > > > > %>">Hello ${param.name} from hello.jsp > > > > > > color is ${initParam["greeting_color"]} > > > > > > > > Here is my web.xml declaring the initial parameters > > > > http://xmlns.jcp.org/xml/ns/javaee"; > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > > xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee > > http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd > " > > version="4.0" > > metadata-complete="true"> > > > > > > > > > > HiJsp > > /hello.jsp > > > > greeting_color > > green > > > > > > > > HiJsp > > /hola/* > > > > > > > > Here is the output (source) > > > > > > > > > > Hello richard from > > hello.jsp > > > > color is > > > > > > > > I don't understand why the JSP expression <%= %> works but the EL > > expression ${ } doesn't. I've tried many variations and other EL > implicit > > objects I've tried worked fine. > > > > What am I missing? > > > > The WAR is attached for your convenience. > > > > > > > > -- > > Richard Monson-Haefel > > https://twitter.com/rmonson > > https://www.linkedin.com/in/monsonhaefel/ > > > > - > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > > For additional commands, e-mail: users-h...@tomcat.apache.org > -- Richard Monson-Haefel https://twitter.com/rmonson https://www.linkedin.com/in/monsonhaefel/
Re: Expression Language ${initParam.whatever} not working
In your web.xml you want: greeting_color green I think you have defined an initialization parameter for the servlet, not the context. On Mon, 10 Feb 2020 at 17:54, Richard Monson-Haefel wrote: > Hi, > > Tomcat version: 9.0.30 > Operating System: macOS 10.15.2 > > While I can access my initParam vis a JSP scriptlet I cannot access the > same initial paramter EL expression. > > Here is the JSP code I'm using > > > > > %>">Hello ${param.name} from hello.jsp > > > color is ${initParam["greeting_color"]} > > > > Here is my web.xml declaring the initial parameters > > http://xmlns.jcp.org/xml/ns/javaee"; > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee > http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"; > version="4.0" > metadata-complete="true"> > > > > > HiJsp > /hello.jsp > > greeting_color > green > > > > HiJsp > /hola/* > > > > Here is the output (source) > > > > > Hello richard from > hello.jsp > > color is > > > > I don't understand why the JSP expression <%= %> works but the EL > expression ${ } doesn't. I've tried many variations and other EL implicit > objects I've tried worked fine. > > What am I missing? > > The WAR is attached for your convenience. > > > > -- > Richard Monson-Haefel > https://twitter.com/rmonson > https://www.linkedin.com/in/monsonhaefel/ > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org
Expression Language ${initParam.whatever} not working
Hi, Tomcat version: 9.0.30 Operating System: macOS 10.15.2 While I can access my initParam vis a JSP scriptlet I cannot access the same initial paramter EL expression. Here is the JSP code I'm using ">Hello ${param.name} from hello.jsp color is ${initParam["greeting_color"]} Here is my web.xml declaring the initial parameters http://xmlns.jcp.org/xml/ns/javaee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"; version="4.0" metadata-complete="true"> HiJsp /hello.jsp greeting_color green HiJsp /hola/* Here is the output (source) Hello richard from hello.jsp color is I don't understand why the JSP expression <%= %> works but the EL expression ${ } doesn't. I've tried many variations and other EL implicit objects I've tried worked fine. What am I missing? The WAR is attached for your convenience. -- Richard Monson-Haefel https://twitter.com/rmonson https://www.linkedin.com/in/monsonhaefel/ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org