permaculture playing cards*
The moose likes JSP and the fly likes JSP markup reuse and request parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP markup reuse and request parameters" Watch "JSP markup reuse and request parameters" New topic
Author

JSP markup reuse and request parameters

Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
I'm pretty new to JSPs.
I've some JSP markup, which makes use of attributes in the HttpServletRequest, that I'd like to repeat accross multiple JSPs.
I just started looking into creating a custom tag library, but I don't see a way to get HttpServletRequest attributes from the doStartTag method. Can this be done? Or is there some other way to pass values from the JSP that uses the custom tag to the associated TagSupport methods?
[ July 11, 2003: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61457
    
  67

Within the tag you can access the request from the pageContext object: pageContext.getRequest().
It returns a ServletRequest so you'll need to cast it to an HttpServletRequest.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
I was a thinkin' about lookin' harder at that pageContext thingy.
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP markup reuse and request parameters