# Tag to take a java class in JSP page

Hi,
� need to get a tag to get a java class for example Test.java into a JSP page like MyJSP.jsp so that � can ,after doing this, call its methods, variables etc.
Thank you !

� know a way to do th�s us�ng JRun but the programme � have (NETBEANS IDE 3) does not accept �t.

### Similar Messages

• Calling java class from jsp page

Dear Friends.
I wrote jsp page and java class.
Am calling java class from jsp page. after processing result,
I have to refresh jsp page from java class.
processing time may take 5 minutes or 1 minute etc. that depends on user.
Can It be possible ? if possible , How ?

Ok, I get a very strange error now:
org.apache.jasper.JasperException: Unable to compile class for JSPerror: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
What is this??? Anyone?

• How to load java class from jsp page?

hi all!
Does anyone know how to load java class from jsp page?
I try to load java class from jsp page.
Is it possible to load java class fom jsp page?
thanks and have a good day!

What I mean is How to load/open java class file from jsp page?
I think we can open Applet from jsp page by using
<applet code=helloApplet.class width=100 height=100>
</applet>
but, how to open java class which is an application made by Frame?
thanks and have a good day

• Ordinary java class and jsp page

hi i want to use some java class(not javabean ) in my jsp . how do i import them and use them?

You can just import the package into your JSP, and access it like any other class of the Standard Java API that you access.
fun_one

• Passing parameters from a Java class to Jsp page

Hi everybody. I'm newbie in using Java class in conjunction with JSP pages. Infact I have a problem. How can I pass the parameters used in a Java class (as UserName, Password, and so on..) to a JSP page? What methods (and classes) I have to use?
Have a nice day

