Hi,
how do you invoke the jsp? I had a (maybe) similar issue and learned
that I cannot invoke JSPs directly (by browsing to the jsp url), but
have to call an ".action" url instead.
Best regards
Wolfgang
Am 26.03.25 um 09:37 schrieb Lidin NT:
Hi all,
I'm working on a Struts 7 application and facing an issue where userViewUtil is
showing an empty value in JSP. Setup:
I'm using <s:bean> and <s:set> to create and set values in JSP:
<s:bean name="com.demo.common.util.UserViewUtilWrapper"
var="userViewUtilWrapper"/>
<s:bean name="com.demo.common.util.ServletWrapper" var="servletWrapper"/>
<s:set var="userViewUtil"
value="#userViewUtilWrapper.getUserViewUtil(#servletWrapper.getRequest())"/>
When I try to display the values, they are empty:
<s:property value="#userViewUtil"/>
<s:property value="#servletWrapper.getRequest()"/>
Code Details:
UserViewUtilWrapper Class:
This is the method from UserViewUtilWrapper class:
public UserViewUtil getUserViewUtil(HttpServletRequest request) {
return UserViewUtil.getUserViewUtil(request);
}
ServletWrapper Class:
This is the method from ServletWrapper class:
public HttpServletRequest getRequest() {
return ServletActionContext.getRequest();
} Problem:
*
#servletWrapper.getRequest() returns null .
*
Therefore, #userViewUtilWrapper.getUserViewUtil(#servletWrapper.getRequest())
also becomes null .
Question:
1.
Why is ServletActionContext.getRequest() returning null in JSP?
2.
How can I fix this issue so that userViewUtil returns the expected value?
Any help would be greatly appreciated!
Thanks,
Lidin
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]