Recompilation of java class invalidates taglib jsp page?
Hi everyone,
I have a JSP page which calls a custom tag library. On freshly compiling
everything and
calling the JSP page from a browser for the first time the output is as
expected.
However when ever I recompile one of the classes that get called anywhere in
the tag
library call the tag no longer works (internal error from the server).
To get it to work I have to change the jsp page so that it recompiles.
Weblogic server 5.1 (no service patches yet) running on NT server SP6a.
Any ideas?
MTIA
Craig
p.s
The following errors are in the log file.
Is this another class casting problem?
Does any one have any explanations?
Ta
Craig
<ServletContext-General> Servlet failed with Exception
javax.servlet.ServletException: runtime failure in custom tag 'MyTag'
at jsp_servlet._taglib._jspService(_taglib.java:89)
at weblogic.servlet.jsp.JspBase.service(JspBase.java, Compiled Code)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
, Compiled Code)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java, Compiled Code)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java, Compiled Code)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
Manager.java, Compiled Code)
at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java,
Compiled Code)
at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java,
Compiled Code)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
<ServletContext-General> root cause of ServletException
java.lang.ClassCastException: com.bt.db.MyTag
at jsp_servlet._taglib._jspService(_taglib.java:77)
at weblogic.servlet.jsp.JspBase.service(JspBase.java, Compiled Code)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
, Compiled Code)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java, Compiled Code)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java, Compiled Code)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
Manager.java, Compiled Code)
at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java,
Compiled Code)
at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java,
Compiled Code)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
"crg" <[email protected]> wrote in message
news:[email protected]...
> Hi everyone,
>
> I have a JSP page which calls a custom tag library. On freshly compiling
> everything and
> calling the JSP page from a browser for the first time the output is as
> expected.
> However when ever I recompile one of the classes that get called anywhere
in
> the tag
> library call the tag no longer works (internal error from the server).
> To get it to work I have to change the jsp page so that it recompiles.
>
> Weblogic server 5.1 (no service patches yet) running on NT server SP6a.
>
> Any ideas?
> MTIA
>
> Craig
>
>
>
>
Similar Messages
-
Extend a Java Class Inside a JSP Page?
Hello all. I'm not sure if I am thinking about this right. But what I have is a BaseClass that all of my other classes Extend. I'm inside a JSP page and want to use all of the functionality of that BaseClass. Is there anyway I can EXTEND A CLASS INSIDE A JSP PAGE or am I smoking crack?
Its an attribute of the page directive
"extends="package.class"
The fully qualified name of the superclass of the Java class this JSP page will be compiled to. Use this attribute cautiously, as it can limit the JSP container's ability to provide a specialized superclass that improves the quality of the compiled class. "
http://java.sun.com/products/jsp/tags/12/syntaxref1210.html#15653 -
How can i call java class file in jsp page
Hai,
i wants to call .class file in jsp page.
my class file is in C:\jsdk\bin.
ThanksI'm not entirely sure what you mean by "calling a class file", but I'm going to assume that you want to do something like the following in your page:
<%
MyClass myClass = new MyClass();
myClass.someMethod();
%>etc
If that's the case, then all you have to do is make sure that the class is in the servlet engine's classpath. You'll probably also need to include an appropriate import statement at the top of the page.
Hope that helps. -
Loading Java Class File in JSP page
I'm trying to load a java class file from a jsp page.
(e.g. MyFile.java <-- Source "MyFile.class<--Class file of MyFile.java")
jsp page
<%@ include file = "MyFile.class" %>
<HTML> // HTML Tags are here
MyFile.java
A normal java source file that has "public static void main" in it.
My jsp page can display it's contents, 'except' for showing e.g. "1235%%215648%%public%%$$@##" through out the page...
My guess is that it can't display my java class file..
Can anyone please help me solve this problem of mine ?
Thanks in advance : )
Yours Sincerely,
RainbowEnergiesThis is my JSP file.
<HTML>
<HEAD>
<TITLE>Activity Games</TITLE>
</HEAD>
<%
String name = "";
String id = "";
name = session.getAttribute("name").toString();
session.setAttribute("name",name);
id = session.getAttribute("id").toString();
session.setAttribute("id",id);
%>
<BODY bgcolor="#cc99ff" text="#000000" link="#E3E3E3" vlink="#CCCCCC" alink="#FF0000">
<H3><%=name%>, you have enter Activity Games</H3>
<%@ page import="Games.Lufia.*" %>
<%Lufia lufia = new Lufia();%>
</BODY>
</HTML>
After I execute...
An error occurred at line: 18 in the jsp file: /jsp/ActivityGames.jsp
error: File C:\Program Files\Apache Tomcat 4.0\webapps\website\WEB-INF\classes\Games\Lufia\Lufia.class does not contain type Games.Lufia.Lufia as expected, but type Lufia. Please remove the file, or make sure it appears in the correct subdirectory of the class path.
Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\Standalone\localhost\website\jsp\ActivityGames$jsp.java:85: Class Games.Lufia.Lufia not found.
Lufia lufia = new Lufia();
But if I comment this out....
This is my JSP file.
<HTML>
<HEAD>
<TITLE>Activity Games</TITLE>
</HEAD>
<%
String name = "";
String id = "";
name = session.getAttribute("name").toString();
session.setAttribute("name",name);
id = session.getAttribute("id").toString();
session.setAttribute("id",id);
%>
<BODY bgcolor="#cc99ff" text="#000000" link="#E3E3E3" vlink="#CCCCCC" alink="#FF0000">
<H3><%=name%>, you have enter Activity Games</H3>
<%@ page import="Games.Lufia.*" %>
<%//Lufia lufia = new Lufia();%> <--- comment this out.... (HERE)
</BODY>
</HTML>
The page shows but did not run my java class file..
Thanks again for trying to help me solve this problem of mine. : - )
Regards,
RainbowEnergies -
How to Generate a Java file for a JSP Page
Hi ,
I am using weblogic11 .
I am working on a JSP page which nearly consists of 4000 lines of code.
I need to debug the file , but weblogic server is not generating the java file for the JSP pages .
Please let me know how can i genertae Java file for the jsp pages ??JSPs are compiled into servlets automatically and those classes are stored in WEB-INF/classes folder. Servlet engine handles servlets.
-
How to use self-defined class in a jsp page
Hello:
I defined a class for displaying purpose, which is in the different folder(WEB-INF/classes) from my JSP page.
In my JSP page, I want to create an instance of my class and display something, while I get the following error: "
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 12 in the jsp file: /htmls/templateIntro.jsp
Generated servlet error:
[javac] Compiling 1 source file
/home/jiao/jsp_webserver/tomcat/work/Standalone/localhost/syllabus/htmls/templateIntro_jsp.java:72: cannot resolve symbol
symbol : class Display
location: class org.apache.jsp.templateIntro_jsp
Display display=new Display(out);"
How can I solve this problem? Should I redefine my classpath or there are some other actions I should take.
T.I.A.
Oriental SpiritHere is what I have done:
1) in Display.java, add one line "package tools;" on the top, and compile it to
create Display.class.
2) create a new folder at
/home/jiao/jsp_webserver/tomcat/webapps/syllabus/WEB-INF/classes
named tools and then put the Display.class into the newly created folder.
3) in my jsp page, add " import="tools.*"
But it still doesn't work.
Any ideas? T.I.A. -
hallo
I have craeted aPackage "TestPackage" as subdirectory in the order
tomcat\webapps\ROOT\WEB-INF\classes\TestPackage
in this package ther ist the class Test
I try to imort this class in the jsp
<%@ page language="java" import="TestPackage.*"%>
<jsp:useBean id="app" scope="page" class="Test"/>
<%
for(int i=0; i< 10; i++){
%>
<h1><%= app.getName()%></h1>
<%
%>
error:
[javac] C:\tomcat4\work\Standalone\localhost\_\test_jsp.java:43: cannot resolve symbol
[javac] symbol : class Test
[javac] location: class org.apache.jsp.test_jsp
[javac] Test app = null;
who ist the Problem ???
thanksHi Orient,
Actually <jsp:useBean /> takes fully qualified class name.
so your code for <jsp:useBean /> should be like this
<jsp:useBean id="app" scope="page" class="TestPackage.Test"/>
For more details please refer http://java.sun.com/products/jsp/tags/11/syntaxref1115.html
Regards
Goodieguy -
Unable to import a java class in a jsp file
Hi,
I am trying to import a java class in my jsp.
------------------jsp---------------
<jsp:useBean id="form" class="com.company.portlets.searchApps.object.SearchOBJ" scope="request" />
<jsp:setProperty name="form" property="*" />
<input type="TEXT" name="projectID" value='<%= form.getProjectID() %>'>
When I run the above JSP, it says that class 'com.company.portlets.searchApps.object.SearchOBJ' cannot be found.
Why?
My project structure looks like this:
Project
+Application Sources
++com.company.portlets.searchApps.object
+++SearchOBJ.java
+Web Content
++htdocs
+++searchappsportlet
++++SearchAppsPortletShowPage.jsp
++WEB-INF
+++index.jsp
+Resources
++SearchApps.deploy
Please advice...thanks!The way that JDeveloper organized the files was like this:
C:\jdev1012\jdev\mywork\WksSearchApps\Project\classes\com\company\portlets\searchAPPS\object\SearchOBJ.class
I am assuming that JDeveloper puts the file where they are suppose to be...if not, how do I change that?
thanks,
hussain -
How i can make my own connection in java source of a jsp page
How i can make my own connection in java source of a jsp page (How to get connection from JNDI datasource address) ?
imagine that i have a rowset in a web page , now i want to do some operation using
plain JDBC , so i will need a connection object.
I tried to get one of my rowsets connection but it return null ?
what is best way to retrive a connection from JNDI datasource that we define for our project?
for example if i have
myRowSet.setDataSourceName("java:comp/env/jdbc/be");
in web page constructor
now i want a pure connection from the same datasource ? JNDI
Thank youIt is not hard to get your own connection from datasource.
in your case you need to do like the the following code.
i provide sample to show you how to catch the exception and create an statement .
Connection con =null;
try{
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/be");
con = ds.getConnection();
java.sql.Statement st =con.createStatement();
}catch(SQLException sqlex){
sqlex.printStackTrace();
sqlex.getNextException().printStackTrace();
catch(NamingException nex){
nex.printStackTrace();
hth
Masoud kalali -
hi everyone,
i am trying to import a java file in a JSP page..
how do i do this???hi,
<%@page import="yourpackagename.*" %>
or
<%@page import="yourpackagename.classname" %> -
Access Java class in my JSP/JSF page and conditionally open a new browser
When the user clicks on a button in my JSP page, I'd like to launch a new browser and display certain things in that browser window while leaving the original browser window open.
My thought was to invoke a javascript method in 'onLoad' which would determine if the new window needs to be launched.
This is kinda what my page looks like:
<jsp:root version="1.2" ................>
<jsp:directive.page import="java.util.*, com.test.Configuration" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
<f:view>
<ui:body binding="#{Page1.body1}" id="body1" onLoad="launchWindow();">
</ui:body>
</f:view>
<script type="text/javascript">
function launchWindow(){
if (Configuration.openWindow()) {
window.open("hello.jsp", "newWindow", 'toolbar,width=400,height=400');
</script>
</jsp:root>My problem is that the call to "Configuration.openWindow()" does not resolve correctly. If I remove that call and simply make a call to "window.open()" all works. But once I put the condition in, nothing happens. I do not see an exception in my browser window but a new browser window does not open.
Is my syntax correct. Can I make a call to the static method 'openWindow()' in my class 'Configuration.java'.
thanks,
tscI have made some changes so that I do not directly access the 'Configuration' class in my javascript.
I have a hidden field on my form and when the user clicks the button, in my back bean, I set a value for the hidden field. In the javascript function 'launchWindow()' I check if a value has been set for the hidden field and if yes, I open a new window.
<ui:body binding="#{Page1.body1}" id="body1" onLoad="launchWindow(document.forms[0]);">
<h:inputText id="hiddenField" value="#{formBean.hiddenValue}" />
<script type="text/javascript">
function launchWindow(form){
alert("in lw");
var test = form["form1:hiddenField"].value;
alert("got test");
if (test != "")
window.open("hello.jsp", "newWindow", 'toolbar,width=400,height=400');
alert ("done test");
</script>When my page is first loaded, the launchWindow() is called and all the alerts popup as expected.
When I click on the button (the back bean sets the value on the hidden field), my page is reloaded but this time its blank.
Any ideas as to why this maybe the case?
thanks,
tsc -
Java.lang.ClassCastException in JSP page
My JSP page:
<%@page contentType="text/html"%>
<HTML>
<HEAD>
<TITLE> JDBC Servlet/JSP Example </TITLE>
</HEAD>
<BODY>
<%@ page import="myBeans.memoryBean" %>
<%@ page import="java.util.Vector" %>
<H1> JDBC Servlet/JSP Example </H1>
<H2> <%= session.getValue("message") %>
</H2>
<UL>
<%
Vector vData = (Vector) session.getValue("res");
myBeans.memoryBean mb;
Object o;
for (Enumeration e = vData.elements() ; e.hasMoreElements() ;) {
o = e.nextElement();
mb = (myBeans.memoryBean) o;
%>
<LI> <%= o.getClass().getName() %>
<% } // end for
%>
</UL>
</BODY>
</HTML>Notice that I don't even use the object I cast but I still get the error message:
Exception:
java.lang.ClassCastException
at _memory._search._jspService(_search.java:66)
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java)
at oracle.jsp.JspServlet.internalService(JspServlet.java)
at oracle.jsp.JspServlet.service(JspServlet.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.jserv.JServConnection.processRequest(JServConnection.java:314)
at org.apache.jserv.JServConnection.run(JServConnection.java:188)
at java.lang.Thread.run(Thread.java:534)When I comment out the line that castes my object my browser displays:
JDBC Servlet/JSP Example
Records Found:
* myBeans.memoryBean
* myBeans.memoryBean
* myBeans.memoryBean Notice that the three objects that are returned are exactly the type that I caste to.
Also, I did a getClass().getClassLoader() when I create the objects in my servlet code and again on the JSP pages for each object I pull out of the vector and the class loader matched.
I even changed the package on my bean class and recompiled everything to make sure it wasn't a old .class file floating around.
Could this have something to do with my classpath or where my classes are being placed? I found a similar problem here: http://forum.java.sun.com/thread.jsp?forum=33&thread=380437&start=0&range=15&hilite=false&q=
but the explanation of what was done wasn't clear
Anyone have any idea what's going on here?
I am using:
Oracle 9i
Oracle HTTP Server Powered by Apache/1.3.12 (Unix)
ApacheJServ/1.1
Thanks in advance.
- LinusIs ti at all possible that you have another jar / zip file with the same class file in it, seemingly away from the Server classpath ? In which case this could happen even though logically it shouldn't !!!
-
Cannot compile java beans in my jsp page
Hi all
I have created jsp pages which contains java beans. Now its working fine on my machine(XP OS) but when i put it on windows 2000 server it gives the following 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: -1 in the jsp file: null
Generated servlet error:
[javac] Since fork is true, ignoring compiler setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler setting.
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:353)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
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:256)
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:171)
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:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Unknown Source)
please helpOk, jsp pages to not contain java beans, java beans are separate classes which you access from a jsp.
Is this what you have done, i.e. created classes under classes/yourPackage ?
If so, you do not need to recompile the class when you move it, you can move the pre-compiled class file.
In terms of your error, I have no idea, but it looks interesting!!
The most likely cause is a difference in the JDK versions you are running on the different machines. If the JDK on windows 2000 is older, you may need to upgrade it. -
How to import a java class in a JSP
Hi All,
I have a java class file called myTest.class (i made after compilation of myTest.java). I have a JSP page that uses this java class file.
These 2 files are in same folder called c:/test
and iam importing this java class file into my jsp file and that too at the start of this jsp file:
<%@page import="myTest" %>
BUt iam getting an error ..............when iam running this JSP page:
/opt/bea81sp2/user_projects/domains/wliDomain/./Managed2/.wlnotdelete/extract/Managed2_myTest_myTest/jsp_servlet/__test.java:20: '.' expected
probably occurred due to an error in /test.jsp line 5:
<%@page import="myTest" %>
Please advise how to solve this problem
-sangitaDon't bother with the import
when iam not importing this class file into my JSP, then on my JSP, the class file is not found.
Here is my code: and these 2 class file are in c:/test
import org.apache.tools.ant.taskdefs.Ant;
import org.apache.tools.ant.taskdefs.Property;
import org.apache.tools.ant.types.*;
import org.apache.tools.ant.*;
import org.apache.tools.ant.taskdefs.ExecTask;
import org.apache.tools.ant.types.Commandline;
import java.io.File;
* Creates an Ant project to run an Ant build
* @author myself
* @version 1.0
public class RunTest extends Ant {
String applicationName;
String buttonClicked;
String boxName;
String targetName;
public void applicationName(String applicationName){
this.applicationName = applicationName;
public void boxName(String boxName){
this.boxName = boxName;
public void buttonClicked(String buttonClicked){
this.buttonClicked = buttonClicked;
public RunTest() {
public void goTest() {
if(this.buttonClicked.equalsIgnoreCase("deploy") && this.applicationName.equalsIgnoreCase("scsmail") && this.boxName.equalsIgnoreCase("testnet")){
this.targetName = "deploy-scsmail-testnet";
if(this.buttonClicked.equalsIgnoreCase("undeploy") && this.applicationName.equalsIgnoreCase("scsmail") && this.boxName.equalsIgnoreCase("testnet")){
this.targetName = "undeploy-scsmail-testnet";
Project project = new Project();
project.init();
System.out.println("printing 1 ....");
ExecTask exec = new ExecTask();
exec.setProject(project);
exec.setExecutable("/opt/bea/weblogic81/server/bin/ant.bat");
exec.setDir(new java.io.File("/export/home/beamon/bin"));
Commandline.Argument arg = exec.createArg();
// arg.setLine("-f scsmail.xml test -listener org.apache.tools.ant.XmlLogger -logfile D:/antProject/src/log.xml");
arg.setLine("-f build.xml "+ targetName + " -listener org.apache.tools.ant.XmlLogger -logfile /export/home/beamon/bin/log.xml");
System.out.println("printing 2....");
//exec.setOutput(new File("D:/antProject/logs/prob.txt"));
exec.execute();
System.out.println("printing 3....");
-----------------------the JSP page is called as test.jsp
<%@page contentType="text/html" %>
<%@page import="java.io.*" %>
<%@page import="java.util.*" %>
<%@page import="java.net.*" %>
<%@page import="RunTest" %>
<HTML>
<TITLE>TESTING ANT GUI</TITLE>
<HEAD>
<META HTTP-EQUIV="Refresh" CONTENT="3000" >
<meta http-equiv="Cache-Control" content="no-cache">
</HEAD>
<BODY BGCOLOR="silver" TEXT="333333">
<table border=0>
<tr align="left"><td align="left"><FONT SIZE="-1"><B> Test Page <FONT SIZE="-1"><B></td></tr>
</table>
<hr></center>
<form action="./test.jsp" method="POST" name="testForm">
<table>
<tr>
<td>
<select name="appName" size=1>
<option value="">Select Application Name
<option value="scsmail">scsMail
<option value="clientmanager">ClientManager
</select>
</td>
<td>
<select name="boxName" size=1>
<option value="">Select Box Name
<option value="testnet">TestNet
<option value="production">Production
</select>
</td>
</table>
<table>
<input type="submit" name="deploy" value="deploy">
<input type="submit" name="undeploy" value="undeploy">
</table>
<%
RunTest rt = new RunTest();
rt.applicationName(request.getParameter("appName"));
String deployButton = "";
deployButton=request.getParameter("deploy");
String undeployButton = "";
undeployButton=request.getParameter("undeploy");
if(!deployButton.equalsIgnoreCase("")){
rt.buttonClicked(request.getParameter("deployButton"));
if(!undeployButton.equalsIgnoreCase("")){
rt.buttonClicked(request.getParameter("undeployButton"));
rt.boxName(request.getParameter("boxName"));
rt.goTest();
%>
</form>
</table>
</BODY>
</HTML> -
How to access variables declared in java class file from jsp
i have a java package which reads values from property file. i have imported the package.classname in jsp file and also i have created an object for the class file like
classname object=new classname();
now iam able to access only the methods defined in the class but not the variables. i have defined connection properties in class file.
in jsp i need to use
statement=con.createstatement(); but it shows variable not declared.
con is declared in java class file.
how to access the variables?
thankshere is the code
* testbean.java
* Created on October 31, 2006, 12:14 PM
package property;
import java.beans.*;
import java.io.Serializable;
public class testbean extends Object implements Serializable {
public String sampleProperty="test2";
public String getSampleProperty() {
return sampleProperty;
}jsp file
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page import="java.sql.*,java.util.*"%>
<html>
<head>
<title>Schedule Details</title>
</head>
<jsp:useBean id="ConProp" class="property.testbean"/>
<body>
Messge is : <jsp:getProperty name="msg" property="sampleProperty"/>
<%
out.println(ConProp.sampleProperty);
%>
</body>
</html>out.println(ConProp.sampleProperty) prints null value.
is this the right procedure to access bean variables
thanks
Maybe you are looking for
-
Draw back of Automatic PO creation
Dear Friends, What are all the draw backs will come if i cxreate PO automatically once GR posted. Kindly explain me. Rgds, Sankar.D
-
Apple script for Message box when Mail app Compose Window Opens
Hi there I'm trying to make mail app remind me to choose the right emaill address to send from since I have several email addresses. Is there a way I can make or write an apple script for a message box to pop up whenever mail app's compose window ope
-
How to subscribe to a JMS topic with a selector
I'd like to receive messages on a JMS topic satifying a selector. I'm trying examples\webservices\message. The ConsumerClient receives messages on "examples.soap.msgService.MsgSend". But if I want to sepcify a selector, how do I do it? Thanks! Kevin
-
How get codesource of caller in SecurityManager, change perms based on it?
I want to have a SecurityManager that does something like: public void checkPermission(Permission perm) //Pseudo code if ( allowedList.contains( caller_context ) ) return; else //Pass to another SecurityManager object
-
Premiere Pro CS3 crashing on export
I have been using Premiere Pro CS3 for a while and I assure you I have NEVER touched any export settings, but now it is suddenly crashing on export. There is no error message or anything, the program just turns off. A friend suggested I change the se