Hi all, I need to build a path to an image file in a JSP based on the value passed to the JSP's action, either using an English button from <context path>/*en*/closeBtn.gif or using a French button from <context path>/*fr*/closeBtn.gif. Suppose the parameter is called lang so the URL is like* .../login.action?lang=<en or fr>* ** There are two approaches, each of which has a problem which I need to figure out.
*1. If the path is built in JSP* In this case, I need to store the lang value in a variable and use it to build the path like this: <s:url value="/" includeParams="none" id="contextPath"/> <img src="${contextPath}*???*/closeBtn.gif"/> where ??? is either en or fr. How can I do it? I know lang can be streamed out like <s:property value="lang"/> but it doesn't work if ??? is substitued with <s:property value="lang"/>. Is there a way to read lang to a variable? *2. If the path is built in the action class* In this case, I need to get context path and use it to build the path. The path can be stored as a bean property so its value can be accessed in view using <s:property .../> tag. The problem is how to get the context path from an action class? Are there other ways to solve the problem? Thanks a lot for any comments and help.