aspose file tools*
The moose likes Portals and Portlets and the fly likes How to access RenderRequest in a custom Tag? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "How to access RenderRequest in a custom Tag?" Watch "How to access RenderRequest in a custom Tag?" New topic
Author

How to access RenderRequest in a custom Tag?

Rohit Lal
Greenhorn

Joined: Sep 25, 2003
Posts: 20
Hi All,

I've mentioned this problem in a previous posting - I can't seem to get a working example of Struts with JSR-168 portlets. Someone suggested the MVCPortlet framework, but then it's got it's own learning curve. The result is that I'm having to work on the JSP bit without the wonderful Struts tags. I'm having to use for loops and whatnot inside the JSPs - messy. I'm not familiar with JSF and I'm not sure if I should start learning that in an effort to get pre-defined tag libraries for use in portlet JSPs.

So the option I considered was to make my own custom tags and use them for the various dynamic stuff we have on JSPs. A problem crops up: My javabean object with all my form-field values and success/error messages is in the PortletSession object which can be accessed through the 'renderRequest' object on the JSP which is available after placing the <portlet efineObjects/> tag.

I can access renderRequest on the JSP - but how do I access it in the custom tag? Am I on the right track? Is it even possible to use portlet JSPs
with custom tags that need to access portlet-driven information thru the renderRequest object?

Rohit Lal


Rohit Lal<br />SCPJ2 (2000)
Stefan Zoerner
Author
Ranch Hand

Joined: Nov 29, 2001
Posts: 121
Rohit,

just a few ideas:

1) I would recommend to use JSTL tags instead of implementing your own custom tags for loops etc. they work quite well in conjunction with JSR 168 and JSP, and you may use them within Struts WebApps, too (learning effort).

2) A quite easy way to offer your Java objects in the JSP, if stored in the portlet session (portlet scope), is to put them as an attribute in the render request as well (in your doView etc. method, before including the JSP). This way you can get them as an attribute from the normal implicit object "request" in the JSP, and you do not need renderRequest for that.
Another advantage is that you can access them easily from JSTL tags with its EL-expressions.

3) It is possible to access the render request from within a custom tag class. I am not sure whether I should recommend to do so in your case(see 1 + 2) but you can. See Java Portlet Specification PLT.16.3.2 for details (it is advertised as request attribute with standardized key).

Greetings,
Stefan


Stefan Zoerner
Author of German LDAP-Book
Committer at Apache Directory Project
Rohit Lal
Greenhorn

Joined: Sep 25, 2003
Posts: 20
Thanks Stephan,

I'll work on your tips and let you know as soon as I achieve some milestone.

Thanks for your advice.

Best regards,

Rohit
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to access RenderRequest in a custom Tag?
 
Similar Threads
Query on Custom Tags
Custom Portlet modes
Websphere Portal - Test 399
Error: renderRequest cannot be resolved
taglib book