JSP - useBean tag works only for first request
hey why donnu change the scope to PAGE, give a try.........
Vishal Vishnoi wrote:
> Using Weblogic 5.1 I am trying to work with a simple example of a JSP
> page which has got a usebean tag. The tag is
>
> <jsp:useBean id="resourceTypes" type="java.util.ArrayList"
> scope="request" />
>
> * This works only the first time I load the page.
>
> If I try to load the page again. I get the following error
>
> javax.servlet.ServletException: Could not find bean 'resourceTypes',
> type 'java.
> util.ArrayList' in scope
>
> --Vishal
Similar Messages
-
Master Page: Alternatives (Subform Set) works only for the first page
Hi everybody!
I have bumped into a very weird problem with ADOBE Forms:
When I create an 'Alternative' in a Context area and then place it on a Master Page, it works only for the first page. On the rest of pages it always show the 'TRUE' subform, regardless of the condition (which is not changed, of course). Absolutely the same Alternative works perfectly in a Content area for all pages.
Has anybody seen something like this? Any ideas why?
Thank you!This happens because of the processing of the form.
You can see this here:
LiveCycle ES2 * Adobe LiveCycle Designer ES2
You have to put a own variable, which is set with the value you want in the very beginning.
I know, it is not that logical in the first moment, but it makes sense.
Regards
Florian
PS: This space SAP Interactive Forms by Adobe is the correct for questions like that -
Calling an inner class in a jsp:usebean tag
Hi everybody !
Here's my problem : working in my project on multiple pages, I'm using inner classes/beans to limitate my '.java' files but I'm stuck when calling that 'inner-bean' in my jsp:usebean tag.
First, I tried to declare in the class parameter : 'class="MyPrincipalBean.theInnerBean" but jsp returns me a 'not found' message.
I tried an other issue with this :
'class="MyPrincipalBean$theInnerBean" but I encountered a 'Attempt to use a bean type without a void constructor in jsp:useBean tag (JSP 1.1 specification, 2.13.1)'. Since I can't find that specification, I'm sending an SOS.
Am I on the good way ? If somebody as encoutered that sort of problem, it would be very kind of you to help me.
Thanks for your help !
[email protected]Thanks for your help!
I must recognize that my explainations weren't really precise.
My principal bean owns a table of my inner-class type :
public class FirstBean extends EntityBean {
private SecondBean[] tabSB;
public SecondBean[] getTabSB() {...}
public void setTabSB(SecondBean[] p_tabSB) {...}
public class SecondBean {...}
So I can call a specific bean from the tab in my Servlet for another page.
But I think I have the solution and I need your advise :
I tried this :
<jsp:useBean id="FirstBean" class="<...>.FirstBean" scope="session" />
<jsp:useBean id="SecBean" beanName="<...>.FirstBean$SecondBean" type="<...>.FirstBean$SecondBean" scope="request" />
And would you believe it ? It seems to work ! But I have to test this farther to be sure. What do you think of it ? -
JSP Custom Tag and Expressions for parameters
This should be an easy question. I am trying to use an expression for a
parameter to a jsp or custom jsp tag. When I hard code a value for the
parameter, the tag works fine but when I use the expression, the expression
gets evaluated but the tag itself does not resulting in the tag being shown
in my output.
For example:
<jsp:forward page="www.slashdot.org"/> works
<jsp:forward page="<%=request.getParameter("DESTINATION")%>"/>
places the following into my html output
<jsp:forward page="www.slashdot.org"/>
Can someone please tell me what I am doing wrong or at least offer some
debugging hints?
Thanks in advance!
Jacob Meushaw
I have experienced almost this exact same problem, but with a custom
tag. And I did make sure that my attribute specified
<rtexprvalue>true</rtexprvalue>. Here is the weird part.
If I do the following JSP code everything works fine:
<% String foo = request.getParameter("bar"); %>
<mytag:custom param="<%= foo %>"/>
But if I do this:
<mytag:custom param="<%= request.getParameter("bar") %>"/>
I get the following in my html output:
<mytag:custom param="whatever bar is set to in the request"/>
It appears that the JSP container only does a one pass evaluation.
Is this the spec of is this a bug?
Jacob Meushaw wrote:
>
> This should be an easy question. I am trying to use an expression for a
> parameter to a jsp or custom jsp tag. When I hard code a value for the
> parameter, the tag works fine but when I use the expression, the expression
> gets evaluated but the tag itself does not resulting in the tag being shown
> in my output.
>
> For example:
>
> <jsp:forward page="www.slashdot.org"/> works
>
> <jsp:forward page="<%=request.getParameter("DESTINATION")%>"/>
> places the following into my html output
> <jsp:forward page="www.slashdot.org"/>
>
> Can someone please tell me what I am doing wrong or at least offer some
> debugging hints?
>
> Thanks in advance!
>
> --
> Jacob Meushaw
Jeff Smith
[email protected]
BEA Systems, Inc.
720-565-6613
-
Need help with the jsp:useBean tag
Dear Fellow Java/JSP developers:
I am trying to use the <jsp:useBean> tag in a jsp that displays the values from a javaBean that gets populated by another class.
<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import = "java.util.ArrayList"%>
<%@ page import = "java.util.Iterator"%>
<%@ page import = "salattimes.CalendarParse" %>
<%@ page import = "salattimes.Salat" %>
<!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=UTF-8">
<title>JSP Page</title>
</head>
<body>
<jsp:useBean id="test" scope="session" class="calendar.Time" />
<% CalendarParse sTime = new CalendarParse();
Time mytime = sTime.runExample();%>
<%=mytime.getA() %>
<%=mytime.getB() %>
<%=mytime.getC() %>
<%=mytime.getD() %>
<%=mytime.getE() %>
</body>
</html>However, up to now, I am only able to display the values on my JSP page using the scriptlet
<% CalendarParse sTime = new CalendarParse();
Time mytime = sTime.runExample();%> to declare and create the object (the method call sTime.runExample(); populates the fields in the Java Bean), and the expressions:
<%=mytime.getA() %>
<%=mytime.getB() %>
<%=mytime.getC() %>
<%=mytime.getD() %>
<%=mytime.getE() %>to present the values on the screen. What I would like to do is assign the object that I create to a javaBean reference declared in a <jsp:useBean> tag as follows:
<jsp:useBean id="test" scope="session" class="calendar.Time" />
<% CalendarParse sTime = new CalendarParse();
test = sTime.runExample();%>and then present the values stored in the bean to the JSP page as follows:
<jsp:getProperty name="test" property="a" />
<jsp:getProperty name="test" property="b" />
<jsp:getProperty name="test" property="c" />
<jsp:getProperty name="test" property="d" />
<jsp:getProperty name="test" property="e" />
<jsp:getProperty name="test" property="f" />Is this possible? When I try the above, I get "null" as my output on the screen. When I try the first approach listed above, I get the values I am looking for. Is there a way to accomplish this using the <jsp:useBean> approach?
Thanks to all those who reply.
Sincerely;
FayyazThe code:
<jsp:useBean id="calendar" class="calendar.CalendarParse" scope="session"/>
<c:set var="time" value="${calendar.time}"/>Would be roughly equivalant to:
calendar.CalendarParse calendar = new calendar.CalendarParse();
Object time = calendar.getTime();I assumed that the CalendarParse object was in the calendar package because that was were your Time class was (when you used <jsp:useBean id="test" scope="session" class="calendar.Time" />"), but when I look back at your original post I see I was wrong and the use of calendar as both the incorrect package and the variable name was confusing. To make the code more similar to your original post the code should have read:
<jsp:useBean id="sTime" class="salattimes.CalendarParse"/>
<c:set var="myTime" value="${sTime.time}" scope="session"/>
${myTime.a}
${myTime.b}
${myTime.c}
etc...Here is an explanation of the parts:
/* name of the variable */ /* fully qualified class name, package.className */
<jsp:useBean id="sTime" class="salattimes.CalendarParse"/>
/* name of the new object from bean */ /* source of object, variable.property */ /* Scope of new object */
<c:set var="myTime" value="${sTime.time}" scope="session"/>
/* data to display variable.property */
${myTime.a}Where a 'property' in a bean is defined as a method in the form of getProperty(). So the 'time' property is getTime() and the 'a' property is getA(). -
Using variables in a jsp:useBean tag
I was wondeing if it is possible in any way to use variables in a jsp:useBean tag. Here is an example of what I am trying to do.
<%
String beanType = request.getParameter( "bean" );
if( beanType.equals( "Bean1" ) ) {
beanClass = "com.myCompany.Bean1";
} else {
beanClass = "com.myCompany.Bean2";
%>
<jsp:useBean name="<%= beanType %>" class="<%= beanClass %>"/>
I also tried using this approach
<%
if( beanType.equals( "Bean1" ) ) {
%>
<jsp:useBean id="bean" class="com.myCompany.Bean1"/>
<%
} else if( beanType.equals( "Bean2" ) ) {
%>
<jsp:useBean id="bean" class="com.myCompany.Bean2"/>
<%
%>
Neither approach seems to work. Is there any way around this problem?
Thanks,
Marcus.Hi,
check:
http://forum.java.sun.com/thread.jsp?forum=45&thread=398998&tstart=75&trange=15 -
How can i load A gui JTable bean through jsp:useBean tag in a jsp page
Hi,
i am chiranjit , i am in a jsp project . i am desparately looking a solution for below stated problem:
i want to make a jsp page for master entry , that why i want to load a GUI Java bean in my jsp page.This GUI Bean contaning a JTable in which allow grid type data entry in the jsp page. But i am unable load that bean in the jsp page through jsp:useBean tag in my page.So if you have any solution then send in the forum as early as possible.
Thank you
chiranjitNo can do. JSPs can only output plain HTML (and javascript...) They are not used like normal Java classes.
If you need a complex GUI then you might use an Applet instead. If you want to use a JSP then you are stuck using normal HTML components, like <table> <form...> <input type="text"> etc... -
jsp:useBean error== The value for useBean class is invalid
Can anybody tell me why am i getting the error for the JavaBean.
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /SimpleBean.jsp(9,0) The value for the useBean class attribute com.stardeveloper.bean.test.SimpleBean is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1272)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1178)
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:3426)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:216)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
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.20 logs.
Apache Tomcat/6.0.20
my jsp file is in path c:\tomcat6\webapps\dev\SimpleBean.jsp
my JavaBean compiled class is in path
c:\tomcat6\webapps\dev\WEB-INF\classes\com\stardeveloper\bean\test\SimpleBean.class
and my SimpleBean java class declaration is
package com.stardeveloper.bean.test;
public class SimpleBean implements java.io.Serializable
and my jsp page SimpleBean.jsp pages call to useBean is as follows
<jsp:useBean id="simple" class="com.stardeveloper.bean.test.SimpleBean">
<jsp:setProperty name="simple" property="name" value="Sujoy" />
<jsp:setProperty name="simple" property="age" value="26" />
</jsp:useBean>
Please help me anybody.First, try restarting Tomcat :-)
Main 3 reasons for "useBean class is invalid"
- class must be in a package (ok)
- class must be public, and have public constructor that takes no arguments (check)
- class must be compiled, valid and on the classpath. Normally this means the WEB-INF/classes directory.
From what you have told us, everything seems to check out.
Try recompiling the .class file to ensure it is valid.
Does your constructor do anything which might thrown an exception?
Can you invoke it in scriptlet code without getting an exception?
<%@ page import="com.stardeveloper.bean.test.SimpleBean" %>
<% SimpleBean sb = new SimpleBean() %>Trying it in scriptlet code like this might give you a different error message that might help your diagnosis.
cheers,
evnafets -
Jsp:useBean not work when I install aplication!!
Hi
I developing an application with UIX JSP on Jdeveloper 9.0.2 and i using something like this:
<jsp:useBean id="cbean" class="oracle.jsp.dbutil.ConnBean" scope="session" />
<jsp:setProperty name="cbean" property="dataSource" value="jdbc/BiblosConnectionCoreDS" />
</jsp:useBean>
<%
try{
cbean.connect();
This code work fine in standalone mode, but when i install this application on 9IAS, with an archive War, the code <jsp:useBean, not work.
What is missing for? o What is the reason for this situation
Thanks for some help?many thanks for your reply, and I have download new updates driver from your website (http://consumersupport.lenovo.com/en/DriversDownloads/drivers_show_890.html) and Installer it on my Y410 but it still does not work!!!
the firstly: when I star up with win7, I can see a speaker icon right down near the clock, when I click mouse on it, I can see: Volume Mixer - Speaker with Device(Speaker Hight definition Audio Device, Digital Audio(S/PDIF) ( Hight definition Audio Device) ).
Look in devicemanger I can see "Sound , video and game controll " has already installer with 'Hight definition Audio Device ' & 'Unimodem Hafl-Duplex Audio Device' below... but I cannot hear the sound when I play music, video, games...etc...
the second: when laptop wakeup after 'sleep' mode, I can hear sound on speaker! but headphone jack does not work when I plug my headphone jack into it (I cannot hear sound with headphone), however I still hear sound from speaker, in this case!
Can you help me or tell me how I can do ?!
Thanks and Best Regards,
jupitervn -
A couple of days ago, I connected to the Internet as usual & opened Firefox, only to be greeted by an almost blank screen with a Google-type search box in the middle & this message from McAfee:
"Your default search settings have changed. This may pose a security risk. Would you like to restore them to McAfee Secure Search to provide a safer searching experience?"
instead of my usual home page (BT Yahoo). I naturally clicked on the "Yes" option in the message, but rather than restoring my BT Yahoo home page, all that did was to insert the McAfee logo to the left of the search box in the top right-hand corner of the screen. The first time it happened, I had to search for the BT Yahoo page & then followed the standard procedure for setting it again as my home page. It worked only for that session: each time I shut down Firefox or restarted my computer after that, all I got was the blank "search page" & restoring the previous session was the only way to get back to BY Yahoo. How on earth do I make the home page setting permanent?
As far as I'm aware, I have done nothing to alter my search settings. However, I am anything but computer-literate, so I may have done/pressed something without realising it, but trying to understand what is now happening is far beyond my limited IT skills.See McAfee support to find out how to disable that McAfee feature - that isn't part of the normal Firefox installation.
-
Unable to use jsp:useBean tag
when I use
<jsp:useBean id="addressBean" class="AddressBean" scope="session"/>
I get the following error
Exception Details: org.apache.jasper.JasperException
Unable to compile class for JSP No Java compiler was found to compile the generated source for the JSP. This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar from the JDK to the common/lib directory of the Tomcat server, followed by a Tomcat restart. If using an alternate Java compiler, please check its installation and access path.
So my question is how to use the <jsp:useBean> tag in JSCPlease see my message How to set developer's mode for oracle jsp engine.
As a very early warning of the future, this way of setting configuration paramemter in web.xml for oracle jsp engine will be deprecated in the next major version of oc4j and desupported probably later on. Yes, it is still supported in 10.1.3 and the next major version, though. -
SQLLDR -- WHEN works only for the first INTO table
I tries to load 2 table from one data file.
SQLloader loads only the first table in the control file.
If I switch the INTO sequence it then load the other table that now its the first in the control file.
It works fine if I split the control into 2 controls that loads the table from
the same data file.
Is this a bug or am I forces to load it as two parts?
-------------------------- control file ----------------------
LOAD DATA
INFILE 'test.xml' "STR '\n<ENDREC/>\n'"
INTO TABLE MSDESTINATIONXML
APPEND
WHEN typeid = "D"
FIELDS TERMINATED BY '^'
typeid FILLER char(1),
ID char(255),
letterid char(255),
left char(2000) TERMINATED BY '\n<ENDROW/>\n')
INTO TABLE MSLETTERXML
APPEND
WHEN typeid <> "D"
FIELDS TERMINATED BY '^'
typeid FILLER char(1),
ID char(255),
bundleid char(255),
left char(4000) TERMINATED BY '\n<ENDROW/>\n',
right char(4000) TERMINATED BY '\n<ENDROW/>\n')
---------------------------- end control file ----------------------------------This happens because of the processing of the form.
You can see this here:
LiveCycle ES2 * Adobe LiveCycle Designer ES2
You have to put a own variable, which is set with the value you want in the very beginning.
I know, it is not that logical in the first moment, but it makes sense.
Regards
Florian
PS: This space SAP Interactive Forms by Adobe is the correct for questions like that -
HELP: jsp:useBean not "working"
I have written a JSP that utilizes some JavaBeans. With one, I do something similar to the following:
<jsp:useBean id="BeanA" class="mypackage.myFirstBean" />
That statement executes just fine, as the debug HTML statement that follows is printed using <c:out>.
Then I follow that with something nearly identical:
<jsp:useBean id="BeanB" class="mypackage.mySecondBean" />
The debug statement after this second <jsp:useBean> call is not executed.
The two beans have no-argument constructors and are in the same package, and both are found in the right hierarchy under WEB-INF/classes inside my WAR file. Also, both are named properly in the JSP. The only difference is that one "executes," and the other does not. I don't even get to call <c:set> on them to actually make them do some work!
Any insight is appreciated. Let me know if there is anything else I can provide.
Thanks for your help, and Happy New Year!The symptom you described is certainly curious.
Can you put the second "useBean" line before the first one? Then please tell us if it "executes". -
Question about the jsp:useBean tag
Hi, I'm a relative newcomer to jsp, but the following piece of javascript code has me very confused:
<%@ page import="com.jinsoft.bank.web.*" %>
<jsp:useBean id="account" class="AccountBean" />
This will result in java.lang.ClassNotFoundException, and it complains that AccountBean cannot be found.
However, when I fully qualify the class, it works:
<%@ page import="com.jinsoft.bank.web.*" %>
<jsp:useBean id="account" class="com.jinsoft.bank.web.AccountBean" />
Am I doing something wrong?
Isn't the import tag supposed to help?
Thanks for any help!Hi Kim
I'm really interested in the particular error that you are generating. I tried this out using Tomcat 3.2.3 and it doesn't seem to be a problem. What application Server are you using?
Another way to find out if the problem is with the Application Server is to check the .java file that is created out of the jsp page before it is compiled. Individual Application servers have different ways of storing this intermediate .java file but most of them keep it if the compilation does not succeed.
You may possibly have to file a bug if everything else checks out fine. Another point, are you able to import the same bean into a Servlet and use it there?
Keep us posted.
Good Luck!
Eshwar Rao
Developer Technical Support
Sun microsystems inc
http://www.sun.com/developers/support -
Work flow for Leave request without ESS
Dear All,
For one of our client, we have configure workflow for leave request, first is it possible to do tht?
If so how to do it?, here we dont have ESS/MSS. Is there any standard workflow available?
ThanxThere is standard workflow task which give by SAP to approve leave request i.e. 12300111.
But I am not sure this workflow task will work with out Portal or not.
Maybe you are looking for
-
Oracle -- Run_Report_Object
Hello: Is there a document on what are the valid combination of system parameter values that are valid in 10G? We like to give an option to run a report from a Form with an Destination type of "Email". Are there any ways this can be achieved from the
-
WLC 5508 reboots itself after upgrading to 7.5.102.0
Hello all. We have two WLC 5508 and we upgraded both to software release 7.5.102.0 two weeks ago. We also upgrade the FUS to version 1.7. Since then both WLC reboot randomly once or twice a day with no obvious reason. Is anyone else facing the same i
-
Hi I'm trying to get checkbox data out of flash 8 and in to php thate they will be stored in a DB and sent as an e-mail. I'm interested in the selected data and ony their label. I tried to solve it but now i'm stucked. I'm trying to use loadvars to g
-
We have Office 365 Home which, amongst other things, offers "Each user gets 1 TB of online storage, plus 60 Skype minutes of calling per month to mobile phones in 8 countries and landlines in 60+ countries" I am the primary account holder, so to spea
-
I am a new user of i-pad 2 and I find problem while trying to transfer some pdf file from my non apple laptop. Help me to inform How to do the same...