Sponsored Content
Top Forums Programming issues regarding <frameset> usage in webrick servlets, pls help Post 302288827 by wrapster on Wednesday 18th of February 2009 05:12:20 AM
Old 02-18-2009
issues regarding <frameset> usage in webrick servlets, pls help

Hi all,

Ive been trying to execute <frameset> tags within webrick servlets..
But when the server is started i get erreneous o/p ... The html code if executed individually runs flawlesswelly but inside the servlet it cribs...
Could anyone please help me out?

Quote:
#!/usr/bin/ruby -w

require 'webrick'
include WEBrick

s = HTTPServer.new(:Port => 9000)
class Test < HTTPServlet::AbstractServlet
def do_GET(req,res)
res['Content-Type'] = 'text/html'
res.body = test
end

def test
html ="<html"
html +="<frameset cols='30%, 80%'>"
html +="<frame src='contents_of_frame1'> "
html +="<frame src='contents_of_frame2.gif'>"
html +="</frameset></html>"
end
end

trap("INT") {s.shutdown}
s.mount('/', Test)
s.start
 

9 More Discussions You Might Find Interesting

1. Programming

Monitor CPU usage and Memory Usage

how can i monitor usages of CPU, Memory, Hard disk etc. under SUN Solaries through a c program or java program i want to store that data into database so i can show it graphically thanks in advance (2 Replies)
Discussion started by: Gajanad Bihani
2 Replies

2. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

3. Solaris

current CPU usage, memory usage, disk I/O oid(snmp)

Hi, I want to monitor the current cpu usage, monitor usage , disk I/o and network utlization for solaris using SNMP. I want the oids for above tasks. can you please tell me that Thank you (2 Replies)
Discussion started by: S_venkatesh
2 Replies

4. Web Development

how to pass data in webrick sevelts? please help

Hi all, I am a newbie to servlet programming using webrick... Was wondering how to accept data from a form and do necessary processing.. To start with i wrote a sample servlet that accepts a name and prints "welcome <name>" But I do not know how to take this value from the form into the... (0 Replies)
Discussion started by: wrapster
0 Replies

5. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

6. Shell Programming and Scripting

"frameset" in bash?

Hi everyone, I am just wondering, is there any way to do something like put text on line 1 of the terminal window and then set the window's display to start at line 2, so that the text in line 1 is always on the screen? -patrick (1 Reply)
Discussion started by: patrick99e99
1 Replies

7. UNIX for Dummies Questions & Answers

Command to display the space usage (memory usage) of a specific directory.

Hi all, Can you please tell me the command, with which one can know the amount of space a specific directory has used. df -k . ---> Displays, the amount of space allocated, and used for a directory. du -k <dir name> - gives me the memory used of all the files inside <dir> But i... (2 Replies)
Discussion started by: abhisheksunkari
2 Replies

8. UNIX for Dummies Questions & Answers

Memory usage per user,percent usage,sytem time in ksh

Let's say i have 20 users logged on Server. How can I know how much memory percent used each of them is using with system time in each user? (2 Replies)
Discussion started by: roy1912
2 Replies

9. Web Development

Problems starting webserver (WEBRick) on Rails

Good afternoon: I need your help please: Im new at web applications and i started taking a Ruby on Rails course and as a part of the installations i followed the instructions given on page: http://railsapps.github.io/installrubyonrails-ubuntu.html I followed every step and id did not yield... (6 Replies)
Discussion started by: alexcol
6 Replies
HTML::Template(3ruby)													     HTML::Template(3ruby)

