I want to access some attributes in request, for example, the base attribute in request,
the following are part of values in request
request ...base=/ecs, stack=com.opensymphony.xwork2.ognl.OgnlValueStack@11c4b31}, __cleanup_recursion_counter=1, .freemarker.RequestParameters=freemarker.ext.servlet.HttpRequestParametersHashModel@1c00cb4 ...
I use <s:debug /><s:property value="%{#request.base}" />
to access base attribute in request, but nothing shown in my jsp. So why?
Not sure why do you need this but only base inside request is inside .freemarker.TemplateModel which is ScopesHashModel. So you need use method get to get things from there.
<s:property value="#request['.freemarker.TemplateModel'].get('base')" />
Try this:
<s:property value="#request['javax.servlet.include.context_path']"/>
Update
If you just need context path then use <s:url> tag for that.
<s:url value="/"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With