문제

I'm looking for something like that in Struts 2 :

<s:textfield name="name" value="%{#request.getRemoteUser()}" 
                              label="Evaluateur"  required="true" />

this not work and I'm testing

<s:textfield name="name" value="<%=request.getRemoteUser()%>"
                              label="Evaluateur"  required="true" />
도움이 되었습니까?

해결책

You can get a HttpServletRequest object in JSP from the action context with com.opensymphony.xwork2.dispatcher.HttpServletRequest key or by using static property of StrutsStatics interface.

<s:textfield value="%{#context[@org.apache.struts2.StrutsStatics@HTTP_REQUEST].getRemoteUser()}"/>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top