Copy listbox between jsp pages

Trying to have an action that will copy the entire listbox from 1 jsp page to another, not just the selected items.

You can achieve it in the following ways:
          <b>1. Put the List Box values in Session context</b>
          <b>2. Put the List Box values in application context</b>
          You cant use Struts action to achieve this.
          Thanks and regards,
          Paz

Similar Messages

  • Urgent! pass parameters between jsp pages

    Does anyone can give an example about how to pass parameters between jsp pages?
    This is what I do:
    pageContext.forward("pag_loginc.jsp?p_idusr=" + strUsr + "&c_password=");
    But when deployed is not working.
    Help is needed.

    can you put that stuff in the session context in the first page, then pull it out in the second page?

  • Traversing between JSP Pages

    Hi!,
    I need a suggestion to this problem that i'm facing.I want to traverse between JSP pages which follow like a wizard.i.e,i click next to go to the next page & back to traverse back to the previous page.I have some text fields in the previous page that contain some info.When i click on Next it goes to the next page.when i click on Previous i want to be able to view the input contents in the previous page.I tried using < a href="">
    but it blanks all the fields ....
    Somebody help
    Regards,
    Chaitra

    Use theseus mvc framework. (http://sourceforge.net/projects/theseus-mvc). It will teach you to properly and cleanly right web sites the way they should be, where JSP pages server only as a "view", the action class (servlet hybrid so to speak) handles passing form data to logic, logic returns to action class that then populate the request that is passed on to the JSP page to make use, especially if you use a JavaBean or taglib.

  • How the hell does a person share session data between JSP page and a Servle

    1. How the hell does one share session data between a servlet and a JSP page without using a bean but rather using a normal string variable.
    2. When using session scope to access a bean the application complains about not finding the bean on the specified scope, however when I use an application scope the save the same bean, the application does find it.
    Please help!!!!!!!
    SERVLET:
    HttpSession session = request.getSession(true);
    ServletContext servletContext = session.getServletContext();
    customerID = result.getString("CustomerID");
    userName = result.getString("UserName");
    session.setAttribute("UserName",userName);
    session.setAttribute("CustomerID",customerID);
    System.out.println("Customer UserName = " + session.getAttribute("UserName"));
    response.sendRedirect("/economics/subscriptions/default.jsp");
    JSP PAGE:
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root xmlns:jsp=http://java.sun.com/JSP/Page mlns:c="http://java.sun.com/jsp/jstl/core" xmlns:sql="http://java.sun.com/jsp/jstl/sql" version="2.0">
    <jsp:directive.page isThreadSafe="true" session="true" contentType="text/xml"/><jsp:output omit-xml-declaration="false"/><jsp:scriptlet>response.addHeader("x-xslt-nocache", "true");</jsp:scriptlet><pml>
    <page type="web" search="y">
         <pageName>Commercial Banking</pageName>
         <jsp:directive.include file="/economics/header.inc"/>
         <jsp:directive.include file="/login.inc"/>
         <jsp:directive.include file="/economics/leftMenu.inc"/>
         <!--<jsp:useBean id="UserName" type="java.lang.String" scope="session" />-->
         <content>
         <searchSum>Commercial - Main Content</searchSum>
         Value = <c:out value="${request.session.getAttribute("UserName")}"/>
         </content>
         <jsp:directive.include file="/economics/rightNav.inc"/>
         <jsp:directive.include file="/footer.inc"/>
    </page></pml></jsp:root>

    For a start, just "session" instead of "request.session" would work better. But why did you post this here and not in the JSP forum? Doesn't seem to have anything to do with Java programming.

  • Single signon between JSP page and Net.Data page

    I am trying to setup a single signon between a JSP page hosted on a tomcat server, and a Net.Data page hosted on an IBM HTTP server. Both of these servers are running on an AS400. The JSP page (www.jsppage.com/menu) contains a link to the Net.Data page (www.netData.com/page2). In order to access www.jsppage.com/menu the user needs to login. Once this happens I want them to be able to go back and forth between the two pages without having to log in when they switch servers. Page navigation is handled through myServlet.java so that when a user clicks on a link the request is forwarded on to myServlet.java where the servlet determines where to redirect the user to. The servlet uses
    RequestDispatcher requestDispatcher = getServletContex().getRequestDispatcher(url);
    requestDispatcher.forward(request, response);
    to forward the user to the correct page. This works fine for the JSP pages but when I forward to www.netData.com/page2 I get an error telling me the address doesn't start with a /. I also need to send the user name and password for the net.data pages to avoid the second login window to popup.
    I understand that the requestDsipatcher.forward() method directs the browser to a page that is relative to the current root directory. If I try to use response.sendRedirect(url) I get sent to the right page but the signon window pops up. I would appreciate any help.

    I am trying to setup a single signon between a JSP
    page hosted on a tomcat server, and a Net.Data page
    hosted on an IBM HTTP server. Both of these servers
    are running on an AS400. The JSP page
    (www.jsppage.com/menu) contains a link to the Net.Data
    page (www.netData.com/page2). In order to access
    www.jsppage.com/menu the user needs to login. Once
    this happens I want them to be able to go back and
    forth between the two pages without having to log in
    when they switch servers. Page navigation is handled
    through myServlet.java so that when a user clicks on a
    link the request is forwarded on to myServlet.java
    where the servlet determines where to redirect the
    user to. The servlet uses
    RequestDispatcher requestDispatcher =
    getServletContex().getRequestDispatcher(url);
    requestDispatcher.forward(request, response);
    to forward the user to the correct page. This works
    fine for the JSP pages but when I forward to
    www.netData.com/page2 I get an error telling me the
    address doesn't start with a /. I also need to send
    the user name and password for the net.data pages to
    avoid the second login window to popup.
    I understand that the requestDsipatcher.forward()
    method directs the browser to a page that is relative
    to the current root directory. If I try to use
    response.sendRedirect(url) I get sent to the right
    page but the signon window pops up. I would
    appreciate any help.You can't do that without passing username and password.
    The servers keep track of the user by storing a cookie on the clients computer. The cookie is only valid for the domain that created it.
    So, to make this work you need to send the username and password as part of the sendRedirect. the forward() method won't work.
    What you could do is create some code on the .net machine that accepts username, password and target URL as input. Once it receives those parameters it should perform the .net login procedure and redirect to the correct page.
    In your servlet you should pass those parameters on to the .net machine and the user should get the correct page without ever seeing any login windows.
    Make sure to use https if you decide to follow this scheme since http will transmit the username/password in cleartext.
    /Christopher

  • Pass values between jsp pages

    Admin1.jsp
    In this jsp page i have a drop down list with<select name=Update
    From this page i move to the page Adnim2.jsp
    Admin2.jsp
    In this page i request for the value of selected entry in the drop down list as follows
    String a=request.getParameter("Update");
    From this page i move onto a servlet UpdateContribution.java
    UpdateContribution.java
    Here i need the value of the selected entry in drop down list ie Update
    but String a=request.getParameter("Update"); does not work here and i get a Null Pointer Exception
    Please help me

    In Admin2.jsp, add a hidden form field and assign the selected value of drop-down to it. Now, you can obtain
    the selected value of drop-down in Servlet(UpdateContribution.java) using given hidden form field.
    Or,
    Store the selected value of drop-down list in session. Now, you can obtain the value in servlet(UpdateContribution.java) through session

  • Passing parameter between jsp pages

    Hi
    I'v got the following problem: I have an jsp page that shows result of sql query as a list of 5 items, if there are more items returned - it shows first five, user is able to see more by clicking to a link which shows him the same page with next 5 items etc. The piece of index.jsp file with that link looks like that:
            <html:link action="<%=(String)request.getAttribute("actionMod")%> module=... name=... styleClass=...>and at the end of initSearchAction I have:
    req.setAttribute("actionMod","initSearch.do");Action is defined:
    <!-- action for product list -->
            <action path="/initSearch"
                    type="...list.InitSearchAction"
                    name="productListForm"
                    validate="false"
                    scope="request"
                    unknown="false"
                    >
                    <forward name="success" path=".search"/>               
            </action>      .search is defined as
    <definition name=".search" extends=".main">
            <put name="body" value="/list/index.jsp" />
    </definition>The problem is when I set a paramter in initSearchAction like that:
    req.setAttribute("handle",h);and try to read it next time when initSearchAction action is running, parameter h is null. I need that to pass handle to stateful session bean that holds important information that need to be static during a session. Can anyone tell me how to pass that handle in some other way?
    regards
    ania

    now it works :)
    I'm new to this things so I'm not familiar with all those sessions and requests...
    thanks a lot
    ania

  • To pass value between jsp page

    How can I pass hidden's value from a jsp page to other?
    My code is:
    a.jsp
    <h:form id="insUser">
    <h:inputHidden id="flag" value="1"></h:inputHidden>
    </h:form>
    b.jsp
    <%String flag="";
    flag=request.getParameter("flag");
    out.print("flag="+flag);
    %>
    b.jsp shows: flag=null
    Could you help me?

    Because this hidden field id is insUser:flag, but not just flag.
    If you have subview or other naming container(s) around form, the id name might be even longer.
    Sergey : https://ajax4jsf.dev.java.net/

  • Problem while i am sending image as a stream between jsp pages

    Hi,
    I want to send the image from one jsp page to another jsp via stream.
    Help to continue the process...

    Thak you for ur reply.
    But in Servlet-Chaining concept, one servlet output stream passed to another servlet and goes on...
    like that, is possible to do same in jsp.
    My actual task is to send the image from one jsp page to another, the sample code i paste here
    <%@ page import="java.io.*" autoFlush="true" %>
    <%
    System.out.println("======Send.jsp=====");
               ServletContext sercon = getServletContext();
                 String filename = sercon.getRealPath("/logo.png");
         RequestDispatcher rd = sercon.getRequestDispatcher ( "/read.jsp" ) ; 
         InputStream file=new BufferedInputStream(new FileInputStream(filename));
         int i,j=0;
                      try
              OutputStream os=response.getOutputStream();
              while((i=file.read())!=-1)
                   j++;
                   os.write((byte)i);
    System.out.println("Bytes Read : "+j);
         rd.forward(request,response);
              os.flush();
              file.close();
         catch(Exception e)
              System.out.println("Error"+j);
    %>
    <%@ page import="javax.swing.*,java.io.*,java.util.*"%>
    <%            
         byte[] by;
         int i,j=0;
    System.out.println("======Read.jsp=====");
         response.setContentType("image/png");
         InputStream is=request.getInputStream();
    System.out.println("In Read.jsp read bytes : "+is.available());
         ByteArrayOutputStream os=new ByteArrayOutputStream();
         while((i=is.read())!=-1)
              j++;
              os.write(i);
         by=os.toByteArray();
         out.println(by+"\n"+i);
         os.close();
         is.close();
    %>If i run this code (send.jsp) the image is displayed in the current page itself, and not forward to read.jsp
    Is any other alternative solutions then point out.

  • Struts where are values stored between jsp pages?

    Hi.I realize that this is forum is not specifically for struts but I thought someone might know the answer to my question.
    I have run the following code. The code contains two JSP’s that both get there values from the same ArrayList generated by the same actionform so contain the same data. Example.jsp is diplayed when the application is first run when submit is clicked newjsp.jsp is displayed.
    If a value in the fields of example.jsp is changed and submit is clicked the altered value is also displayed in newjsp.jsp. I am confused by this as after submit is clicked ExampleForm.java method reset is called which returns the variable values to their original value but the newly entered value is still displayed. Please tell me how this works
    Example.jsp
    <%@ page language="java"%>
    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
    <%@ taglib uri="http://struts.apache.org/tags-nested" prefix="nested"%>
    <html>
        <head>
            <title>JSP for exampleForm form</title>
        </head>
        <body>
            <html:form action="/example">
                <h3>Use of nested:iteration tag</h3>
                <nested:nest property="department">
         DEP. ID: <nested:text property="id"/> <br />
         NAME: <nested:text property="name"/> <br /><br />
                    <nested:iterate property="customers">
                        <b>Customer info</b><br />
              CUST. ID: <nested:text property="id"/> <br />
              NAME: <nested:text property="name"/> <br />
                    </nested:iterate>
                </nested:nest>
                <br />
                <br />
                <html:submit/><html:cancel/>
            </html:form>
        </body>
    </html>
    Newjsp.jsp
    <%@ page language="java"%>
    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
    <%@ taglib uri="http://struts.apache.org/tags-nested" prefix="nested"%>
    <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
    <html>
        <head>
            <title>JSP for exampleForm form</title>
        </head>
        <body>
            <html:form action="/example">
                <h3>Use of nested:iteration tag</h3>
                <nested:nest property="department">
                    <table>
                        <nested:iterate property="customers">
                            <tr><td>Customer info</td>
                                <td>CUST. ID: <nested:text property="id"/> </td>
                                <td>NAME: <nested:text property="name"/> </td>
                            </nested:iterate>
                        </tr>
                    </table>
                </nested:nest>
                <br />
                <br />
                <html:submit/><html:cancel/>
            </html:form>
        </body>
    </html>
    ExampleAction.jsp
    package de.laliluna.tutorial.nested.action;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import de.laliluna.tutorial.nested.form.ExampleForm;
    import de.laliluna.tutorial.nested.object.*;
    import java.util.*;
    public class ExampleAction extends org.apache.struts.action.Action {
        /* forward name="success" path="" */
        private static final String SUCCESS = "success";
        @Override
        public ActionForward execute(ActionMapping mapping, ActionForm form,
                HttpServletRequest request, HttpServletResponse response)
                throws Exception {
            ExampleForm formBean = (ExampleForm) form;
            Department depart = formBean.getDepartment();
            ArrayList dep = (ArrayList) depart.getCustomers();
            Customer cust0 = (Customer) dep.get(0);
            System.out.println(">>>>>>>>>>>>>> customer.getName() = " + cust0.getName());
            System.out.println(">>>>>>>>>>>>>> customer.getId() = " + cust0.getId());
            Customer cust1 = (Customer) dep.get(1);
            System.out.println(">>>>>>>>>>>>>> customer.getName() = " + cust1.getName());
            System.out.println(">>>>>>>>>>>>>> customer.getId() = " + cust1.getId());
            Customer cust2 = (Customer) dep.get(2);
            System.out.println(">>>>>>>>>>>>>> customer.getName() = " + cust2.getName());
            System.out.println(">>>>>>>>>>>>>> customer.getId() = " + cust2.getId());
            return mapping.findForward("example");
    ExampleForm.jsp
    package de.laliluna.tutorial.nested.form;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ActionMessage;
    import de.laliluna.tutorial.nested.object.*;
    import java.util.ArrayList;
    import java.util.Collection;
    public class ExampleForm extends org.apache.struts.action.ActionForm {
        Department department;
        public Department getDepartment() {
            return department;
        public void setDepartment(Department department) {
            this.department = department;
        public void reset(ActionMapping mapping,
                HttpServletRequest request) {
            System.out.println("Entered action bean reset");
            Collection customers = new ArrayList();
            customers.add(new Customer(1, "Maria"));
            customers.add(new Customer(2, "Klaus"));
            customers.add(new Customer(3, "Peter"));
            department = new Department(1, "Department A", customers);
    Customer.java
    package de.laliluna.tutorial.nested.object;
    public class Customer {
        private int id;
        private String name;
        public Customer() {
        public Customer(int id, String name) {
            this.id = id;
            this.name = name;
        public int getId() {
            return id;
        public void setId(int id) {
            this.id = id;
        public String getName() {
            return name;
        public void setName(String name) {
            this.name = name;
    Department.java
    package de.laliluna.tutorial.nested.object;
    import java.util.Collection;
    public class Department {
        private int id;
        private String name;
        private Collection customers;
        public Department() {
        public Department(int id, String name, Collection customers) {
            this.id = id;
            this.name = name;
            this.customers = customers;
        public Collection getCustomers() {
            return customers;
        public void setCustomers(Collection customers) {
            this.customers = customers;
        public int getId() {
            return id;
        public void setId(int id) {
            this.id = id;
        public String getName() {
            return name;
        public void setName(String name) {
            this.name = name;
    }

    Thanks for responding.
    I set the debugger as you suggested and found that method reset is being called.
    I did not write the whole of this program I was just playing around with and expanding a struts example I found on line.
    http://www.laliluna.de/articles/struts-nested-iteration-tutorial.html
    It contains the reset method.
    I am interested to know how to reset the values. So am clearing the data after it has been submitted, just to reset. I assumed that once the new page was arrived at the values would be taken from the array.
    I am quite new to struts and am not familiar with example_input.action and example.action I will look into these.

  • Remembering the radio button state between jsp pages

    How do i maintain the state of radio buttons when i move from one jsp page to another. Thank you for your help.

    Hi
    If the next JSP is a child window,you can take a JSP hidden variable and you can store radio button state in it and can get the same on child window thorugh window.opener.
    And if its not a child window(JSP),then you can maintain the state in session and get it anywhere.

  • How can share data between jsp pages using beans??

    any one can give me code for 2 jsp pages with bean that share data for them

    <jsp:usebean name="yourBeanName" type="com.whatever.foo" scope="session"/>
    this will look for a bean named yourBeanName in the scope specified by the scope attribute. If none was found, the container will instantiate one with the no arg constructor for your bean and place it into the proper scope.
    if your bean had a method getName(), you could then on your jsp do:
    <%=yourBeanName.getName()%> to print the results of the method to the page. there are other ways to do the actual placing of the output on the page, but this is the most direct.

  • Passing values between jsp pages

    Hi all,
    I am a newbie to jsp. I am trying to pass value from one jsp to another.
    Let me post the code here and make my point clear. I have 3 jsp pages and am trying to get the value into my 3rd page that was in the first page.
    This is my Test.jsp page:
    <%@page contentType="text/html"%>
    <html>
    <head><title>Test JSP Page</title></head>
    <body>
    <%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
    <%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
    Testing.. JSP Page
    <FORM action='Response.jsp' method="POST">
    <input type='Text' name='get_name'>
    <input type="submit" value="Click Me">
    </FORM>
    </body>
    </html>
    This is my response.jsp page:
    <%@page contentType="text/html"%>
    <%@page import = "sun.jdbc.rowset.CachedRowSet" %>
    <html>
    <head><title>Response Page</title></head>
    <body>
    <%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
    <%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
    Thank you... <%=request.getParameter("get_name") %>
    // I want to pass this get_name to my next page, but since request.getParameter returns an object and not a string, how will I capture the value and pass it to my next page.
    </body>
    </html>
    The 3rd jsp page is:
    <%@page contentType="text/html"%>
    <html>
    <head><title>JSP Page</title></head>
    <body>
    // I am trying to get the value of the name here in this page.
    <%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
    <%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
    </body>
    </html>
    Your help is appreciated.
    Thanks

    Hi,
    Thanks for the reply, it works. I was wondering whether this is an efficient way of doing this. What I want to do further is to setup a connection to a database and use the value I got from my previous page to query the DB and get the results and display.
    I have see some code in the java website and a lot of people do by writting a bean /class(believe bean is just a class) and then importing it and do the things that way. I have good knowledge of OO and Java as a language and would definitely love to do it this way.
    What i think i am missing is the basic idea to doing this way. So if you could let me know how to do this using java classes I would really appreciate it. If its too much to explain can u point to some good source(URL's) that explain's this. I have searched on this and all i find is code with no good explaination.
    Thanks a lot

  • Pass value between JSP pages

    I would like to pass values between pages.
    I don't want showing up on the url. Ex: some.jsp?param=value
    I don't feel it's safe.
    It's not coming from form either....
    How can I hide the value and pass it to next page?
    I want to pass the value when the user click on a hyperlink
    Thanks In Advance.
    Message was edited by:
    Theepan

    Client side information is never safe no matter what you do. If the values don't end up in the url, they are always present SOMEWHERE in the html content.
    If you don't want the values to end up in the url, rework the page so it DOES do a post form submit. You could turn the hyperlink into a javascript call that submits the form for you.

  • Send string between JSP pages

    HI, how do I can use a variable String from one JSP to another JSP: example
    first.jsp (String mail_string="name@domain")
    second.jsp (I need the mail_string value)

    HI, how do I can use a variable String from one JSP to
    another JSP: example
    first.jsp (String mail_string="name@domain")
    second.jsp (I need the mail_string value)First JSP:
    String mail_string = "name@domain";
    session.setAttribute("mystringname", mail_string);Second JSP:
    String mail_string = (String) session.getAttribute("mystringname");

Maybe you are looking for

  • Outlook sync error

    I have outlook 2002 on my laptop and computer. When I bought the iphone I activated it and synced outlook on my laptop since I was out of town and all was well but I actually sync on my home pc. So, I installed itunes 7.3 on my pc and when it opened

  • Mapping help-- Number format

    Hi, I have a requirement in the mapping where in we receive an XML field with value '674.585' needs to be converted to an xml field as '674.59'..(Two decimal rounding) I tried using format number but it does not convert '.585' to '.59' but it does co

  • Illustrator CS6 now needs legacy Java SE 6 runtime?

    Help. I tried to open my Illustrator CS6 today and got the following error message, "To open Adobe Illustrator CS6 you need to install the legacy Java SE runtime". The window then states, "Click More info...to visit the legacy Java SE 6 download webs

  • Photoshop Elements 8 will not launch

    I have Photoshop Elements 8 on my Sony Vaio (windows 7 Home Premium 64bit). Whenever I launch it a License Agreement pops up and when I accept it the software does not launch. There is no application open in my Task Manager. I thought I would uninsta

  • Can i store iphoto library on an external harddrive

    How do I store my iphoto library on an external hard drive?