Components are for tags On Thu, Jun 11, 2009 at 9:32 AM, Martin Gainty<[email protected]> wrote: > > one of your UI beans can extend org.apache.struts2.components.Component e.g. > > public class MyBean extend org.apache.struts2.components.Component { > javax.servlet.ServletOutputStream stream; > javax.servlet.http.HttpServletResponse res; > > then > @Override > protected String determineActionURL(String action, String namespace, > String method, > HttpServletRequest req, > HttpServletResponse res, Map parameters, String scheme, > boolean includeContext, boolean > encodeResult, boolean forceAddSchemeHostAndPort, > boolean escapeAmp) { > this.res = res; > try > { > stream=res.getOutputStream(); > } > catch(java.lang.Exception excp) > { > log.debug("OutputStream is null"+excp.getMessage()); > } > String finalAction = findString(action); > String finalMethod = method != null ? findString(method) : method; > String finalNamespace = determineNamespace(namespace, getStack(), req); > ActionMapping mapping = new ActionMapping(finalAction, finalNamespace, > finalMethod, parameters); > String uri = actionMapper.getUriFromActionMapping(mapping); > return UrlHelper.buildUrl(uri, req, res, parameters, scheme, > includeContext, encodeResult, forceAddSchemeHostAndPort, escapeAmp); > } > ....... > } > > http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletResponse.html#getOutputStream() > > y/n? > Martin > ______________________________________________ > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité > > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger > sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung > oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich > dem Austausch von Informationen und entfaltet keine rechtliche > Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen > wir keine Haftung fuer den Inhalt uebernehmen. > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le > destinataire prévu, nous te demandons avec bonté que pour satisfaire informez > l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci > est interdite. Ce message sert à l'information seulement et n'aura pas > n'importe quel effet légalement obligatoire. Étant donné que les email > peuvent facilement être sujets à la manipulation, nous ne pouvons accepter > aucune responsabilité pour le contenu fourni. > > > > >> Date: Thu, 11 Jun 2009 11:59:30 -0400 >> Subject: Re: [OT]Moving from Struts2 to grails, your thoughts >> From: [email protected] >> To: [email protected] >> >> On Thu, Jun 11, 2009 at 11:53 AM, Bhaarat Sharma<[email protected]> wrote: >> > This might be too simple ...but how will i get the outputstream? >> > lets say I have something like this >> > >> > if (addNewQuestion () == 1) >> > { >> > String numQsAdded = "<div >> > id='message1'>"+getQuestion().substring(1, >> > getQuestion().length())+"</div>"; >> > //I want to put numQsAdded into a outputstream >> > return NONE; >> > } >> > >> > >> > my action is implementing ServletRequestAware so I have access to >> > the HttpServletRequest request >> > >> >> >> The OutputStream usually comes from the response (since you are >> responding). I think you might be able to pull the ServletResponse out >> of the ActionContext if you don't want to implement the interfaces. >> >> -Wes >> >> >> >> -- >> Wes Wannemacher >> Author - Struts 2 In Practice >> Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more >> http://www.manning.com/wannemacher >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > _________________________________________________________________ > Windows Live™ SkyDrive™: Get 25 GB of free online storage. > http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009
-- "Hey you! Would you help me to carry the stone?" Pink Floyd --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

