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?
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 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
crisHi 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. -
I can't print with my schedule at Word and Excel, help me please
Hi Brothers!
I have a trouble with Word and Excel 2011 on Lion. Last time, when i used Snow Leopart 10.6.6, i can see a white button to control formatting bar , like this : http://f.cl.ly/items/3T1n3e351I22080X3h3i/help.png, but now, it look like that :http://f.cl.ly/items/1u0j182w2e0O1m1K1k0A/Screen%20Shot%202011-08-16%20at%209.56 .18%20AM.png
And last time, I can print Word or Excel with schedule (EX : printed after 5 min), but now I can’t =.= http://cl.ly/1u3E1R0w071k2f1Z0g2e
So, please help me, thanks you so much!
I hope to see your letter soon, here my email : [email protected]
Best regard!Issue 1. The losenge button that controls the formatting bar is no longer present in OS X 10.7. It is not present in any applicatioin or Finder window.
Issue 2. The Schedule function in the print window has also been removed in OS X 10.7.
You may want to give feedback to Apple about these items. You can do so from the feedback page at http://www.apple.com/feedback/macosx.html . -
Reports with jsp and excel?
Hello all..
I'm Struggling with my application when i need reports.. i use jsp and servlets. How can i build reports and load them into a excel spreadsheet?
PD: i dont have time to work with jasper reports.. :/ so if there's a faster and easier solution please let me know!
Thanks.JExcel and POI are commonly used
-
Hi All
Is there a way of writing to an Excel Spread sheet when that same spread sheet is open with windows explorer?
Something like a shared connection.
Kind Regards
Shako
Help share your knowlegde
Solved!
Go to Solution.You can obtain a handle to an active Excel application and connect to it, reading and writing to the active sheet.
As an example, I modified Excel2000dem sample application that comes with CVI to obtain this behaviour: modifications are in this callback:
// OpenAppFile
int CVICALLBACK OpenAppFile (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
HRESULT error = 0;
char fileName[MAX_PATHNAME_LEN];
switch (event) {
case EVENT_COMMIT:
if (!ExcelWorkbooksHandle)
// Get Workbooks
error = Excel_GetProperty (ExcelAppHandle, NULL, Excel_AppWorkbooks,
CAVT_OBJHANDLE, &ExcelWorkbooksHandle);
if (error<0)
goto Error;
// EXCLUDED LINES IN CASE OF CONNECTION TO AN ALREADY OPENED FILE
// Open existing Workbook
// GetProjectDir (fileName);
// strcat(fileName, "\\exceldem.xls");
// error = Excel_WorkbooksOpen (ExcelWorkbooksHandle, NULL, fileName, CA_DEFAULT_VAL,
// CA_DEFAULT_VAL, CA_DEFAULT_VAL,
// CA_DEFAULT_VAL, CA_DEFAULT_VAL,
// CA_DEFAULT_VAL, CA_DEFAULT_VAL,
// CA_DEFAULT_VAL, CA_DEFAULT_VAL,
// CA_DEFAULT_VAL, CA_DEFAULT_VAL,
// CA_DEFAULT_VAL, &ExcelWorkbookHandle);
// if (error<0)
// goto Error;
// // Get Active Workbook Sheets
// error = Excel_GetProperty (ExcelAppHandle, NULL, Excel_AppSheets,
// CAVT_OBJHANDLE, &ExcelSheetsHandle);
// if (error<0)
// goto Error;
// // Get First Sheet
// error = Excel_SheetsItem (ExcelSheetsHandle, NULL, CA_VariantInt(1),
// &ExcelWorksheetHandle);
// if (error<0)
// goto Error;
// // Make First Sheet Active - should already be active
// error = Excel_WorksheetActivate (ExcelWorksheetHandle, NULL);
// if (error<0)
// goto Error;
// END OF EXCLUDED LINES
// New command to obtain a handle to the active sheet
error = Excel_GetProperty (ExcelAppHandle, NULL, Excel_AppActiveSheet, CAVT_OBJHANDLE, &ExcelWorksheetHandle);
if (error<0)
goto Error;
// Update UIR
UpdateUIRDimming(panel);
else
MessagePopup(APP_WARNING, "Document already open");
break;
return 0;
Error:
ClearObjHandle (&ExcelWorksheetHandle);
ClearObjHandle (&ExcelSheetsHandle);
ClearObjHandle (&ExcelWorkbookHandle);
ClearObjHandle (&ExcelWorkbooksHandle);
if (error < 0)
ReportAppAutomationError (error);
return 0;
To use the example, modify the code as stated, open the document in Excel, run the program and select "Connect to Excel", next select "Open file" (the modified callback) and you can read / write to the file both from interactively and from the program.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
Need help in writing data from JSP to excel
Hi ,
I need help in writing the data from JSP to excel.I somehow able to retrieve the data into excel but unable to get the required format.
For eg: The amount should be displayed in 0.00 format .when i am exporting it to excel it is displaying as 0 :( .
I am using the following code in JSP.
"out.print(amt + '\t');"
Would like to know if there is any otherway where in i can get my requirement.
Thanks
TomHi,
Try using format part of the JSTL tag libs.
Syntax :
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:formatNumber value="40" pattern="$#,##0.00"/>
I need help in writing the data from JSP to excel.I
somehow able to retrieve the data into excelHow do u convert the jsp to excel?
One way to convert the jsp page to excel, is to render it as an excel appl instead of html. Set the content type of the response to application/ms-excel.
response.setContentType("application/ms-excel")Hope this Helps.... -
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? -
HT6114 Hi, I can not open the Work and Excel now, can you help me?
I can not open Work and Excel now.. I have this computer for 3 years, Can you help me.
EvaWhat ver of Excel? You need 2011 or 2008
-
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
Maybe you are looking for
-
How to store user input as an xml Parameter value in log4j.xml?
I am working on an app that is blend of log4j , EJBs, JMS, weblogic. In log4j, I have specified the value of file appender; but now what I wanna do is: Take path for File (For File Appender) from user and use it as a File path for File Appender in
-
DATA AGGREGATION ISSUE IN REPORT
Hi, when we were running query by selcting the the version . the data is aggregation dono where it went rong Explanation : we alredy loaded data with version for the year 2010.. we started laoding from April 2010 to March 2011.. as 12 fiscal period
-
When I run the CC App, under "Apps" there is a large WARNING SYMBOL, followed by the words, "Download Error." I am given the option to "Download Creative Cloud," which I have done twice, uninstalling it, and re-installing it each time. However, the w
-
Will an 8GB RAM in a Retina Macbook Pro from 2014 hold for 4-5 years?
Hi. So, I'm fairly new when it comes to Macbooks or apple products in general, so sorry if it seems like a bit of a strange question. I am buying a Macbook Pro Retina (newest one available), with standard i5 and 256 GB storage. The question is whethe
-
Using iPhone to connect pda to Edge via Bluetooth
Any guidance on using the iPhone as a modem to connect to Edge for pda / computer ? I had this hooked up with my previous cellphone (Sony K790a) since I already had an edge account. Until Apple comes up with ActiveSync, I would like to continue to us