how to use parameter of one web context in another one?

Hey guys,

I have a web context which is a servlet

The other web context is a jsp

I also have a login page

In the login page after clicking the submit button the

control is passed to the servlet.

The login page passes the username and password

to the servlet

i have used doGet() method.

I simply want to retrieve the parameter present in url of the servlet and use this in the jsp.

How is this possible?

To make things clearer , here are the three pages:

1> Login.html:<HTML>

{<HEAD>

<TITLE>

First Media - DashBoard

</TITLE>

</HEAD>

<BODY>

<FORM METHOD=GET

ACTION="http://localhost:8080/Dashboard/Dashboard">//url for servlet

<IMG SRC="C:\dashboard\Picture1.png"

ALT="Unable to display picture" ALIGN="LEFT" HEIGHT="150" WIDTH="150">

<H3>

<CENTER>

LOGIN SCREEN

</CENTER>

</H3>

<P></P><P></P>






<P>

<H4>

<CENTER>First Media DashBoard Display</CENTER>

</H4>

</P>



<P>

<CENTER>

LOGIN ID 牋?

<INPUT TYPE="TEXT" NAME="userid">

</CENTER>

</P>



<P>

<CENTER>

PASSWORD 牋?

<INPUT TYPE="PASSWORD" NAME="userpass">

</CENTER>

</P>



<INPUT TYPE="SUBMIT" VALUE="SUBMIT">

</FORM>

</BODY>

</HTML>

Here's the servlet:

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

import java.util.*;

public class Dashboard extends HttpServlet

{

public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException

{

res.setContentType("text/html");

PrintWriter out=res.getWriter();

out.println("<HTML>");

out.println("<HEAD><TITLE>FIRST MEDIA DASHBOARD</TITLE></HEAD>");

out.println("<FRAMESET ROWS=\"20%,80%\">");

out.println("<FRAMESRC=\"http://localhost:8080/Intro/Intro\">");//this is the url for the jsp

out.println("<FRAMESET COLS=\"20%,80%\">");

out.println("<FRAME SRC=\"c:/dashboard/MainNetwork.html\" NAME=\"mainframe\">");

out.println("<FRAME SRC=\"c:/dashboard/DisplayArea2.html\" NAME=\"displayframe\" SCROLLING=\"NO\">");

out.println("</FRAMESET>");

out.println("</FRAMESET>");

out.println("</HTML>");

}

}

Finally the jsp :

<HTML>

HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- Hide from tired old browsers

function multiLoad(doc1,doc2) {

parent.mainframe.location.href=doc1;

parent.displayframe.location.href=doc2;

}

// -->

</SCRIPT>

</HEAD>

<BODY>

<IMG SRC="C:\dashboard\Picture1.png"

ALIGN="LEFT" WIDTH="80" HEIGHT= "80">


<A HREF="javascript:multiLoad('c:/dashboard/MainNetwork.html', 'c:/dashboard/DisplayArea1.html')">Network Log</A>

牋牋牋牋?

<A HREF="javascript:multiLoad('c:/dashboard/MainService.html', 'c:/dashboard/DisplayArea2.html')">Service Levels</A>

牋牋牋牋?

<A HREF="#" onClick=

"parent.location='../localhost_3A8080/Dashboard/Login.html';

window.location='C:dashboard/Login.html/default.htm';">LogOut

</A>

<H3>

<%

if (request.getParameter("userid") == null)

{

out.println("Welcome to dashboard");

}

else {

out.println("Hello," + request.getParameter

("userid"));

} %></H3>//code to try to greet the user by name

</BODY>

</HTML>

}

I know this is a long one, but guys, please help!!!

Message was edited by:

alok1983

Message was edited by:

alok1983

Message was edited by:

alok1983

Message was edited by:

alok1983

[4335 byte] By [alok1983a] at [2007-11-26 15:22:18]
# 1
If you re-post using the code tags to format the message some one may actually take the time to read it.
tolmanka at 2007-7-8 21:37:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...