> -----Original Message----- > From: Jeff Robertson [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 25, 2003 10:41 PM > To: 'Struts Developers List' > Subject: RE: [proposal]Adding queryString property to ForwardConfig > > > -----Original Message----- > [...snip...] > > In conclusion, you can take advantage of global forwards and > > forwards in > > actions with redirected parameters like > > > > ActionForward homeForward = > > mapping.findForward("welcome"); > > homeForward.setQueryString("pid=" + pageSrno); > > > > Instead of > > ActionForward homeForward = new > > ActionForward("/portal/index.jsp?pid=" + pageSrno, true); > > > > If you like to get this proposal as a form of patches, I'm > > willing to make > > and submit them to bugzilla. > > Have you considered a parameter/properties style interface to this? > > ActionForward homeForward = mapping.findForward("welcome"); > homeForward.setParameter("pid", pageSrno); > > Nobody really likes messing around with query strings. >
I understand that. I actually designed 3 methods: ForwardConfig.setParameter(String name, String value); ForwardConfig.setParameters(Map map); ForwardConfig.setQueryString(String query); However, I thought that the first two methods could be converted into the last one, and moreover, setParameter method seemed like setAttribute, so it also means that removeParameter may be necessary for handling parameters more delicately. From that perspective, I made up my mind that it is enough for my proposal to have one single method for setting parameters generically without adding relatively too many methods. > Btw, passing a parameter to a JSP like this almost always implies that the > JSP contains more code that it ought to in an "MVC" application. You also > said you were concerned about losing your beans when you do a redirect; > but > you really have no business redirecting to a JSP anyhow. If you can > redirect > to a JSP and have it work, that further implies too much logic in that JSP. > In contemporary Java web application development, "forward by dispatcher" mechanism is preferred and recommended in most cases. However, sometimes it is mandatory to choose redirection for users' sake. In this case, a JSP page that has presentation logics (e.g. action tags for dynamic HTML rendering) affected by a certain business logic in request scope needs an alternative to obtain data from the business logic, and passing parameters is essentially one (and maybe only) way for that. The reason why I suggested the query getter-setter method is not to compensate the loss of beans from redirection but to enable JSP to get information in an elegant manner with Struts when redirection must be performed. To summarize, JSP may have as many presentation logics dependent on results of business logics as needed, and that's not inconsistent with MVC model in my humble opinion. > With all of that out of the way, I could see your idea being useful for > forwarding/redirecting from one Action to another. > Thanks. > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
