Jsp and corba :help !!!
Hi,
i am working about a web application which is willing to extend, so we want to fix in the cleanest way, the architecture. we think for example about CORBA, have you got a better idea, could you send me some addresses where i could find very clear examples about applications using jsp and corba or something else!
thank you very much if you can help me
cris
Hi bx1,
here iam giving you some example jsp with corba it will help you
I got from wrox book
<!-- WroxQuotes.jsp -->
<html>
<head>
<title>
WroxStocks Quote Service
</title>
</head>
<body bgcolor="#CAFD90">
<%@ page import="WroxStocks.WroxQuotesPackage.Quote"
errorPage="WroxQuotesError.jsp"%>
<jsp:useBean id="WroxQuotesBean" scope="application"
class="WroxQuotesBean" >
<%
String port = application.getInitParameter("ORBInitialPort" );
String host = application.getInitParameter("ORBInitialHost" );
WroxQuotesBean.init(port, host );
%>
</jsp:useBean>
<%
String symbols = request.getParameter( "Symbols" );
Quote[] quotes = null;
try {
quotes = WroxQuotesBean.getQuotes( symbols );
} catch( WroxStocks.UnknownSymbol us ) {
response.sendError( 202, "Unknown symbol: " + us.unknown );
%>
<table border align="center">
<tr align="center" bgcolor="FFFFFF">
<td>
<table>
<caption align="top" style="font:14pt">
<b>WroxStocks Stock Quotes</b>
</caption>
<tr align="center" bgcolor=Silver>
<th width=100>SYMBOL</th>
<th width=100>VOLUME</th>
<th width=100>BID</th>
<th width=100>ASK</th>
<th width=260>AS OF</th>
</tr>
<%
for(int i = 0; i < quotes.length; i++) {
if( ( i % 2 ) == 0 ) {
%>
<tr align="right" bgcolor="#FFFFFF">
<%
} else{
%>
<tr align="right" bgcolor="#E0E0E0">
<%
%>
<td align="center"> <%= quotes.symb %> </td>
<td> <%= quotes[i].volume %> </td>
<td> <%= quotes[i].bid %> </td>
<td> <%= quotes[i].ask %> </td>
<td align="center">6/28/2000 19:59:00</td>
</tr>
<%
} // END: for
%>
</table>
</td>
</tr>
</table>
</body>
</html>
Regards,
Tirumalarao
Developer TechnicalSupport,
Sun MicroSystem,India.
Similar Messages
-
Hello,
I am making this feedback for fun and a bit of learning too. I have an INDEX.JSP page, where the user selects the very first option. Depending upon the selected option he is moved another page PRODUCTFEEDBACK.JSP (so far I have completed this). Here as usual there are many fields to be filled in. As a spams protection i have done this;
I have a AdditionClass, which is a seperate class where two number are generated at random. This numbers are called by PRODUCTFEEDBACK.JSP. The user is then asked to perform the addition. The completed form is then sent to ProductFeedback servlet.
When I compile my PRODUCTFEEDBACK.JSP I get this error. Can you please tell whats wrong?
PRODUCTFEEDBACK.JSP
*<td>Please help us to prevent Spams by performing this simple mathematical Calculation. We appreciate your effort </td>*
*</tr>*
*</table>*
*<jsp:useBean id = "AddTest" class = "go.AdditionClass" />*
*<table width="53%" border="0" align="center">*
*<tr>*
*<td><div align="center">*
*<input name="textfield8" type="text" size="3" value ="<jsp:getProperty name="AddTest" property = "randNum1" />">*
* + *
*<input name="textfield9" type="text" size="3" value="<jsp:getProperty name="AddTest" property = "randNum2" />">*
* = *
*<input name="_total" type="text" size="5">*
</div></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<br>
<table width="37%" height="23" border="0" align="center">
<tr>
<td width="33%"> </td>
<td width="67%"><input type="submit" name="Submit" value="Click here to send us this form"></td>
AdditionalClass.java
* To change this template, choose Tools | Templates
* and open the template in the editor.
package go;
import java.util.Random;
* @author MAC
public class AdditionClass {
Random generator = new Random();
int randNum1; // First Random Number
int randNum2; // Second Random Number
public void SetNum1(){
randNum1 = generator.nextInt(10); // Generate First Random Number
public int getNum1(){
return randNum1; //Return First Random Number
public void SetNum2(){
randNum2 = generator.nextInt(10); // Generate Second Random Number
public int getNum2(){
return randNum2; // Return Second Random Number
// send the Random Numbers to ProductFeedback class
public void productFeedbackRandNum1(){
ProductFeedback productfeedback = new ProductFeedback();
productfeedback.randomNumber1(randNum1);
public void productFeedbackRandomNum2(){
ProductFeedback productfeedback = new ProductFeedback();
productfeedback.randomNumber2(randNum1);
}Erros that I am getting:
org.apache.jasper.JasperException: Cannot find any information on property 'randNum1' in a bean of type 'go.AdditionClass'
C:\Documents and Settings\MAC\My Documents\NetBeansProjects\FeedBack\nbproject\build-impl.xml:462: The following error occurred while executing this line:
C:\Documents and Settings\MAC\My Documents\NetBeansProjects\FeedBack\nbproject\build-impl.xml:440: Java returned: 1
BUILD FAILED (total time: 1 second)Thank you for replying. I modified my Bean class then what is posted above, so thought to repost the code again and seek help. There seems to be no error now but it just dont generate any random numbers, All i get very time is 0. I am wondering, is my code generating 0 as random number, every time :-)
package go;
import java.util.Random;
public class AdditionBean {
int randNum1; // First Random Number
int randNum2; // Second Random Number
public void generateRandomNum1(){
Random generator = new Random();
int num1 = generator.nextInt(10);
SetRandNum1(num1);
// Send num1 value to ProductFeedback.java
ProductFeedback productfeedback = new ProductFeedback();
productfeedback.randomNumber1(num1);
} // End of generaeRandomNum1
public void generateRandomNum2(){
Random generator = new Random();
generator = new Random();
int num2 = generator.nextInt(10);
SetRandNum2(num2);
// Send num1 value to ProductFeedback.java
ProductFeedback productfeedback = new ProductFeedback();
productfeedback.randomNumber2(num2);
} // End of generateRandomNum2
public void SetRandNum1(int num1){
randNum1 = num1;
public int getRandNum1(){
return randNum1; //Return First Random Number
public void SetRandNum2(int num2){
randNum2 = num2;
public int getRandNum2(){
return randNum2; // Return Second Random Number
}// End of classThank you, -
JSP and Excel HELP HELP HELP HELP
OK folks,
For the last couple of days I'd been searching this site for resolving my issue. Help me out Pleeeeeeeeeease.
Environment
Webserver: IIS
OS: Windows 2000 (Needless to say)
Language: Javascript
Issue: communicate the jsp application to Microsoft Excel
Take a couple of parameters (initially can be hard-coded) from javascripit application, and send it to Microsoft Excel, run a macro, and display the chart created by microsoft excel (which is an htm file) in web application.
I have gone through the application/vnd code, and the ExcelReader.class that was recommended. I don't know how to make the class file be read by the javascript, and application/vnd command opens up excel separately, but doesn't open the excel file; and yes, the excel file is on the same location on webserver.
What I need (and I genuinely appreciate this) is someone to show me the process (sample code is what I require actually) how this can be done in a JSP.
Thaaaaaaaaaaaaaanks a Miiiiiiiiiiiiiiiiiiiiillion
Again, please help.Can U describe your problem clearly?
-
Date selection and search help component in jsp
Hi all:
In sap portal jsp development enviorment, is it possible to easily program the date selection and search help ( just look like search help in webdynpro ) ?Hello Jianhong,
the easiest way to set a value help is using HTMLB component in your JSP.
To do it, use next code:
<hbj:inputField
id="DateInputField"
type="date"
showHelp="TRUE"
... other attributes
/>
Before using HTMLB components in your JSP, don't forget to add this line to your page:
<%@ taglib uri= "tagLib" prefix="hbj" %>
regards.
mz -
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) -
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,JSP and SERVLETS!
hello:
i've downloaded ECLIPSE 3.2,TOMCAT 5.5 .
i tried to build simples examples o servlets but i failed could you please tell me how to proceed?i'm new at this plus i've got a project to do with all this so plz can you give some links to go,i tried but no links was clear.
i've got to give to my professor an examples executed (servlets,jsp)
thank youHISSO wrote:
i wil give up on talking about stupid gossip
you must act professional and i you can't help it's ok
so plz i juste want help
i'm so busy finishing my studies
when it comes to talk about development with tomcat and eclipse together i'm new so i need some advices,so plz let's be serious!
i'm working hard to finish my project!Try to communicate less like a monkey with electrodes attached to it's genitals. This means stop using words like "plz" and write "please" instead.
If you want specific help with a specific problem then you should ask a specific question. "help, JSP and SERVLETS" is not a specific question. And you should also note that if your specific question is about Tomcat specifically or Eclipse specifically then you are in the wrong place to begin with.
So do you want to try again? -
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... -
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); %> -
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 -
A customer login's to my website using Enterprise login. I am supposed to have a link on my website to this other website(that also uses our Enterprise login details but hosted by other vendor/company on their server), and when I click this link the customes should automatically get logged in to this other website and get a welcome page(instead of login page).
Below are the sequence of steps that the other website wants me to perform to get to his welcome page(i.e bypass his login page).
FYI, I am planning to build a jsp page with a link to this other website. Can some body tell me how should I build the application(i.e) how jsp and servlets be build to interact to perform these operations. Any hep is greatly appreciated.
1.When a user clicks on to other website link(available on my website), the browser generates an HTTP GET request to the Other website's session servlet. User's name is one of the parameters of this request.
2.Other website receives the HTTP request and generates a unique session identifier for this user. An HTTP response to the end-user is then sent. The user's name and the session identifier are passed back as parameters in the redirect URL.
3.The browser sends the HTTP request (GET) to the Verification Service that was specified in the redirect message. The parameters (user name and/or session id) will be passed as URL parameters.
4.The Verification Service(of other website) authenticates the user. A redirect URL to it's sigon servlet(with parameter's User id and key) is then sent back to the user's browser.
5.The end-user's browser will perform the redirect (performing an HTTP get operation to Other website's signon servlet with the username and the digest key).
6.The other website will check if the parameter's passed is the same as the one passed earlier, if the user is who he says he is then he is redirected to the main page of the application.
7.The browser will then redirect the user to Other website's main page (welcome.jsp).
There seems's to be many calls to this other website that needs to be performed behind the scenes once a user clicks the link on my website.
Please suggest and help me out.........
Edited by: 836726 on Feb 21, 2011 3:41 PMWhy are you trying to build a whole federated single sign on framework from scratch when you can just use/buy an existing and proven solution instead? There are a lot of security implication and trust issues involved for this so unless you already understand all of those I'd advise you not to re-invent the wheel. There are a lot of products available that do this. Try searching for '<vendor name> Access Manager' or OpenSSO.
-
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. -
Need Help Badly on Shopping Cart Using JSP And Java Servlet
Hi All,
This is the 1st time i am trying to create a shopping cart using JSP and Servlet.
I have read through a few acticles but i still do not get the whole idea of how it works.
Please guide me as i need help very badly.
Thanks.
This is one of the jsp page which displays the category of products user would like to buy : Products.jsp
<html>
<head>
<title>Purchase Order</title>
</head>
<body topmargin="30">
<table border="0" width="100%" id="table1" cellpadding="2">
<tr>
<td bgcolor="#990000" width="96">
<p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">
Code</font></b></td>
<td bgcolor="#990000" width="260">
<p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">
Description </font></b></td>
<td bgcolor="#990000" width="130">
<p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">Brand
</font></b></td>
<td bgcolor="#990000" width="146">
<p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">UOM
</font></b></td>
<td bgcolor="#990000" width="57">
<p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">Unit<br>
Price </font></b></td>
<td bgcolor="#990000" width="62">
<p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">
Carton<br>
Price </font></b></td>
<td bgcolor="#990000" width="36">
<p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">
Qty</font></b></td>
<td bgcolor="#990000" width="65">
<p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">Add<br>
To Cart</font></b></td>
</tr>
<tr>
<td align="center" width="96" bgcolor="#CCCCCC">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">123</font>
</td>
<td align="center" width="260" bgcolor="#CCCCCC">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">Tom Yam</font>
</td>
<td align="center" width="130" bgcolor="#CCCCCC">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">Nissin</font>
</td>
<td align="center" width="146" bgcolor="#CCCCCC">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">12 x 10's</font>
</td>
<td align="center" width="57" bgcolor="#CCCCCC">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">$3.85</font>
</td>
<td align="center" width="62" bgcolor="#CCCCCC">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">$46.2</font>
</td>
<td align="center" width="36" bgcolor="#CCCCCC">
<!--webbot bot="Validation" S-Data-Type="Integer" S-Number-Separators="x" -->
<p align="center"><input type="Integer" name="Q10005" size="1"></p>
</td>
<td align="center" width="65" bgcolor="#CCCCCC">
<p><input type="checkbox" name="checkbox" value="123"></p>
</tr>
<tr>
</table>
<table border="0" width="100%" id="table2">
<tr>
<td>
<div align="right">
<input type="hidden" name="hAction" value="AddToCart"/>
<input type=submit name="submit" value="Add To Cart"/>
</div>
</td>
</tr>
</table>
</body>
</html>
After user has make his selection by entering the qty and ticking on the check box, he would click the "Add To Cart" button ... and this would call my servlet : AddToAddControlSerlvet.java
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
public class AddToCartControlServlet extends HttpServlet
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException
String action = req.getParameter("hAction");
if (action.equals("AddToCart"))
addToCart(req,res);
public void addToCart(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
try
String url = "";
String[] addList = req.getParameterValues("checkbox");
HttpSession sess = req.getSession(true);
//String sessionID = sess.getId();
DBClass dbClass = new DBClass();
ArrayList cartList = new ArrayList();
for (int i = 0; i < addList.length; i++)
String productCode = (String)addList;
int qty = Integer.parseInt(req.getParameter("Q"+productCode));
Products product = dbClass.getProductDetail(productCode);
double totalUnitAmt = qty * product.getUnitPrice();
double totalCartonAmt = qty * product.getCartonPrice();
Order order = new Order(product.getProductCode(),product.getProductDesc(),product.getBrandName(),product.getUom(),qty,product.getUnitPrice(),product.getCartonPrice(),totalUnitAmt,totalCartonAmt);
cartList.add(order);
sess.setAttribute("cartList", cartList);
url = "/Cart/CartDetails.jsp";
ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher(url);
rd.forward(req, res);
catch (Exception e)
System.out.println(e);
From here, i would get the list of items which user has selected and add to the cartList, then i would direct the user to CartDetails.jsp which displayed the items user has selected.
From there, user would be able to remove or to continue shopping by selecting other category.
How i do store all the items user has selected ... everytime he would wan to view his cart ...
As i would be calling from jsp to servlet .. or jsp to servlet ... and i do not know how i should go about in creating the shopping cart.Hi !
Yon can use a data structure as vector and store the items selected by the user into the vector . Keep the vector in session using session object , so the user can access the entire shopping cart from anywhere in the application .
Then , you can change the cart accordingly .
Hope this works.
Cheers ,
Pranav -
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 required with JSP and JMF
Hi
Please check the following thread and let me know if JSP and JMF can be combined together
http://forum.java.sun.com/thread.jspa?threadID=5161428&tstart=0
~Amantake a look at the Java Upload bean and it's examples
http://www.javazoom.net/jzservlets/uploadbean/uploadbean.html
Maybe you are looking for
-
Unity Connection 7 - Shared Voice Mail Confusion
/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in
-
How can I tell if my Iphone is being spied on or if it has been jailbroken?
I'm trying to find out if my Iphone has been jailbroke and had one of the Iphone spy apps installed. I left a my phone in a friends car and since then it has just been slow and he is pretty tech saavy so I wouldn';t be suprised if he did. will a rest
-
I am trying to fix problem with my friends iMac. It is an intel iMac 2.16, with 1G it was partitioned to run Windows XP in bootcamp. His XP caught a virus and is not working well for him so I installed Parallels and reinstalled XP in VM to get rid of
-
i have a specific requirment 1. need to send notification to multiple user using PO approval 2. send po has been approved mail to requester and receiver 3. need to send notification remainder mail after po is created
-
Why are my options to create a new version for ipod or iphone don't work?
I've just downloaded the digital copy of the little mermaid & in the end, it didn't wnt to sync, so I searched a little on how I can make it work. It was mostly the same answer that I found everywhere: select the File menu > Create New Version > Crea