Help on JSP and Beans!
Hi! I am new to JSP and I need help on how to utilize java bean on JSP. I have gone through this forum, I found similar question but did not find any answer that could solve my question. Tons of thanks to anyone who could help me out!
I have a java bean class called Bean1, which I put under /ROOT/WEB-INF/classes/, and a JSP file that utilizes class Bean1, saved under /ROOT/, which should be a correct way indicated by several posts I found in this forum. But when I try to compile the JSP file over TOMCAT4.1 over http://localhost:8080/beanexample1.jsp, it throws me a lot of error messages (see below). I've been struggling for so long. Any help is greatly apprecitated! Thanks!
Bo
The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 0 in the jsp file: /beanexample1.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\beanexample1_jsp.java:41: cannot resolve symbol
symbol : class Bean1
location: class org.apache.jsp.beanexample1_jsp
Bean1 bean1 = null;
^
An error occurred at line: 0 in the jsp file: /beanexample1.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\beanexample1_jsp.java:43: cannot resolve symbol
symbol : class Bean1
location: class org.apache.jsp.beanexample1_jsp
bean1 = (Bean1) pageContext.getAttribute("bean1", PageContext.PAGE_SCOPE);
^
An error occurred at line: 0 in the jsp file: /beanexample1.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\beanexample1_jsp.java:46: cannot resolve symbol
symbol : class Bean1
location: class org.apache.jsp.beanexample1_jsp
bean1 = (Bean1) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "Bean1");
^
An error occurred at line: 13 in the jsp file: /beanexample1.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\beanexample1_jsp.java:66: cannot resolve symbol
symbol : class Bean1
location: class org.apache.jsp.beanexample1_jsp
out.print(JspRuntimeLibrary.toString((((Bean1)pageContext.findAttribute("bean1")).getName())));
^
An error occurred at line: 16 in the jsp file: /beanexample1.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\beanexample1_jsp.java:69: cannot resolve symbol
symbol : class Bean1
location: class org.apache.jsp.beanexample1_jsp
out.print(JspRuntimeLibrary.toString((((Bean1)pageContext.findAttribute("bean1")).getSeventhPrimeNumber())));
^
An error occurred at line: 19 in the jsp file: /beanexample1.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\beanexample1_jsp.java:72: cannot resolve symbol
symbol : class Bean1
location: class org.apache.jsp.beanexample1_jsp
out.print(JspRuntimeLibrary.toString((((Bean1)pageContext.findAttribute("bean1")).getCurrentTime())));
^
An error occurred at line: 27 in the jsp file: /beanexample1.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\beanexample1_jsp.java:79: cannot resolve symbol
symbol : class Bean1
location: class org.apache.jsp.beanexample1_jsp
out.print(JspRuntimeLibrary.toString((((Bean1)pageContext.findAttribute("bean1")).getColor())));
^
7 errors
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:340)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:352)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:184)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
at java.lang.Thread.run(Thread.java:484)
you need to put your bean in a package. do this by
making a sub directory under the classes directory,
let's say you call it "mybeans".
so copy Bean1.java to
/ROOT/WEB-INF/classes/Bean1.java
add the line "package mybeans;"
to the top of the Bean1.java file,
and then compile it there.
the standard way to use the bean in your jsp file is like this:
<jsp:useBean id="thisbean" scope="page" class="mybeans.Bean1" />
this <jsp:usebean> tag instantiates the bean for you.
then refer to it by its id:
thisbean.myMethod();
thisbean.setProperty();
I have a java bean class called Bean1, which I put
under /ROOT/WEB-INF/classes/, and a JSP file that
utilizes class Bean1, saved under /ROOT/, which should
be a correct way indicated by several posts I found in
this forum. But when I try to compile the JSP file
over TOMCAT4.1 over
http://localhost:8080/beanexample1.jsp, it throws me a
lot of error messages (see below). I've been
struggling for so long. Any help is greatly
apprecitated! Thanks!
Bo
The server encountered an internal error () that
prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile
class for JSP
An error occurred at line: 0 in the jsp file:
/beanexample1.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\_\beanexample1_jsp.java:4
: cannot resolve symbol
symbol : class Bean1
location: class org.apache.jsp.beanexample1_jsp
Bean1 bean1 = null;
^
An error occurred at line: 0 in the jsp file:
/beanexample1.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\_\beanexample1_jsp.java:4
: cannot resolve symbol
symbol : class Bean1
location: class org.apache.jsp.beanexample1_jsp
bean1 = (Bean1)
(Bean1) pageContext.getAttribute("bean1",
PageContext.PAGE_SCOPE);
^
An error occurred at line: 0 in the jsp file:
/beanexample1.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\_\beanexample1_jsp.java:4
: cannot resolve symbol
symbol : class Bean1
location: class org.apache.jsp.beanexample1_jsp
bean1 = (Bean1)
1 = (Bean1)
java.beans.Beans.instantiate(this.getClass().getClassLo
der(), "Bean1");
^
An error occurred at line: 13 in the jsp file:
/beanexample1.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\_\beanexample1_jsp.java:6
: cannot resolve symbol
symbol : class Bean1
location: class org.apache.jsp.beanexample1_jsp
out.print(JspRuntimeLibrary.toString((((Bean1)pageCont
xt.findAttribute("bean1")).getName())));
^
An error occurred at line: 16 in the jsp file:
/beanexample1.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\_\beanexample1_jsp.java:6
: cannot resolve symbol
symbol : class Bean1
location: class org.apache.jsp.beanexample1_jsp
out.print(JspRuntimeLibrary.toString((((Bean1)pageCont
xt.findAttribute("bean1")).getSeventhPrimeNumber())));
^
An error occurred at line: 19 in the jsp file:
/beanexample1.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\_\beanexample1_jsp.java:7
: cannot resolve symbol
symbol : class Bean1
location: class org.apache.jsp.beanexample1_jsp
out.print(JspRuntimeLibrary.toString((((Bean1)pageCont
xt.findAttribute("bean1")).getCurrentTime())));
^
An error occurred at line: 27 in the jsp file:
/beanexample1.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\_\beanexample1_jsp.java:7
: cannot resolve symbol
symbol : class Bean1
location: class org.apache.jsp.beanexample1_jsp
out.print(JspRuntimeLibrary.toString((((Bean1)pageCont
xt.findAttribute("bean1")).getColor())));
^
7 errors
at
org.apache.jasper.compiler.DefaultErrorHandler.javacEr
or(DefaultErrorHandler.java:130)
at
org.apache.jasper.compiler.ErrorDispatcher.javacError(
rrorDispatcher.java:293)
at
org.apache.jasper.compiler.Compiler.generateClass(Comp
ler.java:340)
at
org.apache.jasper.compiler.Compiler.compile(Compiler.j
va:352)
at
org.apache.jasper.JspCompilationContext.compile(JspCom
ilationContext.java:474)
at
org.apache.jasper.servlet.JspServletWrapper.service(Js
ServletWrapper.java:184)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(Js
Servlet.java:295)
at
org.apache.jasper.servlet.JspServlet.service(JspServle
.java:241)
at
javax.servlet.http.HttpServlet.service(HttpServlet.jav
:853)
at
org.apache.catalina.core.ApplicationFilterChain.intern
lDoFilter(ApplicationFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilt
r(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(S
andardWrapperValve.java:260)
at
org.apache.catalina.core.StandardPipeline$StandardPipe
ineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(Stand
rdPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(Containe
Base.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(S
andardContextValve.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipe
ineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(Stand
rdPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(Containe
Base.java:995)
at
org.apache.catalina.core.StandardContext.invoke(Standa
dContext.java:2415)
at
org.apache.catalina.core.StandardHostValve.invoke(Stan
ardHostValve.java:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipe
ineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke
ErrorDispatcherValve.java:170)
at
org.apache.catalina.core.StandardPipeline$StandardPipe
ineValveContext.invokeNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(Err
rReportValve.java:172)
at
org.apache.catalina.core.StandardPipeline$StandardPipe
ineValveContext.invokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(Stand
rdPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(Containe
Base.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(St
ndardEngineValve.java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipe
ineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(Stand
rdPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(Containe
Base.java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(Coyote
dapter.java:223)
at
org.apache.coyote.http11.Http11Processor.process(Http1
Processor.java:432)
at
org.apache.coyote.http11.Http11Protocol$Http11Connecti
nHandler.processConnection(Http11Protocol.java:386)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolT
pEndpoint.java:534)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunna
le.run(ThreadPool.java:530)
at java.lang.Thread.run(Thread.java:484)
Similar Messages
-
Please recommend IDE for JSP and Beans
Hi guys,
I am looking for a decent IDE to work with JSP and Beans. I have tried JBuilder which has too much going on at the same time and I find it to be an overkill for what I am doing; I find NetBeans kind of irritating. I develop web applications, hence I dont need any GUI stuff for beans.
Just looking for something that will enable me to rapidly develop beans as a support system for JSP pages and at the same time, it should provide good support for coding JSP pages. Little bit of management functions wont hurt either, but are not required. I dont mind if I have to pay for the IDE. Any recommendations?I like Eclipse for Java Development, and I use the MyEclipse plug-in for J2EE development.
There is a free J2EE plug-in (Lomboz) but I'd much rather pay the $29.99/year for MyEclipse. It's been perfect for me. -
JSP AND BEAN PROBLEm java.lang.nullpointerexception help me please
hello i have a problem, when i open login.jsp and enter the form i have nullpointerexception. i don't understand where i wrong... i use tomcat 5.5 ... sorry for my english i'm italian and i speak only italian :(
login.jsp this is the code of the java server page
<html>
<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="lavoro" scope="page" class="Ok.Dino"/>
<%@ page session="false" %>
<style type="text/css">
<!--
body {
background-color: #003366;
a:link {
color: #CCCCCC;
.style1 {
color: #000000;
font-weight: bold;
font-size: x-large;
.style4 {font-size: 18px}
-->
</style>
<body>
<%if(request.getMethod()=="GET"){
%>
<form action="login.jsp" method= "POST" name="frmlogin" id="frmlogin">
<div align="center">
<p class="style1">AUTENTICAZIONE</p>
<p> </p>
<table width="318" height="140" border="1">
<tr>
<td width="95" height="60" bordercolor="#000000" bgcolor="#0066CC"><p align="center"><strong>USER</strong></p> </td>
<td width="207" bgcolor="#0099CC"><p align="center">
<input type="text" name="txtnome"></p>
</td>
</tr>
<tr>
<td height="72" bordercolor="#000000" bgcolor="#0066CC"><strong>PASSWORD</strong> </td>
<td width="207" bgcolor="#0099CC"><div align="center">
<input name="pwdtxt" type="password">
</div></td>
</tr>
</table>
<table width="318" border="1">
<tr>
<td width="318" height="87"> <div align="center">
<input name="submit" type="submit" value="invia" >
</div>
<p align="center"><strong><span class="style4">Se non sei registrato fallo <a href="file:///C|/Documents and Settings/access/Documenti/My Received Files/registrazione.jsp">adesso </a></span></strong></p></td>
</tr>
</table>
<p> </p>
<p> </p>
</div>
</form>
<%}else { %>
<%lavoro.settxtnome(request.getParameter("txtnome"));%>
<%!ResultSet rs=null;
String x=null;
%>
<% lavoro.cn_db("dbutenti");%>
<% rs=lavoro.run_query("SELECT user FROM utenti");%>
<%}%>
</body>
</html>and this is the bean code
package Ok;
import java.sql.*;
public class Dino
private String txtnome,pwdtxt;
private Connection cn=null;
private Statement st=null;
private ResultSet Rs=null;
public String gettxtnome()
return txtnome;
public String getpwdtxt()
return pwdtxt;
public void settxtnome(String n)
this.txtnome=n;
public void setpwdtxt(String n)
this.pwdtxt=n;
public void cn_db(String db)
if(cn==null){
//1. Caricamento del driver
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}catch(ClassNotFoundException cnfe){
System.out.println("impossibile caricare il driver");
System.exit(1);
try{
//2. Connessione al DB
cn = DriverManager.getConnection("jdbc:odbc:"+db);
//3. creazione degli oggetti Statement e ResultSet
st =cn.createStatement();
}catch(SQLException e){
System.out.println(e+"jjj");
}else{
System.out.print("errore database gi�� creato");
public ResultSet run_query(String qr)
try{
Rs=st.executeQuery(qr);
}catch(SQLException e)
System.out.print(e+"ecco l'error");
return Rs;
}Do you understand when a NullPointerException will be thrown? This will be thrown if you want to access an uninstantiated Object.
So look to the stacktrace and go to the line where the NPE is been thrown and doublecheck if the object reference is actually instantiated.
Or add a null-check to the object reference:if (someObject != null) {
someObject.doSomething();
}or just instantiate it:if (someObject == null) {
someObject = new SomeObject();
someObject.doSomething(); -
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: MaybeHi,
I have found a way out by passing the reference of my EJB in the HttpSession object and using it inside the javabean.. -
Help with jsp and javaBean in eclipse/Tomcat
Hi,
I am new to JSP and JavaBean. I am going through tutorial for a jsp page that uses a javaBean. I am using eclipse to create jsp page and the java bean.
My eclipse project "Date" has five package as under:-
1. Deployment Descriptor
2. Java Resources: src
3. build
4. WebContent
I have my data.jsp page in WebContent/WEB-INF/ folder. When I just run date.jsp in a browser as: http://localhost:8080/Date/date.jsp, it gets launched into the browser correctly. But when I add a JavaBean "TimeFormatterBean.java" in the Java Resources:src folder and use it in date.jsp page, I get errors as under:-
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 5 in the jsp file: /date.jsp
TimeFormatterBean cannot be resolved to a type
2: pageEncoding="ISO-8859-1"%>
3: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4:
5: <jsp:useBean id="formatter" class="TimeFormatterBean"/>
6:
7: <html>
8: <head>
The data.jsp page is as under:-
<jsp:useBean id="formatter" class="TimeFormatterBean"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1> Date JSP </h1>
<p> The current time is:
<%= new java.util.Date() %>
<jsp:getProperty name="formatter" property="name"/>
</p>
</body>
</html>I can see "TimeFormatterBean.class" in build/classes folder.
If anyone could please help me out with this, it would be very helpful
Thanks a lot!You probably should place TimeFormatterBean inside a package, or maybe you could try importing it , even if it�s in the default package, with something like this <%@ page import="TimeFormatterBean" %> at the top
-
Help with JSP and logic:iterate
I have some queries hope someone can help me.
I have a jsp page call request.jsp:
====================================
<%@ page import="java.util.*" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<body>
<%@ page import="RequestData" %>
<jsp:useBean id="RD" class="RequestData" />
<%Iterator data = (Iterator)request.getAttribute("Data");%>
<logic:iterate id="element" name="RD" collection="<%=data%>">
<jsp:getProperty name="RD" property="requestID" />
<%=element%><br>
</logic:iterate>
</body>
</html>
And I have the RequestData.java file:
======================================
private int requestID = 1234;
public int getRequestID() { return requestID; }
The jsp page display:
======================
0 RequestData@590510
0 RequestData@5b6d00
0 RequestData@514f7f
0 RequestData@3a5a9c
0 RequestData@12d7ae
0 RequestData@e1666
Seems like the requestID is not returned. Does anybody know this?
I have done the exact one using JSP and servlets, trying to learn using JSP and custom tags. The one with JSP and servlet looks like:
============================================
<%@ page import="RequestData" %>
<%Iterator data = (Iterator)request.getAttribute("Data");
while (data.hasNext()) {
RequestData RD = (RequestData)data.next();
out.println(RD.getRequestID() );
}%>Oh think I got it...
but one thing I'm not sure is...
If I use "<jsp:useBean id="RD" class="RequestData" />", do I still need "<%@ page import="RequestData" %>"?
I tried without and it gives me error... -
Help with jsp and servlets(litterature)
I'm planning on converting a asp website to jsp and I need to figure out the following:
1: servlet that gives out connection objects from a pool and manages "lost" connections to a mysql db
2: a bean that has getConnection and closeConnection that is used on every jsp page.
3: servlet/bean that can check size/dimesions/filetype on a remote url image
4: Figure out what users are logged in at every given moment. result: x users are on, these are user1, user2, user3. automatic removal when session runs out. probably need a servlet for this.
I got these books:
deitel java how to program 3rd edition
deitel advanced java 2 platform how to program
The last book has a servlet and jsp section ut I suspect that java has evolved since then so thats why I'm asking if you have any other suggestions that offer more than 2 chapters. Its really basic the stuff i have :)
Its been 3 years since I've touched java so i hope you guys can recomend jsp/servlet books that can answer these questions for me and help me get started with this project?
Thanks :)1. apache dbcp commons library.
http://jakarta.apache.org/commons/dbcp/
2. tomcat DataSource, which already has the dbpc logic incorporated into it.
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
3. no idea, google may help
4. HttpSessionBindingListener. This allows you to monitor when a bean (such as a User bean) is added to the session and when it is removed from the session. This way you can track yourself which users are online.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSessionBindingListener.html -
Where do I place JSP and Beans?
Hello,
I have just installed JDeveloper and have no idea where to place JSP pages and Bean class files so thet JDeveloper can access them when I run or debug a page.
Any help would be appreciated.In JDeveloper, applications are grouped by one or more projects and a workspace containing projects. In your case, if you already have beans and JSPs built, here's what you need to do:
1. Create a new workspace.
2. Create a project using the 'create a project from existing source code' option.
3. Optionally check the 'copy to project's source directory' to include your files in the project.
Hope this helps,
Lynn
Java Tools Team -
Please help with jsp and database!!
Hello,
i first created a jsp page and printed out the parameters of a user's username when they logged in. example, "Welcome user" and it worked fine...
i inserted a database into my site that validates the username and password, and ever since i did that in dreamweaver, when a user logs in sucessfully, it returns the jsp page like its supposed to, only that it says "Welcome null" instead of "Welcome John." pretty strange, huh!? can anyone please help? thanks!
here is the important part of the code to Login.jsp, and LoginSuccess.jsp: <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" %>
<%@ include file="Connections/Login.jsp" %>
<%
// *** Validate request to log in to this site.
String MM_LoginAction = request.getRequestURI();
if (request.getQueryString() != null && request.getQueryString().length() > 0) MM_LoginAction += "?" + request.getQueryString();
String MM_valUsername=request.getParameter("Username");
if (MM_valUsername != null) {
String MM_fldUserAuthorization="";
String MM_redirectLoginSuccess="LoginSuccess.jsp";
String MM_redirectLoginFailed="LoginFailure.jsp";
String MM_redirectLogin=MM_redirectLoginFailed;
Driver MM_driverUser = (Driver)Class.forName(MM_Login_DRIVER).newInstance();
Connection MM_connUser = DriverManager.getConnection(MM_Login_STRING,MM_Login_USERNAME,MM_Login_PASSWORD);
String MM_pSQL = "SELECT UserName, Password";
if (!MM_fldUserAuthorization.equals("")) MM_pSQL += "," + MM_fldUserAuthorization;
MM_pSQL += " FROM MemberInformation WHERE UserName=\'" + MM_valUsername.replace('\'', ' ') + "\' AND Password=\'" + request.getParameter("Password").toString().replace('\'', ' ') + "\'";
PreparedStatement MM_statementUser = MM_connUser.prepareStatement(MM_pSQL);
ResultSet MM_rsUser = MM_statementUser.executeQuery();
boolean MM_rsUser_isNotEmpty = MM_rsUser.next();
if (MM_rsUser_isNotEmpty) {
// username and password match - this is a valid user
session.putValue("MM_Username", MM_valUsername);
if (!MM_fldUserAuthorization.equals("")) {
session.putValue("MM_UserAuthorization", MM_rsUser.getString(MM_fldUserAuthorization).trim());
} else {
session.putValue("MM_UserAuthorization", "");
if ((request.getParameter("accessdenied") != null) && false) {
MM_redirectLoginSuccess = request.getParameter("accessdenied");
MM_redirectLogin=MM_redirectLoginSuccess;
MM_rsUser.close();
MM_connUser.close();
response.sendRedirect(response.encodeRedirectURL(MM_redirectLogin));
return;
%>
<form action="<%=MM_LoginAction%>" method="get" name="Login" id="Login">
<table width="55%" border="0">
<tr>
<td width="41%">Username </td>
<td width="59%"><input name="Username" type="text" id="Username" value="" size="25" maxlength="10"></td>
</tr>
<tr>
<td>Password </td>
<td><input name="Password" type="password" id="Password" value="" size="25" maxlength="10"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>And LoginSuccess.jsp where i want it to print out the "Welcome username
<%String Name=request.getParameter("Username");
out.println ("Welcome ");
out.println (Name); %><%@ page contentType="text/html; charset=iso-8859-1"
language="java" import="java.sql.*" %>
<%@ include file="Connections/Login.jsp" %>
<%
// *** Validate request to log in to this site.
String MM_LoginAction = request.getRequestURI();
if (request.getQueryString() != null &&
request.getQueryString().length() > 0) MM_LoginAction
+= "?" + request.getQueryString();
String
MM_valUsername=request.getParameter("Username");
if (MM_valUsername != null) {
String MM_fldUserAuthorization="";
String MM_redirectLoginSuccess="LoginSuccess.jsp";
String MM_redirectLoginFailed="LoginFailure.jsp";
String MM_redirectLogin=MM_redirectLoginFailed;
Driver MM_driverUser =
=
(Driver)Class.forName(MM_Login_DRIVER).newInstance();
Connection MM_connUser =
=
DriverManager.getConnection(MM_Login_STRING,MM_Login_US
RNAME,MM_Login_PASSWORD);
String MM_pSQL = "SELECT UserName, Password";
if (!MM_fldUserAuthorization.equals("")) MM_pSQL +=
= "," + MM_fldUserAuthorization;
MM_pSQL += " FROM MemberInformation WHERE
E UserName=\'" + MM_valUsername.replace('\'', ' ') +
"\' AND Password=\'" +
request.getParameter("Password").toString().replace('\'
, ' ') + "\'";
PreparedStatement MM_statementUser =
= MM_connUser.prepareStatement(MM_pSQL);
ResultSet MM_rsUser =
= MM_statementUser.executeQuery();
boolean MM_rsUser_isNotEmpty = MM_rsUser.next();
if (MM_rsUser_isNotEmpty) {
// username and password match - this is a valid
lid user
session.putValue("MM_Username", MM_valUsername);
if (!MM_fldUserAuthorization.equals("")) {
session.putValue("MM_UserAuthorization",
ion",
MM_rsUser.getString(MM_fldUserAuthorization).trim());
} else {
session.putValue("MM_UserAuthorization", "");
if ((request.getParameter("accessdenied") != null)
ll) && false) {
MM_redirectLoginSuccess =
ess = request.getParameter("accessdenied");
MM_redirectLogin=MM_redirectLoginSuccess;
MM_rsUser.close();
MM_connUser.close();
response.sendRedirect(response.encodeRedirectURL(MM_re
irectLogin));
return;
%>
<form action="<%=MM_LoginAction%>" method="get"
"get" name="Login" id="Login">
<table width="55%" border="0">
<tr>
<td width="41%">Username </td>
<td width="59%"><input name="Username"
="Username" type="text" id="Username" value=""
size="25" maxlength="10"></td>
</tr>
<tr>
<td>Password </td>
<td><input name="Password" type="password"
="password" id="Password" value="" size="25"
maxlength="10"></td>
</tr>
<tr>
<td>�</td>
<td><input type="submit" name="Submit"
me="Submit" value="Submit"></td>
</tr>
</table>
</form>
And LoginSuccess.jsp where i want it to print out the
"Welcome username
<%String Name=request.getParameter("Username");
out.println ("Welcome ");
out.println (Name); %>When the page is rediredted u r not passing the user name in the query string,so it is not availble in the query string for LoginSuccess page
Since u have added user in session user this
<%String Name=(String)session.getValue("MM_Username") ;%>
<% out.println ("Welcome ");
<% out.println (Name); %> -
Need help in jsp and struts projects
hi
i am using jsp and struts framework.
in that i am putting values in session in one jsp and getting
values in other jsp.i am having doud with how many values i will put in sessions and it will give any difficulty while running in servers.and i want to know any other equivalent way is there for sessions.hi
i am using jsp and struts framework.
in that i am putting values in session in one jsp
jsp and getting
values in other jsp.i am having doud with how many
ny values i will put in sessions and it will give any
difficulty while running in servers.and i want to
know any other equivalent way is there for sessions.do u want all those vales at the same time? if not then u might use session.removeAttribute() method for trashing out the not needed objects.
there are many ways of session handling.... passing as request param, also using hidden fields, else th URL rewritting...
but all these are not efficient to be passed along if too many pages are using the same session objects. i believe u can also try passing it into an XML file and parse it out whenever needed. but i dont think thats feasible enough.
hope it helps. -
Hi friends,
[please forgive me if i am posting this in the wrong forum, all seems same to a fresher]
Now, to my problem..i need a suggestion, a way or a method to implement the following!
I am supposed to create a servlet that reads data from oracle database. Once i retrive the data (for example: 6 rows of a table having 4 attributes), i am supposed to pass this data to a JSP page where the data has to be formatted and displayed properly. If i call the same servlet from a different JSP, i should be able to access the data in that JSP and format it in a different way. How do i pass the data to JSP? what method i can use to achieve this task?
Note: I already know about PrintWriter pw = response.getWriter(); and then printing the formated HTML page..but i want to keep the formatting to JSP part and send only the data part that i can access in JSP
Thanks in adavancearun_ramachandran wrote:
[please forgive me if i am posting this in the wrong forum, all seems same to a fresher]Then you should learn to be more observant - after all, we have JSP and Servlet fora, further down the list. :)
I am supposed to create a servlet that reads data from oracle database. Once i retrive the data (for example: 6 rows of a table having 4 attributes), i am supposed to pass this data to a JSP page where the data has to be formatted and displayed properly. If i call the same servlet from a different JSP, i should be able to access the data in that JSP and format it in a different way. How do i pass the data to JSP? what method i can use to achieve this task? You can store the data in your session object. You can even use JavaBeans and the jsp:usebean tag.
[http://java.sun.com/products/jsp/tags/11/syntaxref11.fm14.html]
Note: I already know about PrintWriter pw = response.getWriter(); and then printing the formated HTML page..but i want to keep the formatting to JSP part and send only the data part that i can access in JSPA wise approach - I wish more prople woiuld be as thoughtful. -
Help! JSP and Bussiness components Project Error
I have created a project with bussines components and jsp.
When a user connect to login page, the other users data change
to the last user connected.
(Note:
I does working with entities, views, viewlinks)Arturo,
I assume you are using 3.2 of JDeveloper. When you say that
other users data changes, what do you mean? Please describe the
symtoms.
For example, User A connects to a JSP and is browsing the
Customer data. User B connects to the JSP and changes some data.
Does User A see it before User B commits? If it shows after User
B commits, that is expected behavior. If it shows before User B
commits, then that means that they are sharing a session in the
web server.
What kind of web server are you using. If it is the builit in
sever in JDeveloper, then that is the problem. The built in
server in 3.2 does not support sessions.
Gary
JDev Team -
i have a dozen of asp pages which talk with MSSQL. I want to build an interactive menu with dozen of links ( probably like a tree structure with dozen nodes each pointing to these asp pages).
1) I intend to build the menu in jsp using the tree structure available.
My Question is when a user clicks on a node, i want the asp page to open in a frameset style, opening in a different frame.
this is a fragment of the jsp tag:
<ui:treeNode binding="#{Page1.treeNode1}" id="treeNode1" target="_parent" text="Tree Node 1" url="http://myserver/page1.asp">
how do i change the target attribute so that it opens the asp page in a new frame?Build a page with 2 frames with one frame's name as say "left" and the other as "right". Assuming that you would want your menu jsp on the left, set the src of that frame to your menu jsp. and set the target as target="right" (name of your right frame) instead of _parent..
-
SOme more help on JSP-Servlets-Beans plz...!!
Thanx a lot for your help !
But I could not understand some things ...
Suppose, I create 5 bean instances in my servlet, & "set" them with data from 5 tuples.
Now, I need to pass these 5 bean objects to a JSP .
HOW exactly can I pass them via a List object thru request attribute ?
And, after doing that, HOW will I be able to access the individual Bean objects in the JSP ?
Plz., see if you can send me some Code Snippets that illustrate the same.
Once again, Thanks a lot for bearing with me !!
Awaiting your response...
Truly yours,
RaghuServlet:
request.setAttribute ("someUniqueName", yourBeanList);
JSP:
Either <jsp:useBean> or insert a scriplet like <% List beanList = (List) request.getAttribute("someUniqueName"); %> -
Passing values between JSP and Bean
I am trying to validate a date entered by the user on a form. I need to do an "alert" when the user enters a date outside of the valid range depending on a value entered in a drop down.
Am doing this in checkform function. Here is what I want to do:
1. Send the the value from the drop down and the date to bean to do the calculations. Call the EJB function from checkform.
2. Get a string values back into the jsp from the bean
3. Blow an error to the user to enter a valid date.
Any help in this case would be greatly appreciated.
Thanks.I only see some design requirements.
What's the exact coding question? Where are you stucking while coding those requirements accordingly?
Maybe you are looking for
-
When i open firefox it opens up full screen (as it always has) but now the minimize button is grey (not yellow) and inactive so i can only open (green button) or close (red button) my firefox window. I can still make it smaller by dragging the bottom
-
Can i copy songs from my ipod to a folder in my pc?
I want to copy songs from my ipod to a folder in my pc but when i attempt to copy, the paste is not active
-
This , above, is the message I get agter I sign on to my password protected PC. I am not overly technical and am not confident with program files. I don't what RH120.bpl does but am worried that it may somehow place the security of my PC at risk. The
-
AE with inbound SIP and RTP over UDP - Will not open ports
I am using a Linksys SPA962 IP Phone via an Airport Express with the latest firmware connecting to an Asterisk PBX (http://www.asterisk.org) over the internet. I may make outbound calls and have my incoming and outgoing audio over RTP with the approp
-
I have a problem with syncing, can someone be kind enough to support me? :)
When I change my album names in iTune (or any other info), they aren't affected in my iPod Touch. what should I do? Example: In iTunes, let's suppose Track 1 have "Beethoven" as an album name. Then, in iTunes I change the album name to "Mozart". BUT