NAME
HTML::Template - Ruby extension for HTML::Template DESCRIPTION
This module deals with HTML template by CGI scripts and use a complete selectivity between design and logic easily. You can deal with a nested block, a loop and a conditional expression. Simple example, see below. template file test.html <HTML> <HEAD><TITLE>Test Template</TITLE> <BODY> My Home Directory is <!var:home> <P> My Path is set to <!var:path> </BODY> </HTML> Ruby script require "html/template" tmpl = HTML::Template.new("./test.html") tmpl.param({ 'home' => ENV['HOME'], 'path' => ENV['PATH'] }) print "Content-Type: text/html " print tmpl.output INSTALL
using install.rb % tar xvzf html-template-x.xx.tar.gz % cd html-template-x.xx % ruby install.rb config % ruby install.rb setup % su # ruby install.rb install Template File TAGS
You can use original style tag or valid HTML comment style tag. <!var:PARAMETER_NAME> <!-- var:PARAMETER_NAME --> When you call HTML::Template#param ({PARAMETER_NAME => VAL}), tags will be simply replaced to VAL. <!begin:PARAMETER_NAME> <!end:PARAMETER_NAME> <!-- begin:PARAMETER_NAME --> <!-- end:PARAMETER_NAME --> It allows you to separate a section of text and give it a name It would be able to make them loop or conditional expression. And, it can be nested. <!include:FILE_NAME> <!-- include:FILE_NAME --> A file specified by FILE_NAME is simply inserted to a template file. The template file will be treated as a merged template. If you pass the path param to HTML::Template.new , include file will be searched under the path. HTML
::Template CLASS CLASS METHODS
HTML::Template.new(params = {}) Creates a HTML::Template object. Given a file name to its first argument, use this file as a template. Also you can pass params as Hash. The options are below o filename template filename o path template search path. you can specified as String or Array of String. METHODS
HTML::Template#load(file) Load template file. HTML::Template#set_html(html) Setting up a string as a template. HTML::Template#param(hash = {}) HTML::Template#expand(hash = {}) Specifies a string or a loop by Hash for a substitute. When specifying more than a loop simultaneously, value of the hash becomes an array. HTML::Template#node(name) HTML::Template#loop(name) HTML::Template#cond(name) Stands a loop and a conditional expression specified by <!begin:name><!end:name> Retrieves HTML::TemplateNode object. HTML::Template#output HTML::Template#to_s Returns the final result. HTML
::TemplateNode CLASS This is a class for a loop or a conditional expression. An instance consists of HTML::Template Class and HTML::TemplateNode CLASS. METHODS
HTML::TemplateNode#node(name) Stands a loop or a conditional expression specified by <!begin:name><!end:name> Returns HTML::TemplateNode object. Is only used for nested. HTML::TemplateNode#param(hash = {}) HTML::TemplateNode#expand(hash = {}) HTML::TemplateNode#add(hash = {}) Specifies a string or a loop by Hash for a substitute. If you don't call the method, the block won't be displayed. A LOOP
This sample is a displaying list of environment valiables. <html> <body> <h1>Env List</h1> <hr> <!begin:envlist> <!var:key> : <!var:val><br> <!end:envlist> <hr> </body> </html> # In case of using it with iterator and replace data. require "html/template" tmpl = HTML::Template.new("filename" => "envlist.html") ENV.keys.sort.each do |k| tmpl.node("envlist").param({'key' => k, 'val' => ENV[k] }) end print "Content-Type: text/html " print tmpl.output # In case of giving a loop as an array require "html/template" tmpl = HTML::Template.new("envlist.html") envlist = [] ENV.keys.sort.each do |k| envlist.push({'key' => k, 'val' => ENV[k] }) end tmpl.param({'envlist' => envlist}) print "Content-Type: text/html " print tmpl.output A Conditional Expression <html> <body> <!begin:true> This is True <!var:foo> <hr> <!end:true> <!begin:false> This is False <!var:foo> <hr> <!end:false> </body> </html> require "html/template" tmpl = HTML::Template.new("cond.html") tmpl.param({'true' => {'foo' => 'foobar'} }) print "Content-Type: text/html " print tmpl.output The performed result is below, however, a part not specied with the method isn't displayed. <html> <body> This is True foobar <hr> </body> </html> An attached Sample. env.rb This sample is a simply replacing valiables. envlist.rb This sample is a displaying list of environment valiables. This sample is a case for using with iterator. envlist2.rb Performed result is the same as the envlist.rb.'s. nest.rb A sample of a nested loop. THANKS
English Documentation NAKAYAMA Nao <nao_o@netlaputa.ne.jp> thanks a lot :-) AUTHOR
Copyright 2001 IKEBE Tomohiro This library is free software; you can redistribute it and / or modify it under the same terms as Ruby itself. IKEBE Tomohiro <ikechin@Oxfa.com> June 2002 HTML::Template(3ruby)
All times are GMT -4. The time now is 05:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy