Translate jsp pages into asp pages using xslt

Discussion in 'ASP .Net' started by ak, Jun 27, 2007.

  1. ak

    ak Guest

    Hi Guys,

    I was just wondering whether it is possible to translate JSP pages
    into ASP pages using XSLT.

    What I want is to be able to open a currently available website
    developed in JSP in a blackberry. Considering the limited real estate
    of blackberry, we would like to propose a translation of the websites
    using ASP .NET and XSLT by stripping out the HTML response from the
    JSP pages.

    Do you think it is possible?

    Regards,
    Andie
    ak, Jun 27, 2007
    #1
    1. Advertising

  2. ak

    nahid Guest

    On Jun 27, 11:06 am, ak <> wrote:
    > Hi Guys,
    >
    > I was just wondering whether it is possible to translate JSP pages
    > into ASP pages using XSLT.
    >
    > What I want is to be able to open a currently available website
    > developed in JSP in a blackberry. Considering the limited real estate
    > of blackberry, we would like to propose a translation of the websites
    > using ASP .NET and XSLT by stripping out the HTML response from the
    > JSP pages.
    >
    > Do you think it is possible?
    >
    > Regards,
    > Andie


    It depends on your page structure. What's the condition of java script
    and event subscription....at the end I think you can't get any benefit
    if u considered effort?
    nahid, Jun 27, 2007
    #2
    1. Advertising

  3. ak

    ak Guest

    On Jun 27, 4:49 pm, nahid <> wrote:
    > On Jun 27, 11:06 am, ak <> wrote:
    >
    > > Hi Guys,

    >
    > > I was just wondering whether it is possible to translate JSP pages
    > > into ASP pages using XSLT.

    >
    > > What I want is to be able to open a currently available website
    > > developed in JSP in a blackberry. Considering the limited real estate
    > > of blackberry, we would like to propose a translation of the websites
    > > using ASP .NET and XSLT by stripping out the HTML response from the
    > > JSP pages.

    >
    > > Do you think it is possible?

    >
    > > Regards,
    > > Andie

    >
    > It depends on your page structure. What's the condition of java script
    > and event subscription....at the end I think you can't get any benefit
    > if u considered effort?


    Hi Nahid,

    Most of the pages will be hardcoded (e.g. menus). The pages that
    require translation are login screen and the product catalogue. All of
    the menu will be hardcoded. There won't be any java script on the
    product catalagoue (e.g. normal html tables).

    One issue that require my thinking cap on is the login. I was just
    wondering how ASP handles JSP sessions.

    Thanks for your quick reply.

    Andie
    ak, Jun 27, 2007
    #3
  4. ak

    Hans Kesting Guest

    > On Jun 27, 4:49 pm, nahid <> wrote:
    >
    >> On Jun 27, 11:06 am, ak <> wrote:
    >>
    >>> Hi Guys,
    >>>
    >>> I was just wondering whether it is possible to translate JSP pages
    >>> into ASP pages using XSLT.
    >>>

    > One issue that require my thinking cap on is the login. I was just
    > wondering how ASP handles JSP sessions.
    >


    I take it that that Blackberry will point to the asp.net site. That asp.net
    site
    will then (from codebehind) call the jsp site, using WebRequest.

    In this case your codebehind is the "browser" that accesses the jsp site.
    A "session" for a browser is just a (session-)cookie.
    You need to set up a (single) CookieContainer that you attach to
    every HttpWebRequest.


    Hans Kesting
    Hans Kesting, Jun 27, 2007
    #4
  5. ak

    Masudur Guest

    On Jun 27, 1:55 pm, Hans Kesting <>
    wrote:
    > > On Jun 27, 4:49 pm, nahid <> wrote:

    >
    > >> On Jun 27, 11:06 am, ak <> wrote:

    >
    > >>> Hi Guys,

    >
    > >>> I was just wondering whether it is possible to translate JSP pages
    > >>> into ASP pages using XSLT.

    >
    > > One issue that require my thinking cap on is the login. I was just
    > > wondering how ASP handles JSP sessions.

    >
    > I take it that that Blackberry will point to the asp.net site. That asp.net
    > site
    > will then (from codebehind) call the jsp site, using WebRequest.
    >
    > In this case your codebehind is the "browser" that accesses the jsp site.
    > A "session" for a browser is just a (session-)cookie.
    > You need to set up a (single) CookieContainer that you attach to
    > every HttpWebRequest.
    >
    > Hans Kesting


    Hi Andie
    check out this post
    http://www.thescripts.com/forum/thread334654.html
    Masudur, Jun 27, 2007
    #5
  6. ak

    ak Guest

    On Jun 27, 5:55 pm, Hans Kesting <>
    wrote:
    > > On Jun 27, 4:49 pm, nahid <> wrote:

    >
    > >> On Jun 27, 11:06 am, ak <> wrote:

    >
    > >>> Hi Guys,

    >
    > >>> I was just wondering whether it is possible to translate JSP pages
    > >>> into ASP pages using XSLT.

    >
    > > One issue that require my thinking cap on is the login. I was just
    > > wondering how ASP handles JSP sessions.

    >
    > I take it that that Blackberry will point to the asp.net site. That asp.net
    > site
    > will then (from codebehind) call the jsp site, using WebRequest.
    >
    > In this case your codebehind is the "browser" that accesses the jsp site.
    > A "session" for a browser is just a (session-)cookie.
    > You need to set up a (single) CookieContainer that you attach to
    > every HttpWebRequest.
    >
    > Hans Kesting


    That's what I am looking for.

    Thanks Hans. I will give it a try and let you know the outcome.

    Kind Regards,
    Andie
    ak, Jun 27, 2007
    #6
  7. ak

    ak Guest

    On Jun 27, 11:36 pm, ak <> wrote:
    > On Jun 27, 5:55 pm, Hans Kesting <>
    > wrote:
    >
    >
    >
    > > > On Jun 27, 4:49 pm, nahid <> wrote:

    >
    > > >> On Jun 27, 11:06 am, ak <> wrote:

    >
    > > >>> Hi Guys,

    >
    > > >>> I was just wondering whether it is possible to translate JSP pages
    > > >>> into ASP pages using XSLT.

    >
    > > > One issue that require my thinking cap on is the login. I was just
    > > > wondering how ASP handles JSP sessions.

    >
    > > I take it that that Blackberry will point to the asp.net site. That asp.net
    > > site
    > > will then (from codebehind) call the jsp site, using WebRequest.

    >
    > > In this case your codebehind is the "browser" that accesses the jsp site.
    > > A "session" for a browser is just a (session-)cookie.
    > > You need to set up a (single) CookieContainer that you attach to
    > > every HttpWebRequest.

    >
    > > Hans Kesting

    >
    > That's what I am looking for.
    >
    > Thanks Hans. I will give it a try and let you know the outcome.
    >
    > Kind Regards,
    > Andie


    Hi Again,

    I used the cookiecontainer as suggested by Hans. However, i still
    could not receive the data that is supposed to be available only when
    we are logged in to the site. Can someone help me with this? Here is
    some snippets of my code:

    CookieContainer cookieContainer = new CookieContainer();
    ASCIIEncoding encoding = new ASCIIEncoding();
    string postData = "username=xxxx";
    postData += "&password=yyyy";
    byte[] data = encoding.GetBytes(postData);

    // Prepare web request...
    HttpWebRequest myRequest =
    (HttpWebRequest)WebRequest.Create("https://www.xxx.co.nz/
    xxxWeb/login.jsp");
    myRequest.Method = "POST";
    myRequest.AllowAutoRedirect = false;
    myRequest.KeepAlive = true;
    myRequest.CookieContainer = cookieContainer;
    myRequest.ContentType = "application/x-www-form-urlencoded";
    myRequest.ContentLength = data.Length;
    Stream newStream = myRequest.GetRequestStream();
    // Send the data.
    newStream.Write(data, 0, data.Length);
    newStream.Close();

    HttpWebResponse res =
    (HttpWebResponse)myRequest.GetResponse();

    // Then grab the content of the desired page
    myRequest = (HttpWebRequest)HttpWebRequest.Create("http://
    www.xxx.co.nz/xxxWeb/index.jsp?vgnext=123&vgnextf=Cat");
    myRequest.CookieContainer = cookieContainer;
    myRequest.Timeout = 20000;
    myRequest.Credentials = CredentialCache.DefaultCredentials;
    res = (HttpWebResponse)myRequest.GetResponse();
    StreamReader sr = new StreamReader(res.GetResponseStream());
    String string1 = sr.ReadToEnd();
    TextBox1.Text = string1;

    Kind Regards,
    Andie
    ak, Jul 2, 2007
    #7
  8. ak

    ak Guest

    On Jul 2, 10:56 pm, ak <> wrote:
    > On Jun 27, 11:36 pm, ak <> wrote:
    >
    >
    >
    > > On Jun 27, 5:55 pm, Hans Kesting <>
    > > wrote:

    >
    > > > > On Jun 27, 4:49 pm, nahid <> wrote:

    >
    > > > >> On Jun 27, 11:06 am, ak <> wrote:

    >
    > > > >>> Hi Guys,

    >
    > > > >>> I was just wondering whether it is possible to translate JSP pages
    > > > >>> into ASP pages using XSLT.

    >
    > > > > One issue that require my thinking cap on is the login. I was just
    > > > > wondering how ASP handles JSP sessions.

    >
    > > > I take it that that Blackberry will point to the asp.net site. That asp.net
    > > > site
    > > > will then (from codebehind) call the jsp site, using WebRequest.

    >
    > > > In this case your codebehind is the "browser" that accesses the jsp site.
    > > > A "session" for a browser is just a (session-)cookie.
    > > > You need to set up a (single) CookieContainer that you attach to
    > > > every HttpWebRequest.

    >
    > > > Hans Kesting

    >
    > > That's what I am looking for.

    >
    > > Thanks Hans. I will give it a try and let you know the outcome.

    >
    > > Kind Regards,
    > > Andie

    >
    > Hi Again,
    >
    > I used the cookiecontainer as suggested by Hans. However, i still
    > could not receive the data that is supposed to be available only when
    > we are logged in to the site. Can someone help me with this? Here is
    > some snippets of my code:
    >
    > CookieContainer cookieContainer = new CookieContainer();
    > ASCIIEncoding encoding = new ASCIIEncoding();
    > string postData = "username=xxxx";
    > postData += "&password=yyyy";
    > byte[] data = encoding.GetBytes(postData);
    >
    > // Prepare web request...
    > HttpWebRequest myRequest =
    > (HttpWebRequest)WebRequest.Create("https://www.xxx.co.nz/
    > xxxWeb/login.jsp");
    > myRequest.Method = "POST";
    > myRequest.AllowAutoRedirect = false;
    > myRequest.KeepAlive = true;
    > myRequest.CookieContainer = cookieContainer;
    > myRequest.ContentType = "application/x-www-form-urlencoded";
    > myRequest.ContentLength = data.Length;
    > Stream newStream = myRequest.GetRequestStream();
    > // Send the data.
    > newStream.Write(data, 0, data.Length);
    > newStream.Close();
    >
    > HttpWebResponse res =
    > (HttpWebResponse)myRequest.GetResponse();
    >
    > // Then grab the content of the desired page
    > myRequest = (HttpWebRequest)HttpWebRequest.Create("http://www.xxx.co.nz/xxxWeb/index.jsp?vgnext=123&vgnextf=Cat");
    > myRequest.CookieContainer = cookieContainer;
    > myRequest.Timeout = 20000;
    > myRequest.Credentials = CredentialCache.DefaultCredentials;
    > res = (HttpWebResponse)myRequest.GetResponse();
    > StreamReader sr = new StreamReader(res.GetResponseStream());
    > String string1 = sr.ReadToEnd();
    > TextBox1.Text = string1;
    >
    > Kind Regards,
    > Andie


    Hi Guys,

    I am still not able to login properly.

    However, I have tried posting some data using the same technique. I
    can retrieve the expected response.

    Can someone advise me whether it is possible to log in into a
    different web server to retrieve member-only contents or not?

    Kind Regards,
    Andie
    ak, Jul 3, 2007
    #8
  9. ak

    ak Guest

    On Jul 3, 3:45 pm, ak <> wrote:
    > On Jul 2, 10:56 pm, ak <> wrote:
    >
    >
    >
    > > On Jun 27, 11:36 pm, ak <> wrote:

    >
    > > > On Jun 27, 5:55 pm, Hans Kesting <>
    > > > wrote:

    >
    > > > > > On Jun 27, 4:49 pm, nahid <> wrote:

    >
    > > > > >> On Jun 27, 11:06 am, ak <> wrote:

    >
    > > > > >>> Hi Guys,

    >
    > > > > >>> I was just wondering whether it is possible to translate JSP pages
    > > > > >>> into ASP pages using XSLT.

    >
    > > > > > One issue that require my thinking cap on is the login. I was just
    > > > > > wondering how ASP handles JSP sessions.

    >
    > > > > I take it that that Blackberry will point to the asp.net site. That asp.net
    > > > > site
    > > > > will then (from codebehind) call the jsp site, using WebRequest.

    >
    > > > > In this case your codebehind is the "browser" that accesses the jsp site.
    > > > > A "session" for a browser is just a (session-)cookie.
    > > > > You need to set up a (single) CookieContainer that you attach to
    > > > > every HttpWebRequest.

    >
    > > > > Hans Kesting

    >
    > > > That's what I am looking for.

    >
    > > > Thanks Hans. I will give it a try and let you know the outcome.

    >
    > > > Kind Regards,
    > > > Andie

    >
    > > Hi Again,

    >
    > > I used the cookiecontainer as suggested by Hans. However, i still
    > > could not receive the data that is supposed to be available only when
    > > we are logged in to the site. Can someone help me with this? Here is
    > > some snippets of my code:

    >
    > > CookieContainer cookieContainer = new CookieContainer();
    > > ASCIIEncoding encoding = new ASCIIEncoding();
    > > string postData = "username=xxxx";
    > > postData += "&password=yyyy";
    > > byte[] data = encoding.GetBytes(postData);

    >
    > > // Prepare web request...
    > > HttpWebRequest myRequest =
    > > (HttpWebRequest)WebRequest.Create("https://www.xxx.co.nz/
    > > xxxWeb/login.jsp");
    > > myRequest.Method = "POST";
    > > myRequest.AllowAutoRedirect = false;
    > > myRequest.KeepAlive = true;
    > > myRequest.CookieContainer = cookieContainer;
    > > myRequest.ContentType = "application/x-www-form-urlencoded";
    > > myRequest.ContentLength = data.Length;
    > > Stream newStream = myRequest.GetRequestStream();
    > > // Send the data.
    > > newStream.Write(data, 0, data.Length);
    > > newStream.Close();

    >
    > > HttpWebResponse res =
    > > (HttpWebResponse)myRequest.GetResponse();

    >
    > > // Then grab the content of the desired page
    > > myRequest = (HttpWebRequest)HttpWebRequest.Create("http://www.xxx.co.nz/xxxWeb/index.jsp?vgnext=123&vgnextf=Cat");
    > > myRequest.CookieContainer = cookieContainer;
    > > myRequest.Timeout = 20000;
    > > myRequest.Credentials = CredentialCache.DefaultCredentials;
    > > res = (HttpWebResponse)myRequest.GetResponse();
    > > StreamReader sr = new StreamReader(res.GetResponseStream());
    > > String string1 = sr.ReadToEnd();
    > > TextBox1.Text = string1;

    >
    > > Kind Regards,
    > > Andie

    >
    > Hi Guys,
    >
    > I am still not able to login properly.
    >
    > However, I have tried posting some data using the same technique. I
    > can retrieve the expected response.
    >
    > Can someone advise me whether it is possible to log in into a
    > different web server to retrieve member-only contents or not?
    >
    > Kind Regards,
    > Andie


    Hi,

    I have resolved this issue.

    The problem happened because the login page uses an image button. And,
    I did not realize that for posting an image button, you need to
    include the coordinates of the mouse.

    Regards,
    Andie
    ak, Jul 31, 2007
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    591
  2. Marat
    Replies:
    5
    Views:
    3,772
    John C. Bollinger
    Nov 10, 2004
  3. mike
    Replies:
    3
    Views:
    486
    Thomas Weidenfeller
    Jan 24, 2005
  4. Replies:
    2
    Views:
    5,695
    Hal Rosser
    Jun 25, 2005
  5. Replies:
    0
    Views:
    4,348
Loading...

Share This Page