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 Fri, 03 Nov 2017 12:38:05 GMT
Hi Lukasz, Yasser,

Sorry for the late reply. Yes, the tiles jsp jar is on the classpath.

After weeks of facing this issue, one of my colleagues was able to solve
the issue. We imported the following in the java file:

import org.apache.struts2.dispatcher.*;


and added the following in the viewMyRequest method:

RequestMap rm = (RequestMap)ActionContext.getContext().get("request");
rm.put("REQ", ViewReqDetails);



Then in the jsp, we changed the way values were being called:

ex: <s:property value="#request.REQ.reqType"/>

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


This seemed to do the trick and we are now able to fetch all the values
correctly.

Thank you Yasser and Lukasz for all your help. This would not have been
possible without your assistance.

Regards,
EJ Magdaluyo

On Fri, Nov 3, 2017 at 8:05 PM, Lukasz Lenart <lukaszlenart@apache.org>
wrote:

> Do you have the Tiles JSP jar on the classpath?
>
> https://tiles.apache.org/framework/tiles-jsp/index.html
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> 2017-10-30 16:36 GMT+01:00 Ej Magdaluyo <ejmagdaluyo@gmail.com>:
> > 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
> >>
> >>
>
> ---------------------------------------------------------------------
> 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