• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to use WriteTag (bean:write) within Custom Tag

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I am trying to write a custom tag in which I am trying to use the <bean:write..> tag's class so that it would actually generate the bean:write when my custom tag is used. The way I am doing it is something like this in my custom tag's doStartTag() method:
WriteTag wt = new WriteTag();
wt.setName("user_rec");
wt.setProperty("userName");
wt.doStartTag();
wt.doEndTag();
wt.release();

The user_rec is set in my request (using request.setAttribute). Is it possible to do soemthig like this? if yes, how as I keep getting an exception when I try to use somethig like this. This is what I get:

Exception thrown in MyCustTag::java.lang.NullPointerException

It seems like it dosen't find the user_rec in the request but I tried getting it out and printing the values from it just before this and it worked fine so I am a bit confused as to what I am missing?

Any help would be appreciated.

Thanks,
Kushal
reply
    Bookmark Topic Watch Topic
  • New Topic