Servlets: Scrolling a html page

I have a servlet that generates a page with edit buttons,
rows, columns etc. When the edit button is pressed it
allows the current row to be edited (hence the name edit button ;). The problem is, when I press a button way down on the bottom of the page (scrollable) it works as it should (opens a html textfield(?) on the row) but the drawback is, that the page is hiked up and you have to scroll down and find the edit row. So is there a way I can scroll it down automatically near the edit row?
Thank you

Have I understod correctly?
When you press the button the servlet generates a new page with the textfield.
You call the servlet something like this in the button: www.site.com/servlet/theServlet.
Then call it as www.site.com/servlet/theServlet#here and insert <a name="here"> before the textfield in the generated page (in the servlet code).

Similar Messages

  • Calling a servlet in a HTML page

    hi evryone,
    I'm new to servlets so i'm trying to create some simple applications to understand how it all works. The thing i'm trying to do is calling a servlet in a HTML page. I've already installed a Tomcat web server and I've created a servlet called Hello.
    public class Hello extends HttpServlet{
         public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{
              res.setContentType("text/html");
              PrintWriter out = res.getWriter();
              String name = req.getParameter("name");
              out.println("<HTML>");
              out.println("<HEAD><TITLE>Hello, " + name + "</TITLE></HEAD>" );
              out.println("<BODY>");
              out.println("Hello, " + name);
              out.println("</BODY></HTML>");
         public String getServletInfo(){
              return "testing servlet OK";
    }In my HTML page I've written the follwing code:
    <HTML>
    <HEAD>
    <TITLE>Just say hello</TITLE>
    </HEAD>
    <BODY>
    <FORM METHOD=POST ACTION="../servlet/Hello">
    What's your name?
    <INPUT TYPE=TEXT NAME="name"><P>
    <INPUT TYPE=SUBMIT>
    </FORM>
    </BODY>
    </HTML>After running this HTML I get a text box and I thing I'm trying to do is, when I click on the button, the servlet will be loaded. However, the servlet can't be found and instead I get an error:
    type Status report
    message /servlet/Hello
    description The requested resource (/servlet/Hello) is not available.
    I suppose both file are in their approriate directories, but my class file still has the class extension. Do I need to change this? I hope that someone can help me.
    Thanks in advance!

    hi,
    the servlet wasn't in a package, so I changed that. It seems that I get an other error now:
    HTTP Status 503 - Servlet servlet/Hello is currently unavailable
    type Status report
    message Servlet servlet/Hello is currently unavailable
    description The requested service (Servlet servlet/Hello is currently unavailable) is not currently available.
    I still don't know what I may have forgotten, so i'm gonna resume what i have done till now.
    the servlet: (Hello.class)
    package servlet;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Hello extends HttpServlet{
         public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{
              res.setContentType("text/html");
              PrintWriter out = res.getWriter();
              String name = req.getParameter("name");
              out.println("<HTML>");
              out.println("<HEAD><TITLE>Hello, " + name + "</TITLE></HEAD>" );
              out.println("<BODY>");
              out.println("Hello, " + name);
              out.println("</BODY></HTML>");
         public String getServletInfo(){
              return "test servlet OK.";
    }the HTML page (testServlet.html)
    <HTML>
    <HEAD>
    <TITLE>Just say hello</TITLE>
    </HEAD>
    <BODY>
    <FORM METHOD=GET ACTION="../servlet/Hello">
    What's yoir name?
    <INPUT TYPE=TEXT NAME="name"><P>
    <INPUT TYPE=SUBMIT>
    </FORM>
    </BODY>
    </HTML>the web.xml file
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
      <display-name>Welcome to Tomcat</display-name>
      <description>
         Welcome to Tomcat
      </description>
    <servlet>
    <servlet-name>servlet/Hello</servlet-name>
    <servlet-class>servlet/Hello</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>servlet/Hello</servlet-name>
    <url-pattern>/servlet/Hello</url-pattern>
    </servlet-mapping>
    </web-app>paths of these files:
    - Hello.class => D:\Tomcat 4.1\webapps\ROOT\servlet
    - testServlet.html => D:\Tomcat 4.1\webapps\ROOT\more
    ( - web.xml => D:\Tomcat 4.1\webapps\ROOT\WEB-INF)
    Thanks for your help!!!

  • Servlet to call html page

    how would you publish html pages on the web. so far the html page that comes up is accessed from my hard drive ie it has H: in the URL address. can i avoid this happening?
    any help is very much appreciated.

    there is one other problem though. on the first html page there are 3 radio buttons and a submit button. depending on which radio button is selected, once the form is submitted it will take you to a particular html page.
    once submitted it goes to the servlet with the value and name of the chosen radiobutton.
    on the servlet side i have coded 'if' statements to identifiy which radio button has been chosen. from this it is to go to a sepcific page. however, from here i do i call the html page. the part of the code is below:
    if(value.equals("Lectures"))
    out.println("LECTURES");
    out.println("<HTML>");
    out.println("<HEAD><TITLE>Student's Information System</TITLE>");
    out.println("<script language=JavaScript><!--function methodRetrieve(){ document.myform.submit();}</script>");
    out.println("<script language=JavaScript><!--function methodEnterEdit(){ document.myform.submit();}</script>");
    out.println("</HEAD>");
    out.println("<BODY><FORM name=LECmyform METHOD=GET ACTION=http://brunhilde.dcs.qmul.ac.uk/~rkj1/tomcat/servlet/Lecture target=_top>");
    out.println("<H1><p ALIGN=CENTER>Lecture Attendance Records</H1>");
    out.println("Select one of the following:<BR><BR>");
    out.println("<SELECT name=subjectMenu>");
    out.println("<OPTION value=CS3>Computer Systems 3");
    out.println("<OPTION value=GUI>Graphical User Interface");
    out.println("<OPTION value=DLD>Digital Logic Design");
    out.println("<OPTION value=DRA>Decision Risk Analysis");
    out.println("</SELECT><BR><BR>");
    out.println("<INPUT TYPE=button name=theButton VALUE=Retrieve Attendance Records &gt><BR><BR>");
    out.println("<INPUT TYPE=button name=theButton VALUE=Enter/Edit Attendance Figures &gt><BR><BR>");
    out.println("</FORM></BODY></HTML>");
    this is just a rough html page but the actual page contains a lot more html and would be too silly to go about out.println it all in the servlet. is there a method that i can call from this if statement to call a html page?
    please help me if you can since i've been trying this for a while...
    thanks
    gina

  • Embedded swf "jumping" when scrolling an html page

    Hello!
    I have created a banner file in Flash and when embedding an swf file on the html page the swf banner appears to be "jumping" up and down when the page is longer and needs to be scrolled. This only happens when scrolling the page.
    I put up an example here:
    www.selkografiikka.com/test/coaching4.html
    You can see the black swf box jumping towards the red dots when scrolling.
    This turns out to be a problem on a website I'm working with since it's creating a rather nervous vibe to the whole feel of the site - example here:
    http://www.selkografiikka.com/tindra/index.htm
    Any ideas what's causing this?
    I am using Dreamweaver and Flash cs3.
    It seems to be a problem in all the browsers.

    Thank you Jon and Nancy for your replies.
    Sorry it took me a little while to figure out how to reply here.
    I’m happy this is not a problem on each computer according to your replies.
    I believe Java Script would be more up to date way of doing this, but the original idea was more complicated – with animated text and such so that’s why flash. I thought just to make a static picture that will show in ipads and such when flash is not supported.
    I can still see that jumping thing although I updated my flash player and otherwise have just the same browser versions as Jon.
    I might consider switching the animation part to javascript animation.
    Thank you guys!
    Liisa

  • Possible to make servlet look like html page?

    Is it possible to register a servlet so that it looks like an html page?
    for example the servlet "HelloWorld", I want to make it look
    like "HelloWorld.html".

    What you need to do is configure your web server / servlet engine to pass EVERY request for a .html file to a servlet. This is typically done by passing the requests to a router servlet, which then reads the request URI, and then instantiates a servlet based on the desired file name. Therefore, if your requests goes to "HelloWorld.htm", the router would instantiate the class "HelloWorld", probably by calling Class.forName("HelloWorld"), and then call its doService(), doPost(), or doGet() methods.

  • Problems calling Java Servlets from HTML pages Online

    Hello
    I have created a Web site using Java Servlets, and have acquired some servlet enabled web-space however i am having some difficulty in calling the actual servlets from the HTML pages i was using the line of code as follows
    http://localhost:8080/servlet/....
    followed by the name eg.
    http://localhost:8080/servlet/Login
    however this doesn't seem to be working i have also tried using the exact address of the servlet but this didn't work either
    i.e ..servlet/Login.java
    I was wondering would anyone have any idea as in how the servlets should be called
    Thanks very much

    Once you write the Servlet code, you have to compile and put the classes in the server classpath. To refer these servlets from your pages, you have to configure them in the server configuration(typical a xml file). There you define how you are going to refer to the servlet(/servlet/Logon) and the correponding class.
    -Mak

  • How can I generate a html page in a servlet-applet connection?

    Hello, I have an applet which contains an ok button, when I click this button, I need that servlet generate an html page and view it in browser. How can I do this?
    Thanks

    But with this method only is possible I think open a page web, and if it is possible call url of the servlet, you generate other request and response object (other call to method doGet or doPost because ShowDocument needs parameter url), so the previously request when I click button ok it's no the same and how I obtain the prinwriter from first request, showDocument don't obtain html page from printwriter.

  • How to call a html page from servlet

    i want to link a servlet to a html page, if i use requestdispatcher, it says XXX.html is not available, can anybody help

    Can you be more specific about what you're trying to do? Can't read your mind =). But if you mean you want to just have an static HTML page such as a header read by the servlet you can you the requestdispatcher include().
    Create a servlet to generate a page, and then map it as /getPage in the web.xml file. Then you can use:
    // header
    RequestDispatcher rd = ...getRequestDispatcher("/getPage");
    rs.include(req, res);
    // the rest of the servlet output
    // and you can do another one for the footer down here
    rd = ...getRequestDispatcher("/getPageFooter");
    rs.include(req, res);
    and it'll output the HTML in the servlet.
    Hope this helps

  • Servlet showing HTML page

    I ma using Tomcat as standalone server.
    have servlet showing HTML page which has frames in it . All frames are linked to some html pages. These pages are stored in
    webapps/project directory and servlet is in
    \Tomcat 4.1\webapps\Project\WEB-INF\classes
    Tomcat can show the servlet with al frames witherror402 means it is unable to take html pages from webapps/project
    what's wrong
    my codes are
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Htmlservlet extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<HTML>\n"+
    "<HEAD> <TITLE>A frameset document</TITLE></HEAD>\n"+
    "<FRAMESET rows= \"20%,40%,40%\" >" +
    "<FRAME src=\"contents_of_frame3.html\" frameborder=\"0\" scrolling =\"no\">"+
      "<FRAMESET cols=\"*,200\">"+
          "<FRAME src=\"contents_of_frame1.html\" scrolling=\"no\">"+
          "<FRAME src=\"contents_of_frame2.gif\" >"+
    "</FRAMESET>"+
      "<FRAME src=\"contents_of_frame4.html\" frameborder=\"0\"> </FRAMESET>"+
    "</HTML>");
    }

    Hi,
    Please please try this
    <FRAME src=\"/contents_of_frame1.html\"
    thanks,
    nvseenu

  • Can I use data from Servlet in my static html page?

    First of all, I can NOT use jsp because of web server's restriction.
    I have a servlet which will give me some image links in html file via doGET and doPOST method. I also need the sizes of the images and compress the images if too large.
    My question is how I can pass the image sizes to the html page and how I can use them in html files.
    Please advise me some solutions to this problem.

    Yeah, you have 2 choices:
    1) Change your web server to one that allows JSP.
    2) Re-build the JSP system from scratch so that the one you make will work in your server. This would involve changing your so called static HTML to have markings (like <% %> tags) where you should insert the values you need to insert. You would then have a servlet that reads the 'static' HTML, parses our the insertion tags, and inserts the values. It would then stream the results back to the user.
    Of course, your HTML is not really static, it is dynamic because the values you are inserting are capable of changing.
    If you don't want to upgrade the server to one that supports JSPs (if yours really doesn't), the have fun making your own system.

  • How can I display the HTML page from servlet which is called by an applet

    How can I display the HTML page from servlet which is called by an
    applet using the doPost method. If I print the response i can able to see the html document. How I can display it in the browser.
    I am calling my struts action class from the applet. I want to show the response in the same browser.
    Code samples will be appreciated.

    hi
    I got one way for this .
    call a javascript in showDocument() to submit the form

  • Inserting Image on a HTML page through servlet

    I want to insert an image on a HTML page which will be generated by a servlet.For that I have written the <IMG SRC>tag.But my doubt is where to store the image(i.e in which directory of the web server) I should store the Image.I am using JavaWebServer2.0.
    please help

    You can put your images in public_html directory.

  • How to set a value to an  existing element in  html page using servlets

    i have created a session in my login page and i know how to retrieve it now the actual problem is i want to set the same value to a textbox in an html page........

    Use JSTL and/or EL.
    Assuming that you mean with "created a session" that you've created a bean and have set it as an attribute of the HttpSession, e.g.httpSession.setAttribute("someBean", someBean);then do for example using the JSTL c:out tag:<p><c:out value="${someBean.someProperty}" /></p>or, if you're using at least Servlet 2.4 API with JSP 2.0 API which allows EL in template text, then do for example:<p>${someBean.someProperty}</p>

  • Servlet to generate  *new*  html pages for browser

    Dear all,
    Greetings!
    I am write a servlet, and I want this servlet to generate different html pages (say 5 pages) simultaneously, and then display them in 5 different pages in client browser.
    The sequence is like this:
    1) the user click a link in a web browser and send request to web server.
    2) web server has a servlet to handle this request, then in doGet() or doPost() method it will do some calculations first, after that, it generate 5 different html pages (it can use redirect in a chain fashion) and send back to client browser.
    3) the client browser will display these 5 different html code in 5 different pages (should not be the same as the original pages that submited the request), i.e, it will pop up new web pages automatically to serve 5 different pages (since each page will have <html> ... </html> codes).
    Any solution, if possible, please give me some idea.
    //-- My main problem is: how to ask servlet to generate html codes,
    //-- and when send back to client, let browser displays the information in
    //-- a new web page (not original page the submit the request)? show some servlet doGet() code if possible.
    if you have solution for even only 1 page, your help is also very appreciated!
    once again, many thanks!

    However, for wild guessing,
    are you included d:\richard in your CLASSPATH?No. Does the CLASSPATH affect the default directory to create file - and I have to put the Tomcat as the first path in my classPath? But I just found that I set environment variable HOME to be d:\richard. It must be the reason.
    How about this:
    When a use submit a request, the servlet starts a new
    thread to do the process, for example.....I thought about this solution earlier. It is true that this is a solution. Now I am not worrying about it, since when I move on about this project, I found something more interesting (worse?) for this project. Detail follows:
    This morning I was informed that the project needs the request being sent from the front end applet, (*NOT from browser link*), so now even simple client side scripting does not work. This is because when servlet sends back response, it will send back to applet by Connection.getInputStream() - this is what I can think about right now. Basically, it means, the browser will not even have a chance to process the returned HTML code. So the question becomes: How to ask browser open a web page to display the servlet response from an front end applet directly? ;(
    I am almost run out of idea! Will check back later, meanwhile spend some more time considering... It is very late here now (early in the next morning)!
    Thank you very much indeed for all you kind help!!!

  • Getting html page in servlet

    Hey
    I'm trying to get a html page to appear when i run my servlet. I've done it by copying the whole html page into the servlet and geting it to print it out on screen. I was wondering if anyone knew of an easier or better way of doing this. Is there some way of directing the servlet to a particular html page or something like that?
    Thanks

    You could also use jsp, which provides you with JAVA functionality, however, omitting the printing. Here's an example:
    <%@ page contentType="text/html; charset=ISO-8859-5" %>
    <%
         String name = request.getParameter("name");
    %>
    <html>
    <header>
    </header>
    <body>
    <p><%=name %></p>
    </body>
    </html>

Maybe you are looking for

  • 110V vs. 220V, which is better?

    I'm going to be living for the next several months where I can use either 110V or 220V power. I know the charger is dual voltage, and I can use it with either voltage with a simple plug adapter. My question is, which is preferable? Will the battery c

  • How to find out Import/Export - Set/Get Parameter

    Hi All, In many BAdi / User Exit - Many IMPORT and SET Parametrs is used eq.  IMPORT flag = flag FROM MEMORY ID 'DELT'. But I unable to find out where this Parameters is EXPORT . Which BAdi or Whic User Exit. Same things for SET Parametrs . Regad DK

  • Converter for XviD?

    I wanted to convert some XviD video files to avi. After searching online, I downloaded a couple programs including handbrake, but each one diminishes the quality, which is out of my expectation. Is there any program that can convert xvid to avi witho

  • Getting error in coding

    In this program, I'm trying to make a horoscope where the user will select there astrological month through radio buttons. The program will then display the user horoscope. I'm currently getting this error when compiling using Textpad: addItemListene

  • Multiple POST-MAPPING Processes Code Generation BUG

    We are testing OWB 10gR2, and we were very happy to see that there is option to include more than one postmapping operator. The idea is to create mapping with two post-mapping operators and that: - one procedure is executed in case of 'Post-Mapping P