velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel Sidler <sid...@teamup.ch>
Subject Re: getting query string params in template
Date Sat, 06 Jul 2002 04:53:18 GMT
G.L. Grobe wrote:

> Ok, after reading the description, this isn't what I'm looking for as this
> is for parsing of ServletRequest parameters and I need something that will
> allow me to make a decicion based on the ServletResponse parameter from
> withing the web page.
> 
> Any other ideas here?


What do you mean by "ServletResponse parameter"? Can you say something
about your application case? Are you working with VelocityViewServlet
or another environment?

The ParameterParser tool allows you to access form input from within
Velocity templates. You can then make decisions based on this input.

#if ( $reqParser.getInt("age") < 60 )
     ## do something
#end

If you simply need to access single-valued request parameters as strings,
you don't really need a tool. The HttpServletRequest provides all the methods
you need. You only need to make sure that the servlet request instance
is availalble from within your template. Access to request parameters
would then look something like this:

#if ( $request.getParameter("age") < 60 )
     ## do something
#end


Not sure I am addressing your question...

Gabe





> 
> ----- Original Message -----
> From: "Ed Yu" <ekyu@asgnet.psc.sc.edu>
> To: "Velocity Users List" <velocity-user@jakarta.apache.org>
> Sent: Friday, July 05, 2002 5:10 PM
> Subject: RE: getting query string params in template
> 
> 
> Here is the URL
> http://www.teamup.com/jakarta-velocity-tools/tools/docs/index.html, it
> was burried deep in the site. I believe this is a part of the struts
> integration project, not a part of the original velocity project.
> 
> 
>>-----Original Message-----
>>From: G.L. Grobe [SMTP:gary@grobe.net]
>>Sent: Friday, July 05, 2002 5:48 PM
>>To: Velocity Users List
>>Subject: Re: getting query string params in template
>>
>>I may have missed it looking on the velocity site, but can anyone tell
>>me
>>where the ParameterParser tool might be?
>>
>>Or any other way to just read a simple query string parameter off the
>>url
>>from a template page?
>>
>>----- Original Message -----
>>From: "Ed Yu" <ekyu@asgnet.psc.sc.edu>
>>To: "Velocity Users List" <velocity-user@jakarta.apache.org>
>>Sent: Friday, July 05, 2002 12:05 AM
>>Subject: RE: getting query string params in template
>>
>>
>>I believe you can use the ParameterParser tool to do the job. I think
>>you have to add the loading of it in the toolbox.xml file:
>>
>>  <tool>
>>    <key>reqParser</key>
>>    <class>org.apache.velocity.tools.tools.ParameterParser</class>
>>  </tool>
>>
>>I was testing out an earlier version and it did not. Hope this helps.
>>
>>
>>
>>>I'm sending back to the client browser a URL w/ a query string
>>>parameter that I'd like to capture in my template page ...
>>>
>>>category/products.vm?select=A
>>>
>>>So in my template page I'd like to select a #foreach loop depending
>>>upon the value of select.
>>>I saw the "Using Velocity In Servlets" section in the dev docs, but
>>>didn't think I was looking in the right place.
>>>
>>>Any help much appreciated.
>>>
>>>
>>
>>
>>
>>--
>>To unsubscribe, e-mail:
>><mailto:velocity-user-unsubscribe@jakarta.apache.org>
>>For additional commands, e-mail:
>><mailto:velocity-user-help@jakarta.apache.org>
>>
> 
> --
> To unsubscribe, e-mail:
> <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:velocity-user-help@jakarta.apache.org>
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>
> 
> 


-- 
--
Gabriel Sidler
Software Engineer, Eivycom GmbH, Zurich, Switzerland


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message