Gaurav x Jain

Ranch Hand
+ Follow
since Feb 01, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gaurav x Jain

Hi Friends I want to import below mention package i use it my project and i am using Eclipse IDE please help
From where I can find this package to download
org.w3c.tools.jdbc.JdbcBeanAdapter

Can you please guide me how I can use this package when I am not using any IDE.

10 years ago
JSP
Hi Friends I want to import below mention package i use it my project and i am using Eclipse IDE please help
From where I can find this package to download
org.w3c.tools.jdbc.JdbcBeanAdapter

Can you please guide me how I can use this package when I am not using any IDE.


10 years ago
Thank you very much. Now Bean Property related my myths and Confusions solved. Thank you for your support
10 years ago
JSP
I am facing an Error while using Bean for Page Scope is as follows:

Error:
------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Cannot find any information on property 'count' in a bean of type 'JSPTest.TestBeanPageScope'
org.apache.jasper.runtime.JspRuntimeLibrary.getReadMethod(JspRuntimeLibrary.java:839)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1057)
org.apache.jasper.compiler.Node$GetProperty.accept(Node.java:1124)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Generator.generate(Generator.java:3416)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:231)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26 logs.




this is a JSP page (BeanPageScope.JSP)
---------------------------------------
%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<jsp:useBean id="testPageScope" class="JSPTest.TestBeanPageScope" scope="page"/>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="JSPTest.TestBeanPageScope"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Bean page Scope</title>
</head>
<body>
<%
testPageScope.setCounter(testPageScope.getCounter()+1);

%>

The value of counter is:
<jsp:getProperty name="testPageScope" property="count" />
</body>
</html>

This is a Java Class File (TestBeanPageScope.java)
---------------------------------------------------
package JSPTest;

public class TestBeanPageScope {

public int count;

public void setCounter(int count)
{
this.count=count;
}

public int getCounter()
{
return count++;
}
}

-----

Please help what I have to do. I think I am making a little bit mistake.
10 years ago
JSP
Thank you it's working now.
10 years ago
JSP
Hi Friends

I am trying the following code using beans in JSP

TestBean.JSP
------------


<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<title>Test JSP BEAN</title>
</head>
<body>
<jsp:useBean id="Tbean" class="JSPTest.TestBean"/>
<jsp:getProperty name="emp" property="fname"/>
<jsp:getProperty name="emp" property="age"/>


</body>
</html>

TestBean.java
-------------
package JSPTest;

public class TestBean {
protected String fname;
protected int age;



public String getfname() {
fname = "nicks";
return fname;
}

public int getage() {
age = 27;
return age;
}

}
-------------

Facing following error:

org.apache.jasper.JasperException: jsp:getProperty for bean with name 'emp'. Name was not previously introduced as per JSP.5.3
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1086)
org.apache.jasper.compiler.Node$GetProperty.accept(Node.java:1124)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Generator.generate(Generator.java:3416)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:231)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Please help
10 years ago
JSP
Thank you very much for your reply.

Can you tell me how I can add a chart in JSP
10 years ago
JSP
Hi Friends I am trying to compile following code for genrate a Chart in JSP.

Code
=====

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<%@ page import="java.awt.*" %>
<%@ page import="java.io.*" %>
<%@ page import="org.jfree.chart.*" %>
<%@ page import="org.jfree.chart.axis.*" %>
<%@ page import="org.jfree.chart.entity.*" %>
<%@ page import="org.jfree.chart.labels.*" %>
<%@ page import="org.jfree.chart.plot.*" %>
<%@ page import="org.jfree.chart.renderer.category.*" %>
<%@ page import="org.jfree.chart.urls.*" %>
<%@ page import="org.jfree.data.category.*" %>
<%@ page import="org.jfree.data.general.*" %>

<%
final double[][] data = new double[][]{
{210, 300, 320, 265, 299},
{200, 304, 201, 201, 340}
};

final CategoryDataset dataset =
DatasetUtilities.createCategoryDataset(
"Team ", "", data);

final JFreeChart chart = ChartFactory.createAreaChart(
"Area Chart", "", "Value", dataset,
PlotOrientation.VERTICAL,
true, true, false);

final CategoryPlot plot = chart.getCategoryPlot();
plot.setForegroundAlpha(0.5f);

chart.setBackgroundPaint(new Color(249, 231, 236));

try {
final ChartRenderingInfo info = new ChartRenderingInfo
(new StandardEntityCollection());

final File file1 = new File("..//Workspaces//TestJSP//WebContent//WEB-INF//areachart.png");

ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info);
} catch (Exception e) {
out.println(e);
}

%>

<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<IMG BORDER="0" <br /> >
</body>
</html>
----------------------------------

Facing below error:

type Exception report

message

description 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: 23 in the jsp file: /TestChart.jsp
CategoryDataset cannot be resolved to a type
20: {200, 304, 201, 201, 340}
21: };
22:
23: final CategoryDataset dataset =
24: DatasetUtilities.createCategoryDataset(
25: "Team ", "", data);
26:


