Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

html/jstl syntax problems  RSS feed

 
Chris Pat
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
The snippet below fails to play the file. Can someone explain why? Where should the file be? Is it okay to explicitly reference it?

Also the jstl for the location fails. Second below is the web.xml file. That syntax and location is correct? Any and all insight appreciated. Thank you.

playThis.jsp
<c:set var="sampleThis" value="${param.fileName}"/>
<c:set var="path" value="${initParam.mp3-dir}"/>
<c:set var="fullFile" value="${path}\${sampleThis}"/>
The file name = <c ut value="${fullFile}"/>
<br />

<embed src="F:\Projects\mp3\short.mp3" width="240" height="160"/>

web.xml
<web-app>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>mp3-dir</param-name>
<param-value>F:\Projects\mp3</param-value>
</init-param>
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I really can't tell what your question is.

Are you getting the hard-coded embed to work without any JSTL? That's the first step.
 
Stefan Evans
Bartender
Posts: 1836
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The init-param you have in web.xml looks to be an init-param to the Servlet ActionServlet.
As such the JSTL initParam variable will not pick it up.
initParams variable correspond to ServletContext.getInitParameter() - not ServletConfig.getInitParameter. Ie the init parameters for the Server, not for an individual servlet.
You would need this in your web.xml:

<context-param>
<param-name>mp3-dir</param-name>
<param-value>F:\Projects\mp3</param-value>
</context-param>
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!