Urgent....How can i redirect to my jsp page from servlet in init() method..

How can i redirect to my jsp page from servlet in init() method..Becoz that servlet is calling while server startsup..so im writing some piece of code in init() method..after that i want to redirect to some jsp page ...is it possible?
using RequestDispatcher..its not possible..becoz
RequestDispatcher rd = sc.getRequestDispatcher("goto.jsp");
rd.foward(req,res);
Here the request and response are null objects..
So mi question can frame as how can i get request/response in servlet's init method()..

Hi guys
did any one get a solution for this issue. calling a jsp in the startup of the servlet, i mean in the startup servlet. I do have a same req like i need to call a JSP which does some data reterival and calculations and i am putting the results in the cache. so in the jsp there in no output of HTML. when i use the URLConnection i am getting a error as below.
java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:707)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:612)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:705)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:612)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:519)
at com.toysrus.fns.alphablox.Startup.callJSP(Unknown Source)
at com.toysrus.fns.alphablox.Startup.init(Unknown Source)
at org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)
so plz do let me know how to call a jsp in the start up of a servlet.
Thanks
Vidya

Similar Messages

  • How can i redirect to another JSP page automatically after some event

    I am developing a Tic-Tac-Toe game which can be played between two players who are on two different machines.
    When the first player comes to the Welcome page he will redirected to a Waiting Page when he clicks on the 'Start' button.
    When the second player comes to the Welcome page he will be redirected directly to the Game page, on clicking the 'Start' button.
    So how can i redirect the first player to the Game page after the second player is available for the game.
    And if i want to manage multiple instances of my game how can i do that//
    I am using JSP, javascript and MySQL for developing my project, and I am new to all these tools, but i would still like to carry on with all these only

    This is a bit of a challenge because of the nature of the web. Generally the web is "pull only" meaning that the browser has to initiate any interactions - the server can't push data to the browser if it wasn't asked to.
    The easiest way to solve this is using AJAX via JavaScript to periodically poll the server for any status changes. There are other ways (the Comet protocol is one) but they start to get a bit difficult and are still a bit new and not completely supported in a standards way. And to be honest they are still basically polling though in a more efficient way.
    Are you using a JavaScript framework? Most of the JavaScript frameworks that I've used have built in support for polling in the background. You'd have to have the JSP/servlet side be able to handle these polling requests from the browser and, when another person joins the game, the server indicates that and sends that back to the browser.
    As far as multiple instances I would have the server automatically pair up users as needed. So when the first player arrives he has to wait for another player. When the second player arrives a new game is created for those two players. Now a third player arrives and waits until a fourth player shows up. When player 4 joins another separate game is created. Presumably the conversation between the browser and the server will need to include a "game number" or other unique number so that the server can keep track of the games.

  • How can I link to a jsp page from another jsp page within websphere portal?

    Afternoon all,
    I have a websphere portlet which displays a jsp page. I want to put a hyperlink on the jsp page which when clicked will open another jsp page.
    Does anyone know how to do this?
    Thanks,
    Alex

    The anchor tag is the correct one for generating clickable links.
    <jsp:forward> is for transferring control at the server end. Its when you decide to change which page you want to show the user. ie check user is logged in. If not then forward them to login page, else display current page.
    I tried that. It does open the jsp page
    but the place and page links in the portal theme get screwed up.Whats mucked up about them? Do they point where they shouldn't?
    You might try using a <base> tag to set where relative links are resolved from.
    Cheers,
    evnafets

  • How can I download content of wiki pages from Office 365 online Sharepoint site using c#?

    How can I download content of wiki pages from Office 365 online Sharepoint site using c#?
    Ratnesh[MSFT]

    Hi,
    According to your post, my understanding is that you want to download content of wiki pages on SharePoint Online.
    If just for getting the text of the page, I suggest you convert page to PDF file first and then download the PDF file via a Visual Web Part as a Sandboxed solution.
    A sample about export HTML to PDF:
    http://hamang.net/2008/08/14/html-to-pdf-in-net/
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Patrick Liang
    TechNet Community Support

  • How can you opening the tree.jsp page to a specific folder?

    I am trying to pass a query string into the viewer.jsp page so that I can open the appropriate folder relating to that query string. I can't find a way to do this as of yet. A lot of the code doing the work is only .class files so it is challenging.
    If you have any ideas as to how to begin to tackle this problem please let me know. Basically the querystring would contain the folder I want the tree to open to.
    Thanks,
    Simon

    See:
    *https://mike.kaply.com/2012/02/09/integrating-add-ons-into-firefox/

  • Urgent:How can to control passing inputs to BAPI from different sources

    Hi all,
    I'm stuck up with an issue.
    I'm passing a user entered input to a webservice checking for status of that particular record.
    If status is "yes", I just call a form.
    I have used the visibility control for displaying the form
    If Status is "no" I call a BAPI passing the output of webservice(this is same as the user entered input).
    I'm using guard condition in this case.
    If there is no such record present, I'll have to call the same BAPI passing the user input.
    In this case the webservice does not return any output...And the BAPI has to look the input form for the input.
    I dont know how I can make the BAPI look the input form for input in case no record is present.
    Can some one help me in this case?
    Thanks,
    Ajitha

    store the value from input into a datastore while you are getting the status, then pass value from this datastore into the actual BAPI that u need to call.
    For the input parameter of bapi you can specify default values were u can specify these values from data store.
    let me know if it worked

  • How can i update an html web page from Labview?

    I intend to publish the "status" of an experiment online through an web page. I mean, if my vi is running i would like to have a phrase or indicator set on at my web page. If my Vi is not running i would like this indicator set off. This page is hosted in a server and I would like to know if its possible to update the html file from labview through an ftp connection.
    Thanks in advance...
    MSc. Alexandre Michel Maul
    Parana Federal Univeristy - Brasil

    The system exec function is on the Communication palette. Its for executing system commands. On my Win2K system, the help for FTP is:
    "Ftp
    Transfers files to and from a computer running an FTP server service (sometimes called a daemon). Ftp can be used interactively. Click ftp commands in the Related Topics list for a description of available ftp subcommands. This command is available only if the TCP/IP protocol has been installed. Ftp is a service, that, once started, creates a sub-environment in which you can use ftp commands, and from which you can return to the Windows 2000 command prompt by typing the quit subcommand. When the ftp sub-environment is running, it is indicated by the ftp command prompt.
    ftp [-v] [-n] [-i] [-d] [-g]
    [-s:filename] [-a] [-w:windowsize] [computer]
    Parameters
    -v
    Suppresses display of remote server responses.
    -n
    Suppresses autologin upon initial connection.
    -i
    Turns off interactive prompting during multiple file transfers.
    -d
    Enables debugging, displaying all ftp commands passed between the client and server.
    -g
    Disables file name globbing, which permits the use of wildcard characters (* and ?) in local file and path names. (See the glob command in the online Command Reference.)
    -s:filename
    Specifies a text file containing ftp commands; the commands automatically run after ftp starts. No spaces are allowed in this parameter. Use this switch instead of redirection (>).
    -a
    Use any local interface when binding data connection.
    -w:windowsize
    Overrides the default transfer buffer size of 4096.
    computer
    Specifies the computer name or IP address of the remote computer to connect to. The computer, if specified, must be the last paramete
    r on the line."
    I use tftp all of the time to transfer files in a similar manner. Test the transfer from the Windows command line and copy it into a VI. Pass the command line to system exec and wait until it's done.

  • How can I edit or remove iWeb pages from Mobile me after I have published it to another site?

    I have published iweb pages to another server and now I need to replace the mobile me version with page "pages moved to..." or at least I need to delete old version. However I can't find any way to do this from mobile me or from iWeb.
    From Mobile me I cant find any way to even delete pages.
    With iWeb I cant edit the old version because I cant find way to have two version of same pages. As I understand what I need is a version of my republished pages that only contains the index page "pages moved to...". But I cant create that because I cant have two versions.
    Yours Mika

    Go here : https://www.me.com/idisk/
    Then follow the folders :

  • How can I change the language of Pages from british english to American english, the new pages for mavericks

    I bought my computer on Ecuador, so it is in spanish the physical keybord, but after updating to Mavericks and updating Pages, each time I write something it corrects me to british language, for example if i write down analyze with a z, it would correct me and change the z to an s because of the language, please help.

    Menu > Apple > System Preferences > Language & Text > Language > drag English to the top of the list
    "English" according to Apple is what everyone else would call American English.
    Peter

  • How can I create a java bean instance from servlet, at runtime?

    Will anybody help me?
    I want to send bean (class) name to a servlet through parameter and I need servlet to create specified bean instance and run its method that I will send through another parameter, at runtime.

    Thanks. I found answer

  • How can i redirect a queued call to a voicemail using CCX editor?

    hi buddies, i wonder how can i redirect a queued call to a voicemail of a valid extension using CCX editor?
    i just uploaded my script (does not working as i wanted regarding voicemail)if can anybody help me i will be very happy!!

    first of all i REALLY A REALLY appreciate your reply
    but two questions remain:
    a) check my attached file is this the VM pilot number?
    b) Called Address = "2133"  means that the call will be redirected to the voicemail of the 2133 extension? im right??

  • HOW can I call EJB with JSP?

    Hi, I'm working with JSP and want to include some EJB. I dont know how can I access EJB through JSP. I dont know if I use the right code in JSP for calling EJB. Did someone know how to use that? Can someone tell me if is the right code in JSP in my example?
    Thanks, Kristjan
    THIS IS THE JSP: (useejb.jsp)
    <%@ taglib uri="http://xmlns.oracle.com/j2ee/jsp/tld/ojsp/ejbtaglib.tld" prefix="EJB" %>
    <%@ page import="mypackage1.MySessionEJB" %>
    <%@ page import="mypackage1.MySessionEJBHome" %>
    <%@ page import="mypackage1.impl.MySessionEJBBean" %>
    <HTML>
    <head><TITLE>USEBEAN</TITLE></head>
    <body>
    <EJB:useHome id="mySessionEJBHome" type="mypackage1.MySessionEJBHome" location="java:comp/env/ejb/mySessionEJB" local="false" />
    <EJB:useBean id="mySessionEJBBean" type="mypackage1.impl.MySessionEJBBean" local="false">
    <EJB:createBean instance="<%=mySessionEJBHome.create() %>" />
    </EJB:useBean>
    <%= mySessionEJBBean.calc() %>
    </body>
    </html>
    THIS IS THE EJB CODE:(MySessionEJBBean.java)
    package mypackage1.impl;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import java.lang.String.*;
    public class MySessionEJBBean implements SessionBean
    public void ejbCreate(){}
    public void ejbActivate(){}
    public void ejbPassivate(){}
    public void ejbRemove(){}
    public void setSessionContext(SessionContext ctx){}
    public String calc(String value)
    return value + value;
    public String zanka(String x)
    return x;
    (MySessionEJB.java)
    package mypackage1;
    import javax.ejb.EJBObject;
    import java.rmi.RemoteException;
    public interface MySessionEJB extends EJBObject
    public String calc(String value) throws RemoteException;
    String zanka(String x) throws RemoteException;
    (MySessionEJBHome.java)
    package mypackage1;
    import javax.ejb.EJBHome;
    import java.rmi.RemoteException;
    import javax.ejb.CreateException;
    public interface MySessionEJBHome extends EJBHome
    public MySessionEJB create() throws RemoteException, CreateException;
    }

    You might want to look at using a Java Bean wrapper, this can be done automically using WebSphere. It creates what is called an access bean which the JSP imports.
    HTH,
    J.Clancey

  • How we can generate dynamic menu in jsp page

    Hi all,
    how we can generate dynamic menu in jsp page.
    Thanks
    Manjinder

    by reading more about them on the web or in a good book, OR BY HIRING SOMEBODY TO DO SO. ;)

  • How to open a JSP page from a form ??? plz help

    hi ..
    i want to know how to open a jsp page from a oracle apps form using a button .
    the requirement is that whenever we click on the button created on the form, it opens a jsp page.
    plz help me ..its urgent !! :-(

    In portlet project, to navigate between pages, you should not use the URL property to link to a page. Instead, portlets use navigation via action handling. You use the Page Navigation editor to set up links to pages; that is, the navigation editor sets the action property.
    Here is an example to hyperlink ans button to open a new page:
    # From within the IDE, create a new portlet project. This action creates the project and one page, PortletPage1.jsp.
    # Create a second portlet page, called PortletPage2.jsp, for the project.
    # Drop a Hyperlink component onto the first portlet page, PortletPage1. (You can drop the Hyperlink on the page in the Design window or on the PortletPage1 node in the Outline window.) Change the Hyperlink's text property to Next Page.
    # Drop a Button component (found in the Basic section of the Palette) onto the second portlet page, PortletPage2.
    # Open the Page Navigation Editor. It displays the two pages (PortletPage1.jsp and PortletPage2.jsp) of the application.
    # Click the PortletPage1.jsp icon in the Navigation window to expand it, and then drag a connector from hyperlink1 to PortletPage2.jsp. Change the name of the connector from case1 to Page2.
    # Click the PortletPage2.jsp icon in the Navigation window to expand it, and then drag a connector from button1 to PortletPage1.jsp. Change the name of the connector from case1 to Page1.
    # Run and deploy the portlet. The browser displays PortletPage1 and you should see the Next Page hyperlink. When you click the Next Page hyperlink, the Apache Pluto Portal server displays PortletPage2. Click the Page2 button to return to PortletPage1.
    Sherry
    Creator Team

  • How can i set a global error page for all error cod

    how can i set a global error page for all error code?
    i don't want to leave a long list in the web.xml file.could any one help me?
    thanks

    If u have a common Error JSP named as ErrorPage.jsp
    You need to have the following piece of code in the JSP as :
    <%@ page isErrorPage ="true"%>
    This makes it as the Common Error Page for the Application. Now all you need to do is from other JSP's throw the Exception to teh container. The container will redirect to this Page and process accordingly.
    Thanks and regards,
    Pazhanikanthan. P

Maybe you are looking for