An error occurred at line: 24 in the jsp file: /TestChart.jsp
DatasetUtilities cannot be resolved
21: };
22:
23: final CategoryDataset dataset =
24: DatasetUtilities.createCategoryDataset(
25: "Team ", "", data);
26:
27: final JFreeChart chart = ChartFactory.createAreaChart(


An error occurred at line: 27 in the jsp file: /TestChart.jsp
JFreeChart cannot be resolved to a type
24: DatasetUtilities.createCategoryDataset(
25: "Team ", "", data);
26:
27: final JFreeChart chart = ChartFactory.createAreaChart(
28: "Area Chart", "", "Value", dataset,
29: PlotOrientation.VERTICAL,
30: true, true, false);


An error occurred at line: 27 in the jsp file: /TestChart.jsp
ChartFactory cannot be resolved
24: DatasetUtilities.createCategoryDataset(
25: "Team ", "", data);
26:
27: final JFreeChart chart = ChartFactory.createAreaChart(
28: "Area Chart", "", "Value", dataset,
29: PlotOrientation.VERTICAL,
30: true, true, false);


An error occurred at line: 29 in the jsp file: /TestChart.jsp
PlotOrientation.VERTICAL cannot be resolved to a type
26:
27: final JFreeChart chart = ChartFactory.createAreaChart(
28: "Area Chart", "", "Value", dataset,
29: PlotOrientation.VERTICAL,
30: true, true, false);
31:
32: final CategoryPlot plot = chart.getCategoryPlot();


An error occurred at line: 32 in the jsp file: /TestChart.jsp
CategoryPlot cannot be resolved to a type
29: PlotOrientation.VERTICAL,
30: true, true, false);
31:
32: final CategoryPlot plot = chart.getCategoryPlot();
33: plot.setForegroundAlpha(0.5f);
34:
35: chart.setBackgroundPaint(new Color(249, 231, 236));


An error occurred at line: 38 in the jsp file: /TestChart.jsp
ChartRenderingInfo cannot be resolved to a type
35: chart.setBackgroundPaint(new Color(249, 231, 236));
36:
37: try {
38: final ChartRenderingInfo info = new ChartRenderingInfo
39: (new StandardEntityCollection());
40:
41: final File file1 = new File("..//Workspaces//TestJSP//WebContent//WEB-INF//areachart.png");


An error occurred at line: 38 in the jsp file: /TestChart.jsp
ChartRenderingInfo cannot be resolved to a type
35: chart.setBackgroundPaint(new Color(249, 231, 236));
36:
37: try {
38: final ChartRenderingInfo info = new ChartRenderingInfo
39: (new StandardEntityCollection());
40:
41: final File file1 = new File("..//Workspaces//TestJSP//WebContent//WEB-INF//areachart.png");


An error occurred at line: 39 in the jsp file: /TestChart.jsp
StandardEntityCollection cannot be resolved to a type
36:
37: try {
38: final ChartRenderingInfo info = new ChartRenderingInfo
39: (new StandardEntityCollection());
40:
41: final File file1 = new File("..//Workspaces//TestJSP//WebContent//WEB-INF//areachart.png");
42:


An error occurred at line: 43 in the jsp file: /TestChart.jsp
ChartUtilities cannot be resolved
40:
41: final File file1 = new File("..//Workspaces//TestJSP//WebContent//WEB-INF//areachart.png");
42:
43: ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info);
44: } catch (Exception e) {
45: out.println(e);
46: }


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

-------------------------------

Please guide me

10 years ago
JSP
Hi Friends I am trying to compile following code for genrate a Chart in JSP.

Code
=====

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<%@ page import="java.awt.*" %>
<%@ page import="java.io.*" %>
<%@ page import="org.jfree.chart.*" %>
<%@ page import="org.jfree.chart.axis.*" %>
<%@ page import="org.jfree.chart.entity.*" %>
<%@ page import="org.jfree.chart.labels.*" %>
<%@ page import="org.jfree.chart.plot.*" %>
<%@ page import="org.jfree.chart.renderer.category.*" %>
<%@ page import="org.jfree.chart.urls.*" %>
<%@ page import="org.jfree.data.category.*" %>
<%@ page import="org.jfree.data.general.*" %>

<%
final double[][] data = new double[][]{
{210, 300, 320, 265, 299},
{200, 304, 201, 201, 340}
};

final CategoryDataset dataset =
DatasetUtilities.createCategoryDataset(
"Team ", "", data);

final JFreeChart chart = ChartFactory.createAreaChart(
"Area Chart", "", "Value", dataset,
PlotOrientation.VERTICAL,
true, true, false);

final CategoryPlot plot = chart.getCategoryPlot();
plot.setForegroundAlpha(0.5f);

chart.setBackgroundPaint(new Color(249, 231, 236));

try {
final ChartRenderingInfo info = new ChartRenderingInfo
(new StandardEntityCollection());

final File file1 = new File("..//Workspaces//TestJSP//WebContent//WEB-INF//areachart.png");

ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info);
} catch (Exception e) {
out.println(e);
}

