struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ej Magdaluyo <ejmagdal...@gmail.com>
Subject Re: Upgrading Struts 2.2.3 to 2.3.34
Date Mon, 30 Oct 2017 15:36:10 GMT
Hi Lukasz,

Unfortunately, the coding conventions in our application are not up to
today's standards. We were given this old application to work on hence some
of the conventions (such as scriplets) are not ideal.

This is the supposed flow:

struts.xml:

<action name="viewMyRequest" method="viewMyRequest"
class="com.MyRequestAction">
<result name="success">/jsp/viewMyRequest.jsp</result>
</action>


method viewMyRequest (we had tested the java file itself, and the request
is setting corerctly):

public String viewMyRequest() throws Exception {
SearchCriteriaVO searchCriteriaVO= constructSearchCriteria();
MyRequestDelegate myRequestDelegate = new MyRequestDelegate();
ViewReqDetails = myRequestDelegate.getRequestViewDetails(searchCriteriaVO);
ViewReqDetails.setEditApprover(false);
String searchEnabled=request.getParameter("searchEnabled");
if(searchEnabled!=null&&searchEnabled.equalsIgnoreCase("true")){
ViewReqDetails.setSearchEnabled(true);
}
setViewReqDetails(ViewReqDetails);
request.setAttribute("ViewReqDetails", ViewReqDetails);
return  SUCCESS;
}


SUCCESS here should mean that the result will ensure that page will get
routed to /jsp/viewMyRequest.jsp.

Problem now is that even though ViewReqDetails attribute was set, the value
is not transferring over once we try to retrieve this value in the jsp file:

viewMyRequest.jsp:

ViewReqDetailsVO ViewReqDetails =
(ViewReqDetailsVO)request.getAttribute("ViewReqDetails");
java.util.List classficationList = ViewReqDetails.getClassficationList();

A null value is being returned here, which is most likely why we get 403
forbidden also.

I am not sure where in struts/tiles update caused the passing of request
attributes to change though, but I am guessing that is what caused this.

Thanks!


On Fri, Oct 27, 2017 at 9:47 PM, Lukasz Lenart <lukaszlenart@apache.org>
wrote:

> 2017-10-27 14:34 GMT+02:00 Ej Magdaluyo <ejmagdaluyo@gmail.com>:
> > This is the java code:
> > public String viewMyRequest() throws Exception {
> > SearchCriteriaVO searchCriteriaVO= constructSearchCriteria();
> > MyRequestDelegate myRequestDelegate = new MyRequestDelegate();
> > ViewReqDetails = myRequestDelegate.getRequestViewDetails(
> searchCriteriaVO);
> > ViewReqDetails.setEditApprover(false);
> > String searchEnabled=request.getParameter("searchEnabled");
> > if(searchEnabled!=null&&searchEnabled.equalsIgnoreCase("true")){
> > ViewReqDetails.setSearchEnabled(true);
> > }
> > setViewReqDetails(ViewReqDetails);
> > request.setAttribute("ViewReqDetails", ViewReqDetails);
> > return  SUCCESS;
> > }
> >
> >
> > If we try to run tests within this java file, we are able to get the
> values
> > without any issues. It is just when we try to call this attribute where
> the
> > problem begins.
>
> Now I'm confused ... you have this code in your action but still
> transferring it over request to a scriplet?
>
> How defintion of SUCCESS result looks like?
>
>
> Regards
> --
> Ɓukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message