velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Loy <paul....@peoplesarchive.com>
Subject Re: How to pass values between velocity and servlet
Date Thu, 12 Oct 2006 15:50:46 GMT
yeah, that's exactly it... of course you need to check it's not null and 
it will always be a string. If you want a number you'll have to parse it 
into an integer (or double) yourself.


erica_ren@pch.gc.ca wrote:
> Thank you all, that's what I'm looking for. Sorry about the confusion but 
> this is my first time using velocity, but how to do you tell the servlet 
> to pick up the URL parameter? If I have this parameter in my velocity 
> template $number, and parse it to URL http://server.jsp?number=something, 
> will the servlet just recognize this parameter if I assign a variable say 
> String number = request.getParameter("number")?
>
> Erica Ren
> Developer, Technical Operations / Opérations techniques
> E-Services Branch / Cyber Services 
> Canadian Heritage / Patrimoine canadien
>
> Room 26B, 8th Floor, 15 rue Eddy
> Gatineau, Québec 
> K1A 0M5
> 819.956.2179
>
>
>
>
>
>
> Barbara Baughman <baughman@utdallas.edu> 
> 12/10/2006 11:38 AM
> Please respond to
> "Velocity Users List" <velocity-user@jakarta.apache.org>
>
>
> To
> Velocity Users List <velocity-user@jakarta.apache.org>
> cc
>
> Subject
> Re: How to pass values between velocity and servlet
>
>
>
>
>
>
> If you're using a hyper link to a servlet, can you add the parameters
> with the URL? You can save whatever information you need to pass to
> Velocity from the current session as a session attribute.  As long as
> the servlet is in the same web application, the session attributes
> will be there.  Tomcat also lets you share session attributes among
> applications within the same instance of Tomcat.
>
> http://server/app?parameter=something
>
> Barbara Baughman
> X2157
>
> On Thu, 12 Oct 2006 erica_ren@pch.gc.ca wrote:
>
>   
>> I thought about that but unfortunately the value has to be passed even 
>>     
> if
>   
>> users don't use the form. But I can't put it in a separate form 
>>     
> either...
>   
>> Erica Ren
>> Developer, Technical Operations / Opérations techniques
>> E-Services Branch / Cyber Services
>> Canadian Heritage / Patrimoine canadien
>>
>> Room 26B, 8th Floor, 15 rue Eddy
>> Gatineau, Québec
>> K1A 0M5
>> 819.956.2179
>>
>>
>>
>>
>>
>>
>> Paul Loy <paul.loy@peoplesarchive.com>
>> 12/10/2006 11:07 AM
>> Please respond to
>> "Velocity Users List" <velocity-user@jakarta.apache.org>
>>
>>
>> To
>> Velocity Users List <velocity-user@jakarta.apache.org>
>> cc
>>
>> Subject
>> Re: How to pass values between velocity and servlet
>>
>>
>>
>>
>>
>>
>> can you not just use the same form - just add a hidden field!
>>
>> erica_ren@pch.gc.ca wrote:
>>     
>>> Hi,
>>>
>>> I have a parameter on a velocity template which I need to pass to my
>>> servlet to do some calculation, and then pass it back to the velocity
>>> template for rendering new content. I'm already using a form filter
>>> through HTTPRequest so I cannot use another form to pass on the data.
>>>       
>> The
>>     
>>> idea is to make it a hyperlink instead.  Is there a way to do it 
>>>       
> without
>   
>>> sending it through a form? Thank you.
>>>
>>> Erica
>>>
>>>
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
>
>   


This email has been scanned by Postini.
For more information please visit http://www.postini.com

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