%>

<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<IMG BORDER="0" <br /> >
</body>
</html>
----------------------------------

Facing below error:

type Exception report

message

description 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: 23 in the jsp file: /TestChart.jsp
CategoryDataset cannot be resolved to a type
20: {200, 304, 201, 201, 340}
21: };
22:
23: final CategoryDataset dataset =
24: DatasetUtilities.createCategoryDataset(
25: "Team ", "", data);
26:


An error occurred at line: 24 in the jsp file: /TestChart.jsp
DatasetUtilities cannot be resolved
21: };
22:
23: final CategoryDataset dataset =
24: DatasetUtilities.createCategoryDataset(
25: "Team ", "", data);
26:
27: final JFreeChart chart = ChartFactory.createAreaChart(


An error occurred at line: 27 in the jsp file: /TestChart.jsp
JFreeChart cannot be resolved to a type
24: DatasetUtilities.createCategoryDataset(
25: "Team ", "", data);
26:
27: final JFreeChart chart = ChartFactory.createAreaChart(
28: "Area Chart", "", "Value", dataset,
29: PlotOrientation.VERTICAL,
30: true, true, false);


An error occurred at line: 27 in the jsp file: /TestChart.jsp
ChartFactory cannot be resolved
24: DatasetUtilities.createCategoryDataset(
25: "Team ", "", data);
26:
27: final JFreeChart chart = ChartFactory.createAreaChart(
28: "Area Chart", "", "Value", dataset,
29: PlotOrientation.VERTICAL,
30: true, true, false);


An error occurred at line: 29 in the jsp file: /TestChart.jsp
PlotOrientation.VERTICAL cannot be resolved to a type
26:
27: final JFreeChart chart = ChartFactory.createAreaChart(
28: "Area Chart", "", "Value", dataset,
29: PlotOrientation.VERTICAL,
30: true, true, false);
31:
32: final CategoryPlot plot = chart.getCategoryPlot();


An error occurred at line: 32 in the jsp file: /TestChart.jsp
CategoryPlot cannot be resolved to a type
29: PlotOrientation.VERTICAL,
30: true, true, false);
31:
32: final CategoryPlot plot = chart.getCategoryPlot();
33: plot.setForegroundAlpha(0.5f);
34:
35: chart.setBackgroundPaint(new Color(249, 231, 236));


An error occurred at line: 38 in the jsp file: /TestChart.jsp
ChartRenderingInfo cannot be resolved to a type
35: chart.setBackgroundPaint(new Color(249, 231, 236));
36:
37: try {
38: final ChartRenderingInfo info = new ChartRenderingInfo
39: (new StandardEntityCollection());
40:
41: final File file1 = new File("..//Workspaces//TestJSP//WebContent//WEB-INF//areachart.png");


An error occurred at line: 38 in the jsp file: /TestChart.jsp
ChartRenderingInfo cannot be resolved to a type
35: chart.setBackgroundPaint(new Color(249, 231, 236));
36:
37: try {
38: final ChartRenderingInfo info = new ChartRenderingInfo
39: (new StandardEntityCollection());
40:
41: final File file1 = new File("..//Workspaces//TestJSP//WebContent//WEB-INF//areachart.png");


An error occurred at line: 39 in the jsp file: /TestChart.jsp
StandardEntityCollection cannot be resolved to a type
36:
37: try {
38: final ChartRenderingInfo info = new ChartRenderingInfo
39: (new StandardEntityCollection());
40:
41: final File file1 = new File("..//Workspaces//TestJSP//WebContent//WEB-INF//areachart.png");
42:


An error occurred at line: 43 in the jsp file: /TestChart.jsp
ChartUtilities cannot be resolved
40:
41: final File file1 = new File("..//Workspaces//TestJSP//WebContent//WEB-INF//areachart.png");
42:
43: ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info);
44: } catch (Exception e) {
45: out.println(e);
46: }


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

-------------------------------

Please guide me
Hi Friends

I want to add data in combo box in my JSP page as per selection done in another combo box. For example:

1st combo box Country
2nd combo box languages

when I select country in first combo box it will load related languages (one or many) in second combo box.

Please help
Error is still same: I think i am not writing correct code in web.xml. Please help me
10 years ago
JSP
Still genrating Error
10 years ago
JSP
Hi Friends

I am accessing this link http://localhost:8080/TestJSP/Test.jsp and genrating same error.Please find the directory structure,web.xml file details and errors as below:

1. Directory Structure where Test.Jsp is jsp page, TestJSP is project folder


2. Web.xml (details)
------------------
3. Error
---------

HTTP Status 404 -

--------------------------------------------------------------------------------

type Status report

message

description The requested resource () is not available.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.26

10 years ago
JSP
Thank you for the directory structure. One more thing I want to know what I should write in web.xml file because I am still getting the same problem. I think it is because of web.xml details. Please help me.
10 years ago
JSP