It still doesn't work. I write the code
//my java class
package channel_service;
import java.util.Vector;
* <p>Title: </p>
* <p>Description: </p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
private Vector parameters = new Vector();
public void setParameters( String UserId ) {
public Vector getParameters() {
return parameters;
//my jsp page
<%@ page import="java.util.Vector" %>
<html>
<body>
<br>
<br>
<center><h2><i>In the list below you'll find all your personal information (as UserID, Password and so on...)
and all the function you have the rights to use</i></h2></center>
<br>
<br>
<table align=center>
<tr>
<%
cl.setParameters();
Vector params = cl.getParameters();
String UserId = (String)params.elementAt(0);
String Pin = (String)params.elementAt(1);
String Greeting = (String)params.elementAt(3);
%>
<td><h2><b><i>User ID = <%= UserId %></td></tr>
<tr><td><h2><b><i>PIN = <%= Pin %></td></tr>
<tr><td><h2><b><i>User Name = <%= UserName %></td></tr>
<tr><td><h2><b><i>The system says <%= Greeting %></td></tr>
</table>
</body>

• Import java-classes in JSP-page

Hi,
I'm starting with JSP and with trying one of the first examples in the book "beginning J2EE 1.4" from wrox, i got following problem.
i'm trying to import a java-class in the package CH03 with
<%@ page import="Ch03.FaqCategories" %>but he didn't find the package Ch03.
I try already many things and i have no idea of the cause of the problem. So it's difficult to give information that leads to the solution.
jsp-page: /Ch03/welcome.jsp
java-classe: /Ch03/WEB-INF/classes/Ch03/FaqCategories.class
If you need source-codes or other information, just ask.
Thanks,
Dennis

Thank you,
Your help was one step into the good direction and that problem is solved.
The application work now with studio one, but if i try it to work it with a stand-alone tomcat server it doesn't work anymore. I go first try to solve this problem by my self or at least try to describe the problem more exactly, before i ask for new help.
but if you have any idea, that's always welcome...
with regards,
Dennis

• How to use java class in jsp page of JSPProvider?

Hello everybody.
I created simple JSPProvider channel with portal amconsole and named it "jspprov1". Then I created "jspprov"1 directory under "/ets/opt/SUNWps/desktop/sampleportal". I put "index.jsp" in it. And it worked until I add this line into "index.jsp": <% @page import="jspprov1package.aclass1" %>. Then I created directory "jspprov1package" under "/ets/opt/SUNWps/desktop/classes" and put "aclass1.class" into it and into "/ets/opt/SUNWps/desktop/classes" itself. I created "aclass1.class" on the other machine (with no installed portal) in j2sdk1.4.1_02: "javac aclass1.java". The text of this class is simple:
"package jspprov1package;
public class aclass1{
public int int_field = 10;
But the page still don't work. It writes on the portal desktop "ERROR: Content is not available".
Does anybody know why this happened?

Sorry, there were mistakes in jsp page and java files.
I maked the channel "show exceptions" and found them out.

• Scope of a java class in JSP page

Hi
If I use a java bean using the
<jsp:useBean
id="beanSomeName"
scope="page|request|session|applicaton
I can specify the scope of of the bean after which I can assume it is Garbage Collected.
However if I just create a new Java Class in a jsp bean ( I inherited this code ) what will be scope of this java class. When will it be Garbage collected.
Is it Page scope?
Thanks
bib/-

If you do
<% MyClass c = new MyClass(); %>
and don't do anything else to store it in the request or session than it is like page scope.
if you do
<%! MyClass c = new MyClass(); %>
it is more like application scope.

• Calling my Java class from JSP page

Hello, I am trying to call my Java class from my JSP page passing parameters to it and getting back a collection of result sets. Can someone tell me what I might be doing wrong:
JSP code to call Java class:
<%
String strEssUser = "test";
String strProcessingMonth = "JUL";
String strProcessingYear = "2002";
strQueryList=new ListReturn(strEssUser.toString(), strProcessingMonth.toString(), strProcessingYear.toString());
%>
I get this error when I try to run this JSP page using tomcat:
C:\Program Files\Apache Tomcat 4.0\work\Standalone\localhost\em\jsp\Test_0005fSummarySBU_0005fscreen$jsp.java:77: Class org.apache.jsp.ListReturn not found. strQueryList=new ListReturn(strEssUser.toString(), strProcessingMonth.toString(), strProcessingYear.toString()); I'm not sure if this problem is the way I am calling the Java class, or if I have a problem in the Java code itself. Can anyone help? Ok, I get a very strange error now: org.apache.jasper.JasperException: Unable to compile class for JSPerror: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi). What is this??? Anyone? • Java class into jsp page hi i,m a beginnner how can i run my own java class into a JSP file? please help me! thanks If you understand the OO concepts and wrote the Java class right, then all you need to do is something like:YourJavaClass yourJavaClass = new YourJavaClass(); yourJavaClass.doSomething();After all I rather recommend to use servlets for business logic instead of JSP (read: scriptlets). • Importing java classes into jsp page I'm trying to import java classes inside my jsp page, while doing that i am getting compilation error "package uma.natarajan.javaclasses" not found. I don't know where to copy the java files. i'm keeping my jsp files under public_html folder Hi uma, create uma\natarajan\javaclasses under weblogic_home\myserver and copy java classes(u want to import) to uma\natarajan\javaclasses and then u try. Concept is the java classes u import should be present in a classpath. Hope this may help u, Arun, [email protected] "uma natarajan" <[email protected]> wrote in message news:3a490bcb$[email protected]..
> I'm trying to import java classes inside my jsp page, while doing that i
I don't know where to copy the java files. i'm keeping my jsp files under
public_html folder

• Sharing java class among JSP pages. Urgent!

Hi,
I have a class A and two JSP pages P1 and P2 page.
i need to share the class values in both the pages.
that is, whatever am doing in class A through P1 should be impacted on P2.
Please tell me how to do this.
Thaks,
Raja.

Well then you might try
session.setAttribute("myBean", myBean);and
MyBean myBean = (MyBean) session.getAttribute("myBean");The session is common space for storing the user's objects if you want to keep them over multiple requests.
The session is implicitly available to all JSPs and via the Request object in a servlet.
If the information is common to all users, another alternative may be to implement it as a Singleton bean - or have a static instance of it. But that may not be what you actually want.

• Using java class from JSP page

I have a class that connects to the database and return the result in form of array of objects, now I wrote a tester and I was able to print the result on the console but when it came to JSP how can I use this class I am a bit confused, how can I declare an array of objects and save the result that comes from the class method
note: my class is not a bean it is a service class that contain methods to retreive different information from the database.
I would apritiate any help but please make it in sequence for example declaring an array to hold the result then call the method that returns the array of objects..etc
thank you

You can access a class in the same way as a bean, after all a bean is just a class that follows a set of rules.
You need to put your classes in packages to access them.
I have 2 packages, params and DTO. I set the class that returns the Data Transfer Object, or array of objects up as I would a bean
<jsp:useBean id="DTO" scope="request" class="params.DTO" />
I think you skip the above declaration and access it directly in code using
params.DTO();
but setting it up as I would a bean allows me to simply use
DTO();
DTO is the class that passes back the array of objects.
Objects themselves I have in a seperate package, also called DTO (sorry if this is confusing, made sense at the time :-) ) You dont need them in seperate packages, just helped me keep DTO objects seperate from business logic classes......
Now before I use params.DTO() I declare a variable of the Object type DTO() returns
<%! DTO.workSheet[] ws; %>
So, ws is the object type that will be returned by params.DTO()
Then to get my array of objects back from params.DTO() :-
ws = DTO.workSheet(day);
or if you dont like the bean declaration
ws = params.DTO.workSheet(day);
You need to put your packages under WEB-INF/Classes when using Tomcat
So I have
Tomcat 5.0\webapps\myApplication\WEB-INF\classes\params
Tomcat 5.0\webapps\myApplication\WEB-INF\classes\DTO
Under which reside the classes

• Passing vector between java class and jsp page

Hi,
I think this is similar to the last post but anyways maybe somebody can help us both out bontyh.....I am getting an error saying undefined variable or class when i try to access a Vector which was returned in a class.
Anyways anyone got any ideas?

• Java Classes and JSPs (urgent)

hi, my question is:
How can i invoke normal java classes methods using Jsp`s for this??, is it possible??, if it is, then how do you do this, and where do you have to put the java classes in order to find them from a jsp.
thanks

Hi,
You can access normal java classes in JSP pages. You have to import them in the header like this:
<%@ page language="java" import="//your java class file with package"%>
or if u r using java beans, then use the <usebean> tag. Put the java classes in the classes directory. Which server u r using? If it is JWS, then u have a specified classes directory, where u have to put all the class files along with their packages. Hope this will help.
atanu.

### Maybe you are looking for

• BPEL Process Manager Generated WSDL

We are working on an ant build framework for a Oracle SOA Suite 10.1.3.3.0 project, consisting of a main BPEL process that is synchronously calling another BPEL process via an ESB. This second process uses the same ESB to call back the original proce

• How to convert binary file to a particular format?

Hi, I am having a requirement. I have in database various kinds of files stored as binary format. Its a sybase database. Now the files can be .pdf, or .doc also. But they are stored in binary format. I need to read the file from database. Now I can u

• MaxDB undefined state

I'm not sure if this is the correct forum but I recently installed miniSAP with MaxDB. When I tried to start the application server I get the following output. ============== Starting System NSP ================ ======================================

• Education SI- IT0607 Slovenia

Hi all, If anyone knows how to edit/change/replace the picklist for Levels of education in IT0607, please help. This is a Slovenia specific Education infotype. I am aware that tables T7SI0T and T7SI0V are involved, but there seemed to be some particu

• InDesign CS3 crashing on "Place..."

I'm having an issue with InDesign CS3 for Windows crashing when I attempt to use the "Place..." command. I've tried resetting my preferences and rebooting my system but neither of those has fixed the problem. Does anyone have any input as far as othe