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 Using Anchor Component for creating custom anchor tag
Date Tue, 24 Mar 2009 16:15:29 GMT
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.


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