struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manoj Dhore" <manoj.dh...@sword-soft.com>
Subject RE: Using Anchor Component for creating custom anchor tag
Date Wed, 25 Mar 2009 09:00:27 GMT
Hi Martin

Yes, I have  insured that the stack, request and response objects are
not null.

Here is an extract of mergeTemplate function in Anchor class. I tried
setting the template as well before initializing Anchor object but no
luck.

========================================================================
====
protected void mergeTemplate(Writer writer, Template template) 
throws Exception {
 final TemplateEngine engine =
templateEngineManager.getTemplateEngine(template, templateSuffix);
           if (engine == null) {
             throw new ConfigurationException("Unable to find a
TemplateEngine for template " + template);
        }

	          if (LOG.isDebugEnabled()) {
            LOG.debug("Rendering template " + template);
        }

        final TemplateRenderingContext context = new
TemplateRenderingContext(template, writer, getStack(),
getParameters(), this);
     engine.renderTemplate(context);
}

========================================================================
====

Manoj
-----Original Message-----
From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: 24 March 2009 19:38
To: Struts Users Mailing List
Subject: RE: Using Anchor Component for creating custom anchor tag


Have you verified the Anchor Tag's 3 required parameters stack, request,
response are initialised properrly and non null before constructing the
anchor tag
?
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
This message is confidential and may be privileged. If you are not the
intended recipient, we kindly ask you to  please inform the sender. Any
unauthorised dissemination or copying hereof is prohibited. This message
serves for information purposes only and shall not have any legally
binding effect. Given that e-mails can easily be subject to
manipulation, we can not accept any liability for the content provided.






> Subject: Using Anchor Component for creating custom anchor tag
> Date: Tue, 24 Mar 2009 16:15:29 +0000
> From: manoj.dhore@sword-soft.com
> To: user@struts.apache.org
> 
> Hi,
> 
>  
> 
>  I am trying to create a custom anchor component using
> org.apache.struts2.components.Anchor. This is done inside a custom
> component that I am creating.
>  
> Method that initializes Anchor component is as follows :
>  
> 
>       private void createLink(String action, Containable item, Writer
> writer) {
> 
>        
> 
>  Component a = createAnchor(action, item);
> 
>        a.start(writer);
> 
>        a.end(writer, item.getName());
> 
>         }
> 
>  
> 
> private Anchor createAnchor(String action, Containable item){
> 
> Anchor a = new Anchor(stack, req, resp);
> 
> a.setHref(action);
> 
> return a;
> 
> }
>  
> However, if my code tries to create a link I get follwing error :
>  
> 
> java.lang.NullPointerException
> 
>       at
> org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:549)
> 
>       at
>
org.apache.struts2.components.ClosingUIBean.start(ClosingUIBean.java:59)
> 
>       at
>
com.poc.struts2.component.FolderBrowserComponent.createLink(FolderBrowse
> rComponent.java:70)
> 
>       at
>
com.poc.struts2.component.FolderBrowserComponent.processItem(FolderBrows
> erComponent.java:116)
> 
>       at
>
com.poc.struts2.component.FolderBrowserComponent.start(FolderBrowserComp
> onent.java:58)
> 
>       at
>
org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTag
> Support.java:53)
> 
>       at
>
org.apache.jsp.Folderbrowser_jsp._jspx_meth_bol_005ffolderbrowser_005f0(
> Folderbrowser_jsp.java:145)
> 
>       at
>
org.apache.jsp.Folderbrowser_jsp._jspService(Folderbrowser_jsp.java:90)
> 
>       at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
> 
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> 
>       at
>
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
> va:374)
> 
>       at
>
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
> 
>       at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
> 
>         at
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>  
> 
> Could you please guide me what is the problem with template ? Do I
need
> to create a custom template or need to set a default template ?
> 
>  
> 
> Thanks in advance.
> 
>  
> 
> Regards,
> 
>  
> 
> Manoj Dhore
> 
>  
> 
>  
> 
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _
> 
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom
> they are addressed.
> If you have received this email in error please notify the
> originator of the message. This footer also confirms that this
> email message has been scanned for the presence of computer viruses.
> 
> Any views expressed in this message are those of the individual
> sender, except where the sender specifies and with authority,
> states them to be the views of Sword Intech.
> 
> Scanning of this message and addition of this footer is performed
> by Websense Email Security software in conjunction with 
> virus detection software.
> 

_________________________________________________________________
Express your personality in color! Preview and select themes for
Hotmail(r).
http://www.windowslive-hotmail.com/LearnMore/personalize.aspx?ocid=TXT_M
SGTX_WL_HM_express_032009#colortheme
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom
they are addressed.
If you have received this email in error please notify the
originator of the message. This footer also confirms that this
email message has been scanned for the presence of computer viruses.

Any views expressed in this message are those of the individual
sender, except where the sender specifies and with authority,
states them to be the views of Sword Intech.

Scanning of this message and addition of this footer is performed
by Websense Email Security software in conjunction with 
virus detection software.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message