Iterate list in jsp without  Bean

Hi Techies ,
I am having list without  bean which is from webservices , so how to iterate in jsp , can u send example code .....
Thanks in advance ..
Thangavel.L

Which framework you are using???
using struts or ????
-vignesh

Similar Messages

  • How to iterate List in jsp without using for loop

    Hi,
    I am developing a small application is struts. I have one ActionForm file which contain one List like getEmployeeDetailsList(). When I am using this list in jsp page for displaying data. I want to display it as employee name, employee address, employee designation and employee contact no. These all fields are available in the above list. Now what is the problem is that I am using logic:iterate method to iterate data. but this is not sufficient to display all records in order. like employee name should be in one table and they can be vertical not horizontal, employee address is also should be seperate. and same thing with employee designation and contact no. I don't want to use for loop to iterate this list. Please tell me about optionCollection for this list. only employee names should be one drop down and employee designation is also in another drop down.
    Please help. It is really urgent.
    Any help will be appreciated.
    Thanks in advance.
    Manveer

    I'm not sure what you problem is, but one thing you can do is to create a new class and pass the list into its constructor (and store it as a private variable). Then, provide a set of functions in the new class that extracts data from the list and returns it in a form that the various parts of the JSP page wants. For example, one function may return a sorted list of just the employee names. In this way, all the business logic for formatting the data into a form that JSP page likes is hidden inside the new class.

  • Need help with JSP - Session Bean scenario

    I have massive problems with a simple JSP <--> Statefull Session Bean scenario with Server Platform Edition 8.2 (build b06-fcs)
    What I do is generating a Collection in session bean returning it to JSP
    and giving the List back to Session Bean.
    A weird exception happens when giving the List back to Session Bean
    (see Exception details below)
    The same code runs without any trouble on Jboss Application Server 4.0.3
    Any help would be great!
    Please see code below
    Statefull Session Bean
    <code>
    package ejb;
    import data.Produkt;
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Iterator;
    import javax.ejb.*;
    * This is the bean class for the WarenkorbBean enterprise bean.
    * Created 17.03.2006 09:53:25
    * @author Administrator
    public class WarenkorbBean implements SessionBean, WarenkorbRemoteBusiness, WarenkorbLocalBusiness {
    private SessionContext context;
    // <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click the + sign on the left to edit the code.">
    // TODO Add code to acquire and use other enterprise resources (DataSource, JMS, enterprise bean, Web services)
    // TODO Add business methods or web service operations
    * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
    public void setSessionContext(SessionContext aContext) {
    context = aContext;
    * @see javax.ejb.SessionBean#ejbActivate()
    public void ejbActivate() {
    * @see javax.ejb.SessionBean#ejbPassivate()
    public void ejbPassivate() {
    * @see javax.ejb.SessionBean#ejbRemove()
    public void ejbRemove() {
    // </editor-fold>
    * See section 7.10.3 of the EJB 2.0 specification
    * See section 7.11.3 of the EJB 2.1 specification
    public void ejbCreate() {
    // TODO implement ejbCreate if necessary, acquire resources
    // This method has access to the JNDI context so resource aquisition
    // spanning all methods can be performed here such as home interfaces
    // and data sources.
    // Add business logic below. (Right-click in editor and choose
    // "EJB Methods > Add Business Method" or "Web Service > Add Operation")
    public Collection erzeugeWarenkorb() {
    //TODO implement erzeugeWarenkorb
    ArrayList myList = new ArrayList();
    for (int i=0;i<10;i++)
    Produkt prod = new Produkt();
    prod.setID(i);
    prod.setName("Produkt"+i);
    myList.add(prod);
    return myList;
    public void leseWarenkorb(Collection Liste) {
    //TODO implement leseWarenkorb
    Iterator listIt = Liste.iterator();
    while(listIt.hasNext())
    Produkt p = (Produkt)listIt.next();
    System.out.println("Name des Produktes {0} "+p.getName());
    </code>
    <code>
    package data;
    import java.io.Serializable;
    * @author Administrator
    public class Produkt implements Serializable {
    private int ID;
    private String Name;
    /** Creates a new instance of Produkt */
    public Produkt() {
    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;
    </code>
    <code>
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@page import="java.util.*"%>
    <%@page import="data.*"%>
    <%@page import="javax.naming.*"%>
    <%@page import="javax.rmi.PortableRemoteObject"%>
    <%@page import="ejb.*"%>
    <%--
    The taglib directive below imports the JSTL library. If you uncomment it,
    you must also add the JSTL library to the project. The Add Library... action
    on Libraries node in Projects view can be used to add the JSTL 1.1 library.
    --%>
    <%--
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    --%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <h1>Online Shop Warenkorb Test</h1>
    <%--
    This example uses JSTL, uncomment the taglib directive above.
    To test, display the page like this: index.jsp?sayHello=true&name=Murphy
    --%>
    <%--
    <c:if test="${param.sayHello}">
    <!-- Let's welcome the user ${param.name} -->
    Hello ${param.name}!
    </c:if>
    --%>
    <%
    Context myEnv = null;
    WarenkorbRemote wr = null;
    // Context initialisation
    try
    myEnv = (Context)new javax.naming.InitialContext();
    /*Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
    //env.put(Context.PROVIDER_URL, "jnp://wotan.activenet.at:1099");
    env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
    env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
    myEnv = new InitialContext(env);*/
    catch (Exception ex)
    System.err.println("Fehler beim initialisieren des Context: " + ex.getMessage());
    // now lets work
    try
    Object ref = myEnv.lookup("ejb/WarenkorbBean");
    //Object ref = myEnv.lookup("WarenkorbBean");
    WarenkorbRemoteHome warenkorbrhome = (WarenkorbRemoteHome)
    PortableRemoteObject.narrow(ref, WarenkorbRemoteHome.class);
    wr = warenkorbrhome.create();
    ArrayList myList = (ArrayList)wr.erzeugeWarenkorb();
    Iterator it = myList.iterator();
    while(it.hasNext())
    Produkt p = (Produkt)it.next();
    %>
    ProduktID: <%=p.getID()%><br></br>Produktbezeichnung:
    <%=p.getName()%><br></br><%
    wr.leseWarenkorb(myList);
    catch(Exception ex)
    %><p style="color:red">Onlineshop nicht erreichbar</p><%=ex.getMessage()%>
    <% }
    %>
    </body>
    </html>
    </code>
    the exception
    CORBA MARSHAL 1398079745 Maybe; nested exception is: org.omg.CORBA.MARSHAL: ----------BEGIN server-side stack trace---------- org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:8101) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1013) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:879) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_1_0.java:873) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_1_0.java:863) at com.sun.corba.ee.impl.encoding.CDRInputStream.read_abstract_interface(CDRInputStream.java:275) at com.sun.corba.ee.impl.io.IIOPInputStream.readObjectDelegate(IIOPInputStream.java:363) at com.sun.corba.ee.impl.io.IIOPInputStream.readObjectOverride(IIOPInputStream.java:526) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:333) at java.util.ArrayList.readObject(ArrayList.java:591) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.sun.corba.ee.impl.io.IIOPInputStream.invokeObjectReader(IIOPInputStream.java:1694) at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1212) at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:400) at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:330) at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:296) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1034) at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:259) at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.read(DynamicMethodMarshallerImpl.java:333) at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.readArguments(DynamicMethodMarshallerImpl.java:393) at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121) at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:648) at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:192) at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1709) at com.sun.corba.ee.impl.protocol.SharedCDRClientRequestDispatcherImpl.marshalingComplete(SharedCDRClientRequestDispatcherImpl.java:155) at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:184) at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:129) at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:150) at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(Unknown Source) at ejb._WarenkorbRemote_DynamicStub.leseWarenkorb(_WarenkorbRemote_DynamicStub.java) at org.apache.jsp.index_jsp._jspService(index_jsp.java:122) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105) at javax.servlet.http.HttpServlet.service(HttpServlet.java:860) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:297) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:247) at javax.servlet.http.HttpServlet.service(HttpServlet.java:860) at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAsPrivileged(Subject.java:517) at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282) at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257) at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55) at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161) at java.security.AccessController.doPrivileged(Native Method) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:189) at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doProcess(ProcessorTask.java:604) at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:475) at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:371) at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:264) at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:281) at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:83) Caused by: java.lang.ClassNotFoundException ... 69 more ----------END server-side stack trace---------- vmcid: SUN minor code: 257 completed: Maybe

    Hi,
    I have found a way out by passing the reference of my EJB in the HttpSession object and using it inside the javabean..

  • How to convert the source code in JSP,HTML&BEANS into executable files?

    Sir,
    We are developing one s/w product in JSP,HTML&BEANS.Now we are in the implementation phase.During the time of Installation,without copying our source code in the customer's site I want to copy the executable files of the entire source codes? Is it possible in JSP,HTML&BEANS?

    In theory you can do it even with JSP but the you will be unable to run it on the standard JSP engine. :-)
    From other hand, all critical logic should be in the Java Beans or at least in custom tags but not in the JSP code. Then you can protect that code and leave JSP open because there is nothing to steal or break.

  • JSP Accesing Bean Problem

    I need a help in this jsp and bean Please provide the solution
              This is the bean
              import java.text.*;
              import java.util.*;
              import java.io.Serializable;
              public class DateBean implements Serializable {
              public DateBean() {}
              SimpleDateFormat sdf;
              public void setFormat(String format) {
              sdf = new SimpleDateFormat(format);
              public String getCurrentTime() {
              return sdf.format(new Date());
              This is the date.jsp
              <html>
              <head>
              <title>A JSP that sets a property</title>
              </head>
              <body>
              The current time and date, in several formats, courtesy
              a bean:<p>
              <!-- begin example -->
              <jsp:useBean
              id="date"
              class="DateBean"/>
              <ul>
              <jsp:setProperty name="date" property="format"
              value="EEEE, MMMM dd yyyy 'at' hh:mm"/>
              <li><jsp:getProperty name="date" property="currentTime"/>
              <jsp:setProperty name="date" property="format"
              value="hh:mm:ss MM/dd/yy"/>
              <li><jsp:getProperty name="date" property="currentTime"/>
              <jsp:setProperty name="date" property="format"
              value="yyyyy.MMMMM.dd GGG hh:mm aaa"/>
              <li><jsp:getProperty name="date" property="currentTime"/>
              </ul>
              <!-- end example -->
              </body>
              </html>
              AND THIS is the compilation error
              Error: [jspc]: 1 file(s) failed:
              /dates.jsp
              [Compilation errors : ]
              E:\DateBean\__dates.java:134: cannot resolve symbol
              symbol : class DateBean
              location: class jsp_servlet.__dates
              DateBean date = null; //[ /dates.jsp; Line: 13]
              ^
              E:\DateBean\__dates.java:135: cannot resolve symbol
              symbol : class DateBean
              location: class jsp_servlet.__dates
              date = (DateBean)pageContext.getAttribute("date"); //[ /dates.jsp; Line: 13]
              ^
              E:\DateBean\__dates.java:138: cannot resolve symbol
              symbol : class DateBean
              location: class jsp_servlet.__dates
              date = (DateBean)pageContext.getAttribute("date"); //[ /dates.jsp; Line: 13]
              ^
              E:\DateBean\__dates.java:140: cannot resolve symbol
              symbol : class DateBean
              location: class jsp_servlet.__dates
              date = new DateBean(); //[ /dates.jsp; Line: 13]
              ^
              4 errors
                   at weblogic.jspc.doCompile(Ljava.lang.String;Ljava.util.List;Lweblogic.utils.Getopt2;ZLjava.lang.String;)V(jspc.java:839)
                   at weblogic.jspc.runJspc(Lweblogic.utils.classloaders.GenericClassLoader;Ljava.io.File;Ljava.util.Map;Z)V(jspc.java:632)
                   at weblogic.jspc.runBodyInternal()V(jspc.java:410)
                   at weblogic.jspc.runBody()V(jspc.java:319)
                   at weblogic.utils.compiler.Tool.run([Ljava.lang.String;)V(Tool.java:146)
                   at weblogic.utils.compiler.Tool.run()V(Tool.java:103)
                   at weblogic.jspc.main([Ljava.lang.String;)V(jspc.java:708)
              java.lang.Exception: [Compilation errors : ]
              E:\DateBean\__dates.java:134: cannot resolve symbol
              symbol : class DateBean
              location: class jsp_servlet.__dates
              DateBean date = null; //[ /dates.jsp; Line: 13]
              ^
              E:\DateBean\__dates.java:135: cannot resolve symbol
              symbol : class DateBean
              location: class jsp_servlet.__dates
              date = (DateBean)pageContext.getAttribute("date"); //[ /dates.jsp; Line: 13]
              ^
              E:\DateBean\__dates.java:138: cannot resolve symbol
              symbol : class DateBean
              location: class jsp_servlet.__dates
              date = (DateBean)pageContext.getAttribute("date"); //[ /dates.jsp; Line: 13]
              ^
              E:\DateBean\__dates.java:140: cannot resolve symbol
              symbol : class DateBean
              location: class jsp_servlet.__dates
              date = new DateBean(); //[ /dates.jsp; Line: 13]
              ^
              4 errors
                   at weblogic.jspc.doCompile(Ljava.lang.String;Ljava.util.List;Lweblogic.utils.Getopt2;ZLjava.lang.String;)V(jspc.java:842)
                   at weblogic.jspc.runJspc(Lweblogic.utils.classloaders.GenericClassLoader;Ljava.io.File;Ljava.util.Map;Z)V(jspc.java:632)
                   at weblogic.jspc.runBodyInternal()V(jspc.java:410)
                   at weblogic.jspc.runBody()V(jspc.java:319)
                   at weblogic.utils.compiler.Tool.run([Ljava.lang.String;)V(Tool.java:146)
                   at weblogic.utils.compiler.Tool.run()V(Tool.java:103)
                   at weblogic.jspc.main([Ljava.lang.String;)V(jspc.java:708)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    I just wanted to say THANK YOU! This stuff can be a real pain when all the documentation shows everything should be working but it doesn't.
    I will pass on this little piece of info to the next confused person.
    shoot me an e-mail sometime [email protected]

  • How to create two level dynamic list using JSP , Java Script and Oracle

    I am new in JSP. And i am facing problem in creating two level dynamic list using JSP ,Java Script where the listdata will come from Oracle 10g express edition database. Is there any easy way in JSP that is available on in ASP.NET.
    Plz response with details.

    1) Learn JDBC API [http://java.sun.com/docs/books/tutorial/jdbc/index.html].
    2) Create DAO class which contains JDBC code and do all SQL queries and returns or takes ID's or DTO objects.
    3) Learn Servlet API [http://java.sun.com/javaee/5/docs/tutorial/doc/].
    4) Create Servlet class which calls the DAO class, gets the list of DTO's as result, puts it as a request attribute and forwards the request to a JSP page.
    5) Learn JSP and JSTL [http://java.sun.com/javaee/5/docs/tutorial/doc/]. Also learn HTML if you even don't know it.
    6) Create JSP page which uses the JSTL c:forEach tag to access the list of DTO's and iterate over it and prints a HTML list out.
    You don't need Javascript for this.

  • How to process list within list in jsp

    Hi,
    I have to read values from list within the list in jsp. I got list of objects and I am reading the variables from it in jsp. for that I iterate through the list, read the variable from the object.
    I use
    <logic:iterate name="searchFormBean" property="policies" id="policiesList" indexId="index">
    and reading the variable like below.
    <html:hidden name="searchFormBean" property='<%= "partyId[" + index + "]" %>' />
    and I have method getPartyId(int index, String text) in searchFormBean class.
    now I have a problem that object has list variable which has to be read.
    I am not sure of how to pass both the index (index of object list and index of list within the object).
    I have method getIds(int index, int listIndex, String text)
    Please let me know how should I write code in jsp to call the above method.
    Thanks & Regards,
    Nasrin.N

    <%
    getPartyId(int index, String text);
    %>
    Nasree ..its quite confusin ur question...forget abt implementation..just tell us in detail what ur rqmt is..
    regards
    shanu

  • Sample jsp servlet bean (MVC) code

    We want to look into the JSP/Servlet/Bean area for our next project. We wish to understand the technology and as such want to hand build simple applications, and as such do not want to use JDeveloper just yet.
    We have searched and searched for suitable material but cannot anywhere find a sample application that :
    A. Lists contents of a databse table
    B. Each item in trhe list is a link to a page that allows that item, to be edited.
    C. A new item can be added.
    D. Uses the MVC model of JSP/Servlet and bean (preferably with no custom tags)
    There are examples that are too simplistic and do not cover the whole picture. Having spent over 100 GBP on books lately, only to be disappointed with the examples provided, we need to see some sample code.
    The samples provided by Oracle are too simplistic. They should really have provided ones built around the EMP and DEPT tables.
    Anyone know where we can get hold of this sample code.

    At the risk of sounding really dumb the examples are just too complex. There does not appear to be anywhere on the web where I can find a simple JSP/servlet/bean example of the type I described. There is enouigh material describing each individual component, but what I need is an example to cement the ideas, but the ones suggested are too much for a newbie. Even the much vaunted Pet Store thingy causes my eyes to glaze over.
    I dont expect anyone to have written something with my exact requirements, but surely to goodness there must be something that:
    1. On entry presents a search form on a table (e.g. EMP)
    2. On submission list all rows in EMp matchiung the criteria.
    3. The user can either click the link 'Edit' which opens up a form dispalying the row allowing the user to edit and save the changes, or click the 'New' button to show a blank form to create a new EMP.
    All this via a Controller servlet, with the database logic handled by a java bean, and all the presentation done via JSP.
    To me this is the most obvious and instructive example of this technology, but after days of trawling the web, and looking through a number of books, I cannot find such a thing.
    CGI with Perl DBI/DBD was a breeze to work with compared to this stuff ..... maybe ASP with SQL/Server would be a more fruitful use of time.

  • How 2 disply 2 or More coulmns from the DBase to Dropdown list in JSP

    Dear Friends,
    Please can anyone help us, on displaying the 2 or more columns into a single Dropdown list in the JSP page, by using Struts-tag Libraries
    We are displayig only 1 coulmn from the DBase resultset to Dropdown list,
    When we try to concatenate, 2 columns of the resulset, the data format has changed
    Please help, Early response is appreciated
    Thanking you
    Jagadish

    WE are using sturts , Fallowing is code for
    extracting the O_NOUN and O_MODIFIER table Columns from the DBase and setting into
    "mat_Reg_ActionForm" form
         Statement stmt = null;
         ResultSet rs = null;
         ArrayList objQualList = new ArrayList();
         String query = " SELECT UNIQUE O_NOUN , O_MODIFIER FROM O_NOUN_MOD ";     
         stmt = conn.createStatement();
    rs = stmt.executeQuery(query);
         String columnLabel = (rsmd.getColumnName(0)+"|"+rsmd.getColumnName(1));
         String columnLabel = "Object"+"|"+"Modifier";
         objQualList.add(columnLabel);
         while(rs.next())
         String objModifier = (rs.getString("O_NOUN")+"|"+rs.getString("O_MODIFIER"));     
         objQualList.add(objModifier);
         mat_Reg_ActionForm.setObject(objQualList);
    Fallowing the iteration with which we are displaying the data in the Drop downl List
    "mat_Reg.jsp"
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <html>
    <head><title></title>
    </head>
    <body>
    <html:form action="mat_Reg.do" name="mat_Reg_ActionForm" type="com.pilog.bo.ManfPartNoActionForm">
         <html:select name="mat_Reg_ActionForm" property="object">
              <html:options name="mat_Reg_ActionForm" property="object"/>
         </html:select>
    </TR>
    </TABLE>
    </html:form>
    </body>
    </html>
    Is this code will help you give us some guidence ! Your early reply will be appreciated
    Thankng you

  • How to retrieve datas from database to dropdown list in jsp

    hai.
    please tell me how to retrieve a perticular field list from database to a drop down list using jsp. i am new to jsp. i am doing employee management system. in that i need to edit employee's details as like.
    so that i want to display employee id's in a drop down list. i want to retrieve from database and display.
    please help me in this .
    advance thanks.

    Hello friendz,
    If tht is the i wud suggest if guyz can go wid AJAX...
    try to make use of xmlHttp Object and generate a new dependent drop down by using a property from a bean->servlet->VIEW(FORM)
    else save the form state in a session and then refersh it. once all in again.
    i had a similar problem which i solved in the following way
    Hi friend,
    I had a similar situation and i tried to solve it by using XmlHttpRequest Object(used in AJAX).
    U can checkout the below example just for further reference delete
    UserForm.jsp:
    ==========
    <head>
    <script>
    var xmlHttp
    function showState(str)
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null)
    alert ("Browser does not support HTTP Request")
    return
    var url="getState.jsp"
    url=url+"?count="+str
    url=url+"&sid="+Math.random()
    xmlHttp.onreadystatechange=stateChange
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
    function stateChange()
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
    document.getElementById("state").innerHTML=xmlHttp.responseText
    </head>
    <body>
    <select name='country' onchange="showState(this.value)">
    <option value='india>india</option>
    </select>
    <br>
    <div id='state'>
    <select name='state' >
    <option value='-1'>pickone</option>
    </select>
    </div>
    </body>       
    getState.jsp
    ============
    <%@page language="java" import ="java.util.Hashtable" import ="java.util.Set" %>
    <%
    String country=request.getParameter("count");
    response.setContentType("text/html");
    response.setHeader("Cache-Control","no-cache");
    try{
    Hashtable ht = (Hashtable)session.getAttribute("<ATTRIBUTE_NAME>");
    String buffer="<select name='state'><option value='-1'>Pick One</option>";
    Set s=ht.keySet();
    Object keys[]=s.toArray();
    int size=keys.length;
    for(int i=0; i < size;i++){
    buffer=buffer+"<option value='"+ht.get(keys).toString()+"'>"+ht.get(keys).toString()+"</option>";
    buffer=buffer+"</select>";
    response.getWriter().println(buffer);
    catch(Exception exp){
    response.getWriter().println(exp);
    %>

  • Including JSP without repeating code

    My webproject has multiple processes, which use JSP files which are included into the index.jsp by a view ID. For example index.jsp?id=4 includes the work_4.jsp file which has speficic code for that proces.
    The problem is that I use a javabean which handles my select queries. Index.jsp uses this bean for displaying some buttons which are stored inside a MySQL database.
    In the work_4.jsp which is included, I have to use the bean to get data. The problem is that i need to define the bean again, as well as the import of the class itself.
    Is there a way to use the bean from the index.jsp inside the included work_4.jsp without redefining the javabean?
    <%@
       // index.jsp
       import "queryhandler"
    %>
       <jsp:useBean id="queryBean" class="queryhandler" scope="session">
         <jsp:setProperty name="queryBean" property="SQLString"/>
         <jsp:setProperty name="queryBean" property="SQLLabelMax"/>
       </jsp:useBean>
       <jsp:include page="work_4.jsp" flush="true" />
    <%@
       // work_4.jsp
       import "queryhandler"
    %>
       <jsp:useBean id="queryBean" class="queryhandler" scope="session">
         <jsp:setProperty name="queryBean" property="SQLString"/>
         <jsp:setProperty name="queryBean" property="SQLLabelMax"/>
       </jsp:useBean>
       ... some code ...Now I want work_4.jsp to look something like this.
    <%
       // work_4.jsp
    %>
       <jsp:setProperty name="queryBean" property="SQLString"/>
       <jsp:setProperty name="queryBean" property="SQLLabelMax"/>
       ... some code ...

    I'm not sure if this is quite what you want but I tried the following and it works for me without the full jsp:useBean declaration in the included file. You don't need the import statement as long as the full package statement is in the "class" param of the useBean tag. I just stuck my bean in the WEB-INF/classes, so there's no package.
    jengi
    test.jsp:
    <html>
    <body>
    <jsp:useBean id="testBean" class="TestBean" scope="session">
    <jsp:setProperty name="testBean" property="*" />
    <jsp:setProperty name="testBean" property="*" />
    </jsp:useBean>
    <jsp:include page="testinclude.jsp" flush="true" />
    </body>
    </html>
    testinclude.jsp:
    <jsp:useBean id="testBean" class="TestBean" scope="session" />
    <jsp:getProperty name="testBean" property="firstName"/>
    <jsp:getProperty name="testBean" property="lastName"/>
    TestBean.java:
    public class TestBean {
    private String first = "";
    private String last = "";
    public void setFirstName(String first) {
    this.first = first;
    public void setLastName(String last) {
    this.last = last;
    public String getFirstName() {
    return this.first;
    public String getLastName() {
    return this.last;

  • In Ical, can you print a list view calendar without notes?

    In Ical, can you print a list view calendar without notes?

    cj,
    After selecting Calendar>File>Print...> I am presented with a Print selection pane which offers among other choices, a "List" selection:
    What do you see?

  • How to call a class file in a jsp without deploying anything in j2ee

    Hi,
    I am new in J2EE. I have some jsps, which I configured using web.properties(documentroot=c:/jsp/). I am able to get
    those pages by the web browser. I have some import statements in some jsps, now I
    am trying to access those page but it is failing, it says
    org.apache.jasper.JasperException: Unable to compile class for
    JSPD:\j2sdkee1.3\repository\pradip\web\_0002fLogin_0002ejspLogin_jsp_0.java:1:
    Class com.gui.UPMGuiGlobalConstants not found in import.
    import com.gui.UPMGuiGlobalConstants;
    Actually I have not deployed any class file or jsps.. Now my question is can I access
    these jsps without deploying anything, like can I put my .jar file in any j2ee
    directory(like lib or anywhere else, I already tried after putting in /lib) and restart the
    j2ee and use it. So how can I call a class file from a jsp without any kind of
    deployment?
    Please send me the reply as soon as possible.
    Regds,
    Pradip

    After you put the jar containing the class to import into the WEB-INF/lib directory, you still need to include it in the jsp.
    Putting the jar into the lib dir, will make it available to the vm, but as in any other java class, you still need to import it into the class, that the jsp will be compiled into.
    And you do that by putting
    <%@page import="com.gui.UPMGuiGlobalConstants" %>somewhere near the top of your jsp. (well you don't need to put it there, but it good style ;)
    That should do it.

  • 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>

  • How can I add more than one submit button in a jsp without use of javascrip

    I want to add more than one submit button in a jsp without use of javascript

    you can do add multiple submit button with this way
    <input type="submit" value="Previous" />
    <input type="submit" value="Next" />
    <input type="submit" value="Finish" />

Maybe you are looking for

  • Gui_download - not work

    hi everyone, i have a test program and there i use gui_upload/download and its work fine. when i use those function in the main program it not work. so i tried to use read dataset....and its not work in both cases. (test prog and not in the main prog

  • Changes to 3rd party cookies options are not saved

    I want to change Cookies setting to allow 3rd party cookies because an important website that I access frequently says that my browser (Firefox) does not accept these cookies. I am following the Firefox Support instructions @ https://support.mozilla.

  • Lycom PCIe SATAII Host Card, 4 eSATA External Ports Question

    http://www.macgurus.com/productpages/sata/LYCeSATA-4e.php We have this set up as a Raid 1 but it's pretty unstable with external drives. We would like to switch to Raid 5 formatting but it notes: *Do not under any circumstances install the SIliconIma

  • Ethernet OAM CFM to take interface down

    Hi, I'd like to use CFM to take a link down when the remote side is not responding any more as the link is disrupted. Platform is CRS-1 w. IOS-XR 4.1: Here my configuration: ethernet cfm domain md0 level 4 id string crs_196_P2   service ma0 down-meps

  • Using external AS3 classes in a FlasCC SWC

    I am building a Flascc SWC, which is to be used in a regular Flash swf, build in FlashBuilder 4.6. I have managed to build an API that uses regular built-in types, like Number, uint.  However, when I try to pass in or out a class type of my own creat