velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Malcolm Edgar <malcolm.ed...@gmail.com>
Subject Re: How to display template output in a pop-up window
Date Mon, 16 May 2011 11:02:03 GMT
Hi Anne,

This is more of a JavaScript HTML question than a Velocity templating
engine. If you google search you will find your answer pretty quickly.

http://www.w3schools.com/jsref/met_win_open.asp
http://www.javascript-coder.com/window-popup/javascript-window-open.phtml

Anyway what you are after is using the JavaScript window.open
function.  To open a window after you render a page you will need to
have a JavaScript function call the window.open function when the page
loads. Please note browsers may prevent this from working, via their
popup blockers so your results may be mixed.

regards Malcolm Edgar

On Mon, May 16, 2011 at 8:00 PM, Anne Peter <nnptr67@gmail.com> wrote:
> Hi Tim,
>
> On Mon, May 16, 2011 at 2:23 PM, Tim Pizey <timp@paneris.org> wrote:
>
>> On 16 May 2011 09:14, Anne Peter wrote:
>> > Hi,
>> >
>> > I am very new to Velocity and I tried with few samples by writing
>> Servlets
>> > extending VelocityViewServlet and implementing the handleRequest(). This
>> > method displays the output in a new page.
>> >
>> > But my requirement is:
>> > When a button on a JSP is clicked, the template should get processed &
>> > merged and the output of the template should be shown in a popup window.
>> > (i.e: the parent window should display the same content as earlier & the
>> > form should be shown in a popup).
>> >
>> > I would like to know how can I achieve this.
>>
>> Make your velocity servlet produce the content of the popup.
>>
>> In your calling page:
>>
>> <a href="myPopupservlet" target="_new">
>>
>>
>>
> This works; but opens the content of the form in a new tab/window.
> What I actually want is a javascript  pop up that shows in-front of the
> browser, showing the content (for which I can set the pop up window
> width,height etc).
> I think the *href *resource should be to a javascript function which calls
> the velocity servlet. Is it possible to call the velocity servlet inside a
> javascript function and show the contents in a pop up?
>
>
> Thanks,
> Anne
>
>
>
>>
>>
>> --
>> Tim Pizey
>> http://pizey.net/~timp
>>
>

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


Mime
View raw message