Passing info to a JSP

I have a servlet
public class A extends HttpServlet
public void doGet(HttpServletRequest req, HttpServletResponse res)throws IOException, ServletException
String name ="hello";
String city = "Dallas";
String country = "USA";
I want to pass the 3 strings to a JSP view.jsp.
I am using-
RequestDispatcher rd = getServletContext().getRequestDispatcher("/view.jsp");
if (rd != null)
     rd.forward(req,res);
But how do I pass the three strings to the JSP?
How should I retrieve the information in the JSP?
I want to print it in a table.
<table>
<tr><td>name<td>hello
<tr><td>place<td>dallas
<tr><td>country<td>USA
</table

There are a number of ways you could do it.
You could pass them as parameters:-
view.jsp?name=hello&city=dallas&country=USA
and use request.getparameter("name") in the jsp
or you could pass them as a session or request attribute (so they don't appear in the url)
using setAttribute and getAttribute.
Or you could create some kind of object and encapsulates your three strings and pass that as an attribute.

Similar Messages

  • Problem in passing data from one .jsp page to another .jsp page

    i have a problem here
    Actually i have 2 jsp pages. What im trying to do here is actually i want to pass data from the first jsp page to the second for updating
    The first jsp page contains data that user wants to update in the form of table.
    <td><img src = "edit.gif" alt = "edit" border="0" ><td>
    <TD><%= Name %></td>
    <TD><%= rs.getInt("Age") %></td>
    <TD><%= rs.getString("Gender") %></td>
    So this page displays the data that users wants to update plus one image button (edit button). So when user clicks this button, all the data in this page will be brought to the second .jsp page called updatePersonal for updating.
    The problem here is that it is not displaying the existing data in the second .jsp page.
    The second page basically contains forms
    <INPUT TYPE="text" NAME="FirstName" maxlength="30" value = "<%=FirstName%>">
    Can someone please help me. I really dont know what to do..How do i get the data displayed in the text field that is passed from the first .jsp page..thankx in advance

    Please modify below code to:
    td><img src = "edit.gif" alt = "edit" border="0" ><td>
    -----------------modified code
    td><a href="updatePersonal.jsp?FirstName=<%=rs.getString(FirstName")%">&LastName=<%=rs.getString("LastName")%>&Age=<%=rs.getInt("Age")%>&Gender=<%=rs.getString("Gender")%>"><img src = "edit.gif" alt = "edit" border="0" ></a><td>
    I'm sure it works</a>

  • Passing javascript values to jsp without refreshing the page

    Hi,
    How do u pass a value of a javascript variable to the jsp without refreshing the page ?
    For example, a file called test.jsp in which a javascript variable x contains value 254. I need to pass the value of x to a method declared in test.jsp(same page).

    Hi Mona,
    when i say refresh i do mean a blink of the browser.
    This is a small example i wrote to show you how you can pass javascript varables to JSP variables. If you don't want the refresh to be seen by the user just include this code in a hidden frame on a page and instead of refreshing the entire page, refresh the hidden frame.
    i have to say, i didn't test the code so i don't guarantee it's flawless.
    if you need an more detailed example just tell me, i'll create one, but it won't be for today :)
    <html>
    <head>
         <title>Log in to the system</title>
    </head>
    <body>
    <script>
    //we retrieve the parameter 'user' from the URL
    <%
      String username = request.getParameter("user");
    %>
    var user = "<%= username%>";
    //check if there is a username in the URL
    if(user=="null")
      //there is no username so we log the person in as a guest
      user="guest";
      //we refresh the page and set the user parameter to 'guest'
      //the parameter now contains the javascript variable 'user'.
      //The parameter can be read by the JSP (see the top op this script).
      //This way we gave the javascript variabele to the JSP variable
      location="login.jsp?user="+user;
    else if(user=="guest")
    {  alert("Welcome "+user+", I hope you like this site"); }
    else
    {  alert("Welcome "+user+", I'm glad to see you again"); }
    </script>
    </body>
    </html>

  • Passing JavaScript value to Jsp

    Hi,
    Any idea how to pass a value from javascript to jsp page when the page gets load on browser.
    I use below code but an event is require to pass the value. Is there any code that pass automatically the value from javascript to jsp.
    <html>
    <head>
    <title>Passing Javascript value to Jsp</title>
    <script type="text/javascript" language="javascript">
    var scriptVar = "Noy"
    var WinNetwork = new ActiveXObject("WScript.Network")
    document.write (WinNetwork.username)
    document.index.hiddenTextBox.value = WinNetwork.username
    </script>
    </head>
    <%
    String jspVar = null;
    if(request.getParameter("submit") != null){
         jspVar = request.getParameter("hiddenTextBox");
         out.println("Jsp Var : " + jspVar);
    %>
    <body>
    <form name="index" onSubmit="index.jsp" method="post">
    <input type="hidden" name="hiddenTextBox"><br>
    <input type="submit" name="submit" value="Submit">
    </form>
    </body>
    </html>
    Thanks,
    ~ukbasak

    JSP/Java runs at the server side, produces a HTML page, sends it to the client side and then stops running.
    HTML, containing under each CSS and JS, arrives at the client side and runs at the client side only.
    To invoke JSP/Java using HTML you need to fire a request to the server side. That can be either a plain vanilla <a> link, a <form> to be submitted or an asynchronous Ajaxical request.
    That said, the use of ActiveX in web applications is discouraged. It's a Microsoft IE proprietaty. With other words, it isn't and won't be supported by all alternative browsers which the other half of the world is using.

  • How to pass javascript variable to jsp function

    i want to check which table header (that is <th> in html )is clicked and based on that a jsp funtion do a query in database and should show records in sorted way according to which column head is clicked.
    Table is created in html.
    My function is
    Vector varray = workcaseid.getWorkcaseId(Long.parseLong(MasterAccountNumber),SelectedColumn);
    <table border="1">
              <th ><label onClick="<%SelectedColumn="workcase_id";%>">Workcase Id</label></th>
              <th><label onClick="<%SelectedColumn="status_id";%>">Status</label></th>
    <tr><td>etc</td></tr>
    </table>

    im using bean for business login, following mvc model,and i think mvc is one of good design practice to use.
    <jsp:useBean id="workcaseid" scope="session"class="beanFiles.SearchWorkcaseId" />
    varray = workcaseid.getWorkcaseId(Long.parseLong(MasterAccountNumber),SelectedColumn);
    just tell me whether it is possible to pass javascript variable to jsp variable or not.i can do it by using hidden input type,using form and submit button.

  • How to pass parameter to intro.jsp page ?

    Hi all,
    Anybody please tell me how to pass parameter to intro.jsp page.
    Is there any param name defined in <forward > syntax ?
    I have made following configuration in struts-config.xml file.
    I want to pass parameter to intro.jsp page
    <global-forwards>
              <forward name="invalidsession" path="/intro.jsp" redirect="true" />
    </global-forwards>
    please reply soon.
    Thanking you.

    Hi all,
    I have a similar kind of question..
    Iam trying to pass a string variable from JSP to servlet thro URL..
    Im using tomcat5
    COde:
    String fname=request.getParamter("filename");
    <jsp:forward page="/servlet/coreservlets.filedownload?name=" +fname />
    It is generating a unterminated tag error..Please help..

  • Passing values to a JSP script from an Applet

    I am having problems to passing arguments to a JSP scipt.
    In the applet the following code is executed:
    URL scoreTrackerURL = new URL(applet.getCodeBase(), "newscore.jsp?name=foo&score=10000");
    URLConnection scoreTrackerConn = scoreTrackerURL.openConnection();
    scoreTrackerConn.connect();
    The JSP-script in the newscore.jsp looks like this:
    <%@ page language="java" %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.net.*" %>
    <%@ page import="java.io.*" %>
    <%
    String name = request.getParameter("name");
    String score = request.getParameter("score");
    BufferedWriter writer = new BufferedWriter(new FileWriter("highscore.txt"));
    writer.write(name + ", " + score);
    writer.close();
    %>
    What am I doing wrong since this doesn�t work!!! I have very little experience of JSP and accessing these scipts from Applets...
    Dukecredits are waiting for You! :) Thank you!

    I tried your code and it works fine.
    public class AppletParam extends Applet {
        public void paint(Graphics g) {
         g.setColor(Color.red);
         g.fillRect(0,0, getSize().width, getSize().height);
         try {
             URL scoreTrackerURL = new URL(getCodeBase(), "newscore.jsp?name=foo&score=10000");
             System.out.println(scoreTrackerURL);
             URLConnection scoreTrackerConn = scoreTrackerURL.openConnection();
             scoreTrackerConn.connect();
         } catch(IOException ioe) {
             ioe.printStackTrace();
    }The call to System.out.println writes the URL that's to be called to the java console in the webbrowser, so you can verify that the method has been called.Any Exceptions that might occour within the method will show up in the same place
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <title>New Score</title>
      </head>
      <body>
        <h1>New Score</h1>
    <%@ page language="java" %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.net.*" %>
    <%@ page import="java.io.*" %>
    <%
    String name = request.getParameter("name");
    String score = request.getParameter("score");
    System.out.println("name=" + name + " score=" + score);
    BufferedWriter writer = new BufferedWriter(new FileWriter("highscore.txt"));
    writer.write(name + ", " + score);
    writer.close();
    %>
      </body>
    </html>Again a call to System.out.println . This time it results in the two parameters being written to the application server log file, so you can see if the jsp was called and what the parameters were.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <title>test af AppletParam</title>
      </head>
      <body>
        <h1>test af AppletParam</h1>
        <applet codebase="." code="kres_test.AppletParam" width=200 height=200>
        </applet>
      </body>
    </html>The html file with the applet. Remember to place the class file in the correct place. If not you will get an error message in the java console of the webbrowser.
    My tests was performed on a WebLogic 6.1 application server, but there's nothing special about your code, it ought to run on any decent J2EE application server.

  • Passing session data between jsp and servlet

    I have a servlet that I pass data to my jsp.
    I do a session.setAtrribute in the servlet. No problem.
    I get the data no problem in the jsp that I call.
    How do I pass this same data to the another servlet?
    I basically have an array of values that I already have in the existing jsp that has been set in session.
    When I call the secondary servlet, I don't have anything in this session variable related to my array.
    Prior to posting to my next servlet, do I need to do another setAttribute inside the jsp to get the data passed to the servlet?
    Thanks.

    Two different things. The encoding adds this to the URL (after the page, before the query string
    ;jsessionid=ABC123 but only if the user isn't using cookies.
    So in your example, you would do this (maybe):
    <%
      String url = response.encodeURL("Servlet");
    %>
      <form name="form1" method="post" action="<%= url %>?cmd=pay"> ... Or some modification.
    So the difference between encodeing and using a post is that
    1) encoding adds the jsessionid to the url string if necessary. It does nothing else
    2) POSTing will send a request to the provided URL via the POST method, including the inputs of the form as parameters to the URL.
    They really don't interact with each other. It is like asking what is the difference between the Color Orange and thr Size Big? They can both be applied to the same thing, or not... and have no real relation to each other.

  • Passing JavaScript values to JSP variables

    Can any body correct the follwing code
    <Script language="JavaScript">
    function test( x )
    <%
    int num = x;
    num = num * 2;
    %>
    v.value = "<%out.print(num);%>";
    <input type="button" name="b" value="test" onClick="test(5)">
    <input type="text" name="v" value="0">
    In short, I am trying to pass JavaScript value to JSP variable. I hope that it is possible to do that. If it is possible then how can I do it. I want to assing the variable x passed to the JavaScript function called test to the JSP variable called num.
    Regards,
    Ageel

    Thank you for your reply,,,
    I think then the only way to do it is to post the
    value on the server and then use request.getParameter
    method in jsp code
    but the question now how can I post values to the
    server using JavaScript without reloading the pageyes... you can to it by create a new popup window which will submit the value to server after page was loaded... then, server return a value to the same window in html/jsp page which then using javascript to set it back to the opener and close up the window... however, this is not a good choice unless you have no other alternative...
    >
    There is other possible solution
    if I can get the text field value from the same page
    without reloading it that would work fine and will
    solve my problem, is it possible?yes... you can get the value from the textfield...
    for example :
    function showValueInTextField()
        alert(document.forms[0].elements["mytextfieldname"].value);
    >
    My final question> can jsp change things on the same
    page without reloading it. I mean can it work like
    JavaScript so that I can use it's internal functions
    instead of using java script :S
    not really know what you trying to say here...

  • Passing vars...JSP resolves faster than javascript - is there a workaround?

    HI
    The variable/value ("fieldA") that I want to pass from "frame1.jsp" to "frame2.jsp is actually a variable defined javascript function "getTest()" in "frame1.jsp".
    I want to pass "fieldA" from "frame1.jsp" to "frame2.jsp"..
    "frame2" is initially "blank.html. In the "getTest()" function I use (parent.frames[2].location = "frame2.jsp";) to create frame2.jsp inside of "frame2"
    I generat a "post" request (from "frame1.jsp") assigning "fieldA" to a hidden form field ("fldA") in "frame2", and then display the value of "fldA" using "<%= request.getParameter("fldA") %>"...
    But the value of hidden form field - "fldA" - is initially "null" because when "frame2.jsp" page is creatd, the JSP scriplets resolve before the javascript "getData" function can resolve. (if I click to post frame2.jsp again, the value shows - but, that's just because the frame2.jsp now exists.)
    Is there a work around?.... Or, do I need to have "frame1.jsp" call a servlet to pass "fieldA" ????
    Appreciate ANY help on this!!!!
    (NOTE -- actually, my real world need will be to assign the value to a Custom Tag parameter, rather than simply display - and that is why I need to get this to work!)
    THE WORKING CODE IS BELOW. . . (AGAIN ANY HELP IS APPRECIATED!)
    *****frame0.html*****
    <%@ page language="java" import="java.io.*, java.util.*" errorPage="error.jsp" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>frame0</TITLE>
    </HEAD>
    <FRAMESET FRAMEBORDER="2" ROWS="20%,80%">
    <FRAME SRC="frame0.html" NAME="frame0">
    <FRAMESET FRAMEBORDER="2" COLS="20%,80%">
    <FRAME SRC=frame1.jsp?fieldX=<%= session.getParameter("fieldX") %> NAME="frame1">
    <FRAME SRC=frame2.jsp?fieldX=<%= session.getParameter("fieldX") %> NAME="frame2">
    </FRAMESET>
    </FRAMESET>
    </HTML>
    *****frame1.jsp*****
    <%@ page language="java" import="java.io.*, java.util.*" errorPage="error.jsp" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
         <head><title>frame1</title>
         <link rel="stylesheet" type="text/css" href="./standard.css">
              <script LANGUAGE="JavaScript">
                   parent.frames[2].location = "blank.html";
                   function getTest()
                        var fieldA = "HO THERE!!!"
                        <%
                             session.putValue("fieldB", "HEY THERE!!!");
                        %>
                        parent.frames[2].location = "frame2.jsp";
                        parent.frames[2].getData(fieldA);
                        return;
    </script>
         </head>
         <body bgcolor="#FFFFFF" text="#000000">
              <p>
              <h2>
              In frame1.jsp, the value in fieldA is: <%= session.getAttribute("fieldA") %>
              <h2>
              In frame1.jsp, the value in fieldB is: <%= session.getAttribute("fieldB") %>
              <p>
              <form name="reportRange">
                   <center>
                        <fieldset style="padding: 0.5em" name="customer_box">
                        <table cellpadding="0" cellspacing="0" border="0">
                             <tr class="drophead">
                                  <td valign="top" height="0" ><span class="drophead">
                                       test submit
                                  </td>
                             </tr>
                        </table>
                        </fieldset>
                   </center>
              </form>
         </body>
    </html>
    *****frame2.html*****
    <%@ page language="java" import="java.io.*, java.util.*" errorPage="error.jsp" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
         <head>
         <title>frame2</title>
              <script LANGUAGE="JavaScript">
                   function getData(fieldA)
                   document.pageData.fldA.value = fieldA;
                        document.pageData.submit();
              </script>
         </head>
         <body>
              <p>
              <h2>
              In frame2.jsp, the value of fieldA: <%= request.getParameter("fldA") %>
         <h2>
              In frame2.jsp, the value of fieldB: <%= session.getValue("fieldB") %>
              <p>
              <div id="HiddenForm">
                   <form name="pageData" method="post" action="frame2.jsp" target="_self">
                        <input type="hidden" name="fldA" value="empty">
                   </form>
              </div>
         </body>
    </html>
    *****blank.html*****
    <html>
    <head>
    <title>blank page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" href="globalview.css" type="text/css">
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
    </body>
    </html>
    *****error.jsp*****
    <%-- error.jsp --%>
    <%@ page language="java" isErrorPage="true"%>
    <html>
    <head>
         <title>error page</title>
    </head>
    <body>
    <h2>Error Encountered: </h2>
    <%= exception.toString() %><BR>
    <br>
    details...<%= exception.getMessage() %>
    </body>
    </html>

    So where to start...
    1) session does not have a method "getParameter()" (frame0.jsp) so I don't know how you can get this to work.
    2) When you call "javascript:getTest()" the scriptlet is not run again. It's serverside so it is execute on the server then any return data is placed where you have the scriptlet.
    3) The scriptlets in "frame0.html" will not work as the page is declared as html.
    4) Once again jsp scriptlets (including TagLibraries) are server side components. Any values passed to them should be via a request or session setting on the server side.
    For example:
    Say we have a tag "myWorkingTag" that outputs the value we assign to "valToUse" on the page.
    original jsp document (page.jsp):
    <%@ taglib uri="mytags" prefix="mine" %>
    <html>
    <body>
    <mine:myWorkingTag valToUse="xyz"/>
    </body>
    </html>
    The web browser view of page.jsp:
    <html>
    <body>
    xyz
    </body>
    </html>
    You can assign the "valToUse" attribute using <%="xyz"%> (or session.getAttribute() or request.getParameter()) on the server side but ultimately you need to send the value to the server and recompile the page.
    I've made some changes to your code (in bold) which is a minor fix but not a solution to your overall objective.
    ***** frame0.jsp *****
    <HTML>
    <HEAD>
    <TITLE>frame0</TITLE>
    </HEAD>
    <FRAMESET ROWS="20%,80%">
    <FRAME SRC="frame0.jsp" NAME="frame0">
    <FRAMESET COLS="20%,80%">
    <FRAME SRC=tFrame1.jsp?fieldX=<%= request.getParameter("fieldX") %> NAME="frame1">
    <FRAME SRC=tFrame2.jsp?fieldX=<%= request.getParameter("fieldX") %> NAME="frame2">
    </FRAMESET>
    </FRAMESET>
    </HTML>
    ***** frame1.jsp *****
    <%@ page language="java" import="java.io.*, java.util.*" errorPage="error.jsp" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head><title>frame1</title>
    <link rel="stylesheet" type="text/css" href="./standard.css">
    <script LANGUAGE="JavaScript">
    //parent.frames[2].location = "blank.html";
    function getTest()
    var fieldA = "HO THERE!!!"
    <%session.setAttribute("fieldB", "HEY THERE!!!");%>
    parent.frames[2].location = "frame2.jsp";
    parent.frames[2].getData(fieldA);
    return;
    </script>
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
    <p>
    <h2>
    In frame1.jsp, the value in fieldA is: <%= session.getAttribute("fieldA") %>
    <h2>
    In frame1.jsp, the value in fieldB is: <%= session.getAttribute("fieldB") %>
    <p>
    <form name="reportRange">
    <center>
    <fieldset style="padding: 0.5em" name="customer_box">
    <table cellpadding="0" cellspacing="0" border="0">
    <tr class="drophead">
    <td valign="top" height="0" ><span class="drophead">
    test submit
    </td>
    </tr>
    </table>
    </fieldset>
    </center>
    </form>
    </body>
    </html>
    *****frame2.jsp*****
    <%@ page language="java" import="java.io.*, java.util.*" errorPage="error.jsp" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>frame2</title>
    <script LANGUAGE="JavaScript">
    function getData(fieldA)
    document.pageData.fldA.value = fieldA;
    document.pageData.submit();
    </script>
    </head>
    <body>
    <%if(request.getParameter("fldA")!=null){
    //this section doesn't make sense, your using the same value twice!?!%>
    <p>
    <h2>
    In frame2.jsp, the value of fieldA: <%= request.getParameter("fldA")
    %>
    <h2>
    In frame2.jsp, the value of fieldB: <%= session.getAttribute("fieldB") %>
    <p>
    <%}%>
    <div id="HiddenForm">
    <form name="pageData" method="post" action="frame2.jsp" target="_self">
    <input type="hidden" name="fldA" value="empty">
    </form>
    </div>
    </body>
    </html>
    ***** blank.html (obsolete) *****
    ***** error.jsp unchanged *****
    What you should be aiming for is either:
    A) Using the above code, send all your required parameters to the form in frame2.jsp and use these parameters to configure the page. As you can see I added an "if(request.getParameter("fldA")!=null)" block to prevent any code from being execute until you send the data.
    B) In frame1.jsp, submit it to itself with all the parameters you need and add the objects to the session. When frame1.jsp returns the page to the browser, get it to call a javascript function (<body onload='...'>") to reload frame2.jsp and collect the objects/variables from the session.
    Just remember Javascript and Java in JSP's don't exist in the same "world" so to speak. They have to cross a bridge to communicate, the bridge being the action of the form.
    Cheers,
    Anthony

  • How to pass header to a jsp when doing response.sendRedirect

    Hi,
    It is possible to pass header to a jsp when doing response.sendRedirect ? how to do it?
    thanks

    Thanks Luis for your suggestion but it doesn't work in my case.
    in my implementation, user logs in from Novell iChain single sign-on. My initial jsp page gets the user information from request header, then should pass the user information to next page via my JSF servlet.
    How this can be done ?

  • Passing variable from one JSP to another

    Hi....
    I am working on customizing Oracle Application(istore).
    I need to pass variable from 1 JSP to another.
    JSP 1 contains the following line of code:
    <INPUT type="HIDDEN" name="soldtoCustPartyName" value="<%=soldtoCustPartyName%>">
    How can I pass this to another JSP Page. The other JSP should take the 'soldtoCustPartyName' and find out the primary address country.
    So please help me in getting variable passed from 1st JSP to next.
    By default, 1st JSP is not fwded to 2nd JSP.
    This is very very urgent...Please help.....

    When you push the submit button on jsp1 - it goes to jsp2?
    ie
    // in jsp1.jsp
    <form action="jsp2.jsp">
    <INPUT type="HIDDEN" name="soldtoCustPartyName" value="<%=soldtoCustPartyName%>">
    <input type="submit">
    </form>
    //Then in jsp2.jsp all you need is
    request.getParameter("soldtoCustPartyName");This will pick up the value that is coming from the hidden field on jsp1

  • Passing value from one jsp to another?

    how to pass value from one jsp to another? i have a value assigned in the link, i want to pass that value to another jsp page?
    please help with code?

    Instead of the value being passed, i am getting a null value.
    Here is my calendar code:
    <%@page import="java.util.*,java.text.*" %>
    <html>
    <head>
    <title>Print a month page.</title>
    </head>
    <body bgcolor="white">
    <%
                  boolean yyok = false;
                  int yy = 0, mm = 0;
                  String yyString = request.getParameter("year");
                  if (yyString != null && yyString.length() > 0)
                      try
                          yy = Integer.parseInt(yyString);
                                  yyok = true;
                       catch (NumberFormatException e)
                          out.println("Year " + yyString + " invalid" );
                  Calendar c = Calendar.getInstance( );
                  if (!yyok)yy = c.get(Calendar.YEAR);  
                         mm = c.get(Calendar.MONTH);
    %>
                  <table align="center">
                      <tr>
                  <td>
                       <form method=post action="calendar.jsp">
                          Enter Year : <select name="year">
    <%         
                 for(int i= yy;i<=2010;i++)
    %>
                  <OPTION VALUE= <%=i%> > <%=i%> </option>
    <%       
    %>
              </select>
                      <input type=submit value="Display">
                      </form>
                      </td>
                    </tr>
    <tr>
                     <table>
    <%!
    String[] months = {"January","February","March",
                    "April","May","June",
                    "July","August","September",
                    "October","November", "December"
    int dom[] =     {
                        31, 28, 31, 30,
                        31, 30, 31, 31,
                        30, 31, 30, 31
    %>
    <%
                int leadGap =0;
    %>
    <div id="t1" class="tip"><table border="4" cellpadding=3 cellspacing="3" width="250" align="center" bgcolor="lavender">
    <tr>
    <td halign="centre" colgroup span="7" style="color:#FF0000;">
    </colgroup>
    <tr>
    <td>
    <%
              GregorianCalendar calendar =null;
              for(int j=0;j<12;j++)
                        calendar = new GregorianCalendar(yy, j, 1);
                  int row = 1 ;
                  row = row + j;
        %>
              <table>
                <tr>
              <colgroup span="7" style="color:#FF0000;">
              </colgroup>
                </tr>
              <tr align="center">
              <th colspan=7>
                  <%= months[j] %>
                  <%= yy %>
              </th>
              </tr>
    <tr>
    <td>Sun</td><td>Mon</td><td>Tue</td><td>Wed</td><td>Thu</td><td>Fri</td><td>Sat</td>
    </tr>
    <%
        leadGap = calendar.get(Calendar.DAY_OF_WEEK)-1;
        int daysInMonth = dom[j];
        if ( calendar.isLeapYear( calendar.get(Calendar.YEAR) ) && j == 1)
        ++daysInMonth;
        out.print("<tr>");
        out.print(" ");
          for (int h = 0; h < leadGap; h++)
           out.print("<td>");
          out.print("</td>");
        for (int h = 1; h <= daysInMonth; h++)
          out.print("<td>");
          out.print("<a href=desc.jsp>" + h + "</a>" );
          out.print("</td>");
        if ((leadGap + h) % 7 == 0)
            out.println("</tr>");
    out.println("</tr></table></div>");
    if( row%3 != 0)
    out.println("</td><td>");
    else
    out.println("</td></tr>\n<tr><td>");
    %>
    </html>I need to pass the value in 'h' to the desc.jsp page.
    my code for desc.jsp is :
    <html>
    <head>
    </head>
    <body bgcolor="lightblue">
    <form method=post action="Calenda.jsp">
    <br>
    <%= request.getParameter("h") %>
    <h2> Description of the event <INPUT NAME="description" TYPE=TEXT SIZE=20> </h2>
    <BR> <INPUT TYPE=SUBMIT VALUE="submit">
    </form>
    </body>
    </html>But i am not able to pass the value. The 'h' value contains all the date. i want to pass only a single date, the user clicks to the other page. please help

  • Can objects be passed between Applets and JSP?

    Can objects be passed between Applets and JSP? If so how? Thanks in advance.
    Scott

    see if this helps,
    http://forum.java.sun.com/thread.jsp?forum=54&thread=136847

  • Parameter passing from servlet to jsp page

    Hi
    I m facing problem of parameter passing from servlet to jsp ..
    plz help me...
    I m using as ...
    in servlet code I m using ...
    request.setAttribute("string",parameter);
    and in jsp..
    request.getParameter("string");
    regard's
    JAI KUMAR

    Hi Jaykumar
    You should use
    <%= request.getAttribute("sting") %> or
    ${string}
    in your jsp. I think you are trying to retrive the parameter instead of attribute.
    Thanks

Maybe you are looking for

  • Order status no longer shows any items

    The order status area of my account no longer shows any items even going back 18 months. I've placed about 6 orders in that time frame including one last week. I followed the link to Pre-sign for the shipment but the order never appears, even after 5

  • 2nd Hand iPod just purchased but can't get it to work on PC - help!?

    I have just purchased a 2nd hand Ipod Nano 4GB 3rd generation. It is loaded with a 1000 songs but I would like to remove some of them and add my own. When I connect it to my PC, it comes up but everything is greyed out. Does this mean I can't do anyt

  • Am unable to start the listener, it throws error# TNS-12560 and TNS-00583.

    $ lsnrctl start ---------------------------------------------------ERROR MESSAGE---------------------------- LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 25-SEP-2011 00:01:50 Copyright (c) 1991, 2005, Oracle. All rights reserved. Starting /u

  • Can we rename ABAP roles in GRC Process Control to adhere to naming convntn

    Hello, We are working on a new implementation of the GRC Process Control 2.5 product. It comes with 11 standard roles. I wanted to change the names to adhere to our company's role naming conventions. Will this adversely affect any functionality. I kn

  • Restoring Backup--lost my I photo library

    I downloaded videos from a flip video. I said yes when it asked if I wanted to create a new library. Later I found ALL my previous pictures/events gone. I put a message in the IPHOTO discussion and received instructions to Restore the previous backup