Importing beans to a jsp
i am trying to get my jsp to find two compiled beans you could let me know if im missing something obvious I would be very grateful. My Application is set out in jakarta-tomcat-3.3 as:
webapp/myJSPs/Hour16ex/WEB-INF/classes/com/myBeans
In Hour16ex I have file radomPayroll.jsp which is supposed to call my to bean classes
In myBeans are the bean classes Employee.class and RandomPeopleGenerator.class
These are the lines in radomPayroll.jsp that is supposed to import the two bean files
<jsp:useBean id="employee" class="com.myBeans.Employee" />
<jsp:useBean id="randomNames" class="com.myBeans.RandomPeopleGenerator" />
<%@ page import=" com.myBeans.*"%>
and yet it cant find them.
In autoexec.bat I have entered these lines
set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\common\lib\servlet.jar
set CATALINA_HOME=C:\jakarta-tomcat-3.3
set JAVA_HOME=C:\JDK1.3.1_01
I have also added jdk1.3.1_01 to the path in autoexec.bat
Is there any other configuring necessary in order for my radomPayroll.jsp to find the bean file. Someone mentioned that I need to enter some lines into the server.xml file. Is this true?
I am thinking that Hour16ex will be the root of my application and when searching for beans it will automatically look in WEB-INF/classes to find the packages without any extra configuration required.
Thankyou
Hi
A quick suggestion: Change your application Directory structure to the following:
You have: webapp/myJSPs/Hour16ex/WEB-INF/classes/com/myBeans
Change it to somthing like:
webapp/<APP-NAME>/WEB-INF/classes/com/myBeans
|
webapps
|------<YOUR-APP-NAME-DIR>
|
|
<JSP_FILES_SUBDIR>
|
|
WEB-INF------
|
|
classes/com/myBeans
This should get it to work.
Keep us posted on your progress.
Good Luck!
Eshwar Rao
Developer Technical Support
Sun microsystems
http://www.sun.com/developers/support
Similar Messages
-
Hi here's my bean
import java.util.*;
public class leaveChange extends Object implements java.io.Serializable
String Name;
String Grade;
String Pattern;
int numDays;
Date startDate;
Date endDate;
Now to use this bean in my JSP page what do I do ?
I tried
<%@ page import="leaveChange"%>
but got following error
[javac] C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\Devannualleave\newDev\advancedOptions_jsp.java:8: '.' expected
[javac] import leaveChange;
[javac] ^
[javac] 1 error
Thanks in advanceUpdate
changed Bean class to
package test;
import java.util.*;
public class leaveChange extends Object implements java.io.Serializable
String Name;
String Grade;
String Pattern;
int numDays;
Date startDate;
Date endDate;
JSP File
<%@ page import="test.leaveChange" %>
and have in my WEB-INF/classes/test
my Bean Class
but get the following error
[javac] C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\Devannualleave\newDev\advancedOptions_jsp.java:8: package test does not exist
[javac] import test.leaveChange;
[javac] ^
[javac] 1 error
Any help ? -
Cannot import Beans to index.jsp
Hallo!
I have created a simple Enterprise Application with 3 sessionbeans 3 entitybeans. The 3 entitybeans are in the Entities package and the 3 sessionbeans are in the businessSessionBeans package. If i try to import (lets say) the businessSessionBeans package into index.jsp I get the following error:
org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP
PWC6199: Generated servlet error:
string:///index_jsp.java:6: package businessSessionBeans does not exist
My include directive is:
<%@ page import="businessSessionBeans.*" %>
Can anyone tell me why I get this exception?
Thaks!I also had this problem. The thing is that project directory should be in classpath environment variable. The loader won't know where to look for the package otherwise.
-
Database access by Bean, error in JSP(view)
Hello,
I have a web application. All my database connection logic, execution of query is done in my bean. I have verified that the code in my bean is fine and so I have not posted that code.
My jsp code is as follows:
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<html>
<head><title>Trial JSP Page</title>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-STORE">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="PRIVATE">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</head>
<jsp:useBean id="data" class="com.bean.samples.ConnectionBean"/>
<jsp:setProperty name="data" property="drivername" value="oracle.jdbc.driver.OracleDriver"/>
<jsp:setProperty name="data" property="url" value="jdbc:oracle:thin:@someurl"/>
<jsp:setProperty name="data" property="username" value="name"/>
<jsp:setProperty name="data" property="password" value="passwd"/>
<jsp:setProperty name="data" property="query" value="SELECT * FROM tablename"/>
<%
data.processQuery();
ResultSet rs = data.getRs();
ResultSetMetaData rsmd = data.getRsmd();
%>
<body text="black">
The table has <jsp:getProperty name="data" property="count"/> columns and <jsp:getProperty name="data" property="rowcnt"/>
rows in it.
The first column name is <%= rsmd.getColumnLabel(1) %>.
The current row is <%= rs.getRow() %>.
</pre>
</body>
</html>
Output of browser:
The table has 2 columns and 6 rows in it. The first column name is ITEMNO. The current row is
Error: 500
Location: /schedule/jsp/Trial.jsp
Internal Servlet Error:
java.lang.IllegalStateException: Response has already been committed
java.lang.Throwable(java.lang.String)
java.lang.Exception(java.lang.String)
java.lang.RuntimeException(java.lang.String)
java.lang.IllegalStateException(java.lang.String)
void org.apache.tomcat.core.HttpServletResponseFacade.sendError(int, java.lang.String)
void org.apache.jasper.runtime.JspServlet.unknownException(javax.servlet.http.HttpServletResponse, java.lang.Throwable)
void org.apache.jasper.runtime.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
void org.apache.tomcat.core.ServletWrapper.handleRequest(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response)
void org.apache.tomcat.core.ContextManager.service(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response)
void org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(org.apache.tomcat.service.TcpConnection, java.lang.Object [])
void org.apache.tomcat.service.TcpConnectionThread.run()
void java.lang.Thread.run()
Error is being thorwn on the statemnt:
The current row is <%= rs.getRow() %>.
Can anyone help with this?
Thanks in advance.Hi beattris,
No I dont close the rs and conn objects.
The relevant method of my bean is :
public void processQuery() throws Exception{
try{
Class.forName(getDrivername());
conn = DriverManager.getConnection(getUrl(),getUsername(),getPassword());
st = conn.createStatement();
rs = st.executeQuery(getQuery());
rsmd = rs.getMetaData();
int columncount = rsmd.getColumnCount();
int rowcount = 0;
setCount(columncount);
while(rs.next()){
rowcount++;
setRowcnt(rowcount);
}catch(Exception e){
throw e;
I did some searching on the internet for this error and found that it is tricky one and so far I havent found a way to correct it.
The link i went to were:
http://developer.java.sun.com/developer/Books/ProJSP/Chap19.pdf
and
http://archives2.real-time.com/rte-tomcat/2000/Jun/msg02490.html
Well, I hope I get some answers soon.
Thanks. -
BEAN : Bean included in JSP Page
Hi ,
I had developed a web-application in that I had included a bean in a JSP code by using the following
<jsp:useBean id="testbean" scope="session" class="path.test" />
now the problem is some times when we click on that particular JSP page where this bean is included the screen instead of generating the jsp page it gives a complete path of the bean location as specified in the JSP ( i.e ) "path.test" .
When I click the refresh button then the page get's loaded properly.
This issue taken place rarely but it's very important to solve this and it happens in all the JSP pages wherever I had included a bean but only sometimes .
Why so??? and help me to solve this problem
Server: Apache � Tomcat 5.0
thanks in advanceYou are absolutely correct. All your java classes should be in packages.
I actually think its a java limitation introduced in Java 1.4 - they no longer allow access to the unnamed package.
For full details check out: http://developer.java.sun.com/developer/bugParade/bugs/4361575.html
My suggestion: include all your beans in packages. Its not that hard is it?
Cheers,
evnafets -
I have created a class file called BindListener.java and put it in my root directory in my web module. I cannot however get the import statement for the jsp right, my root directory is called JBuilder. I have tried putting it in the WEB-INF classes folder also but still when I try to execute thr jsp it dosent work.
There is no package declared in the classs file and it does not extend any other class, however it implements the HttpSessionBindingListener interface.
I can call servlets from my JSP in the WEB-INF classes dir using /JBuilder/ServletName
I am mondo confused please helpI have created a class file called BindListener.java
and put it in my root directory in my web module. I
cannot however get the import statement for the jsp
right, my root directory is called JBuilder. I have
tried putting it in the WEB-INF classes folder also
but still when I try to execute thr jsp it dosent
work.
There is no package declared in the classs file and
it does not extend any other class, however it
implements the HttpSessionBindingListener interface.You have to put the class in a package, then put the .class file in a package directory under WEB-INF/classes. So for example:
package beans;
public class BindListener ...
//goes into this directory structure
<APP_ROOT>/
*.jsp
WEB-INF/
web.xml
classes/
beans/
BindListener.class
//And is imported into your JSP using one of the following
// -- EITHER --
<%@ page import="beans.BindListener" %>
<%
BindListener bl = new BindListener();
%>
// -- OR --
<jsp:useBean id="bl" class="beans.BindingListener"/>>
I can call servlets from my JSP in the WEB-INF
classes dir using /JBuilder/ServletName
I am mondo confused please help -
Tomcat couldn't file my import Bean... HELP!!
How to set the class path to tell Tomcat where's my bean's package starting point.
Here is my bean....
package JavaBeans.MyBeanDir
class myFirstBean
Here is my JSP page
<%@page language="java" %>
<%@page import="JavaBeans.MyBeanDir.myFirstBean" %>
<jsp:useBean id="utilBean" scope="session" class="myFirstBean" />
Result... I got exception throw by Tomcat as error message show below:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\ExcelLinks\AASystem\Protected\Basic\JSP\JSPTest_jsp.java:7:
package ExcelLinks.JavaBeans does not exist import ExcelLinks.JavaBeans.ExcelLinksUtilBean;Hi,
I tried it and seems getting little better. But still had below error:
Did I do something wrong???? Please help. Thanks
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: ExcelLinksUtilBean
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:553)
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.StandardContext.invoke(StandardContext.java:2417)
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:193)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
at java.lang.Thread.run(Unknown Source)
root cause -
Sharing data between a bean and a jsp
I have a bean that is being used as a helper class for a jsp page. I can call functions in the bean and display what is returned but I can't test the state of the bean in the jsp page. Is this possible?
my code is below:
jsp: a form posts info to this page
<HTML>
<BODY>
<jsp:useBean id='portal' class='portal.portal'/>
<%-- set the username and password --%>
<jsp:setProperty name="portal" property="*" />
<jsp:getProperty name="portal" property="dbconnection"/>
<Center>
<H1>Welcome to the Portal
<jsp:getProperty name="portal" property="firstName"/>
</H1>
<br>
<table border="0">
<%-- while loop grabs all the services --%>
<%-- case tests for special services (links) --%>
<%
String url = "";
int ServiceID = 0;
//I CAN'T PULL THE VALUES FOR THESE VARIABLES SO THE WHOLE WHILE LOOP IS SKIPPED!
while (url.length() != 0)
switch (ServiceID)
case 69:
%>
<tr valign="top" height="45">
<td>
<center>
" TARGET="new_window"><IMG SRC="images\MEDS TAPE LOG.gif" BORDER=white></A><br>
</center>
</td>
</tr>
<%
break;
case 41:
%>
<tr valign="top" height="45">
<td>
<center>
<A HREF="<jsp:getProperty name="portal" property="url"/>" TARGET="new_window"><IMG SRC="images\Lan Support Website.gif" BORDER=white></A><br>
</center>
</td>
</tr>
<%
break;
case 1:
%>
<tr valign="top">
<td>
<center>
<form name="loginfrm" action="http://204.104.185.139/pls/WLOG/login.ValidateUser" method="post" target=_parent>
<INPUT TYPE=hidden NAME=TXTUSERNAME VALUE="<jsp:getProperty name="portal" property="name"/>">
<INPUT TYPE=hidden NAME="TXTPASSWORD" VALUE="<jsp:getProperty name="portal" property="password"/>">
<input TYPE="submit" VALUE="<jsp:getProperty name="portal" property="serviceName"/>" style="width: 120px;" >
<input type="reset" name="reset" value="">
</Form>
</center>
</td>
</tr>
<%
break;
default:
%>
<tr valign="top">
<td>
<center>
<Form method='post' action='<jsp:getProperty name="portal" property="url"/>' name='loginfrm'>
<INPUT TYPE=hidden NAME="TXTPASSWORD" VALUE="<jsp:getProperty name="portal" property="password"/>">
<INPUT TYPE=hidden NAME="TXTUSERNAME" VALUE="<jsp:getProperty name="portal" property="name"/>">
<INPUT TYPE=hidden NAME="firstname" VALUE="<jsp:getProperty name="portal" property="firstName"/>">
<INPUT TYPE=hidden NAME="lastname" VALUE="<jsp:getProperty name="portal" property="lastName"/>">
<INPUT TYPE=hidden NAME="id" VALUE="<jsp:getProperty name="portal" property="userID"/>">
<INPUT TYPE=hidden NAME="role" VALUE="<jsp:getProperty name="portal" property="roleID"/>">
<input type='submit' name='submit' value='<jsp:getProperty name="portal" property="serviceName"/>'>
</Form>
</center>
</td>
</tr>
<%
break;
%>
<jsp:getProperty name="portal" property="nextForm"/>
<%
%>
</table>
</Center>
</Body>
</Html>
here is the bean:
//bean for portal
package portal;
import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.*;
import java.util.Enumeration;
import java.sql.*;
import java.util.*;
public class portal {
private ResultSet userInfo;
private Statement stmt;
private String pw;//password from the database
private String FirstName;
private String LastName;
private String UserName=""; //network login name
private String UserPassword="";//password supplied by the form
private int UserID; // temp variable while pulling the services from the databases
private int RoleID; // temp variable while pulling the services from the databases
private String ServiceName=""; //temp variable while pulling the services from the database
private int ServiceID;
private String url ="";
//String Message=""; //testing
private String Message2=""; //string that sends the correct html back to the jsp
public int getServiceID(){
return ServiceID;
public void setName(String Name){
UserName = Name;
public String getName(){
return UserName;
public void setPassword(String Password){
UserPassword = Password;
public String getPassword(){
return UserPassword;
public String getFirstName(){
return FirstName;
public String getLastName(){
return LastName;
public String getUrl(){
return url;
public int getUserID(){
return UserID;
public int getRoleID(){
return RoleID;
public String getServiceName(){
return ServiceName;
public String getDbconnection() {
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
DriverManager.setLoginTimeout(60);//time out after 1 min.
Connection con = DriverManager.getConnection("jdbc:odbc:Portal");
stmt = con.createStatement();
String query = "SELECT EMP_TABLE.EMP_PASS, MGR_SERVICES.SERVICE_ID,";
query = query +" MGR_SERVICES.DEFAULT_URL, EMP_TABLE.EMP_USER_ID, *";
query = query +"FROM (EMP_TABLE LEFT JOIN MGR_USER_SERVICES ON";
query = query +" EMP_TABLE.EMP_USER_ID = MGR_USER_SERVICES.USER_ID)";
query = query +" LEFT JOIN MGR_SERVICES ON MGR_USER_SERVICES.SERVICE_ID =";
query = query +" MGR_SERVICES.SERVICE_ID WHERE (((EMP_TABLE.EMP_LAN_ID)='" + UserName+ "'))";
//String query = "SELECT EMP_TABLE.EMP_PASS, MGR_SERVICES.SERVICE_ID,";
//query = query +" MGR_SERVICES.DEFAULT_URL, EMP_TABLE.EMP_USER_ID, *";
//query = query +"FROM (EMP_TABLE LEFT JOIN MGR_USER_SERVICES ON";
//query = query +" EMP_TABLE.EMP_USER_ID = MGR_USER_SERVICES.USER_ID)";
//query = query +" LEFT JOIN MGR_SERVICES ON MGR_USER_SERVICES.SERVICE_ID =";
//query = query +" MGR_SERVICES.SERVICE_ID WHERE (((EMP_TABLE.EMP_LAN_ID)='landwla'))";
//String query = "SELECT * FROM EMP_TABLE WHERE EMP_LAN_ID ='landwla'";
userInfo = stmt.executeQuery(query);
if(userInfo.next())
pw = userInfo.getString("EMP_PASS");
if (UserPassword.equals(pw))
//Message = "Your logged in";
//Message = Message + "Luke you sly devil";
FirstName = userInfo.getString("EMP_FIRST");
LastName = userInfo.getString("EMP_LAST");
UserID = userInfo.getInt("EMP_USER_ID");
RoleID = userInfo.getInt("ROLE_ID");
url=userInfo.getString("DEFAULT_URL");
ServiceName = userInfo.getString("SERVICE_NAME");
ServiceID = userInfo.getInt("Service_ID");
else
Message2 = "<Script Language=JavaScript>";
Message2 = Message2 + "alert('Your Password Information is incorrect');";
Message2 = Message2 + "window.location.href = 'Login.html'";
Message2 = Message2 + "</Script>";
else
Message2 = "<Script Language=JavaScript>";
Message2 = Message2 + "alert('Your Login Information is incorrect');";
Message2 = Message2 + "window.location.href = 'Login.html'";
Message2 = Message2 + "</Script>";
catch (InstantiationException i)
{return (i.toString());}
catch (ClassNotFoundException c)
{return (c.toString());}
catch (SQLException sql)
{return (sql.toString());}
catch (Exception e)
{return (e.toString());}
return Message2;
public String getNextForm() {
try
url="";
ServiceName="";
if(userInfo.next())
url=userInfo.getString("DEFAULT_URL");
ServiceName = userInfo.getString("SERVICE_NAME");
RoleID = userInfo.getInt("ROLE_ID");
ServiceID = userInfo.getInt("Service_ID");
catch (SQLException sql)
{return (sql.toString());}
return Message2;Of course you can.
<%
String url = protal.getUrl();
%> -
Sharing a bean information through jsp pages
Morning,
I want to use a java bean in two jsp pages, so is it possible to share it (to set its properties in the 1st page and retrieve them in the 2nd)?
If not, what should I do? Could I use forward and set param?
Here is my 1st jsp
==================
<%@page language="java" %>
<jsp:useBean id="doctorConn" scope="session" class="beans.DoctorBean" >
<jsp:setProperty name="doctorConn" property="*" />
</jsp:useBean>
<%
if(doctorConn.getUserId().equals("") ||doctorConn.getPassword().equals(""))
response.sendRedirect("notAuthorised.jsp");
System.out.println("user id : " + doctorConn.getUserId()+ " password : " +doctorConn.getPassword());
if(doctorConn.isAuthorised(doctorConn.getUserId(), doctorConn.getPassword())) {
%>
<jsp:forward page="doctorApp.jsp" />
<%
else response.sendRedirect("notAuthorised.jsp");
%>
==================
my second
=================
<%@page language="java" %>
<%@page import ="java.sql.*" %>
<%@page import ="java.lang.Exception"%>
<jsp:useBean id="doctorConn" scope="session" class="beans.DoctorBean" />
<jsp:useBean id="appointment" scope="session" class="beans.Appointment" >
<jsp:setProperty name="appointment" property="*" />
</jsp:useBean>
...etc
===========================
I am using Tomcat 4 and in the 2nd page I am getting an error about doctorConn
Thank you,Yes ofcorse. You can do it in many ways.
Firstly, declare properties of your bean as static that you want to share between pages and create new instance of bean on each page.
Secondly you can store the same instance of the bean in you session. On th other page, you can retrive same instance of the bean whenever needed.
Otherwise, you can create a gateway class that maitain static reference of you bean class. -
How do you write an import statement in a JSP? I did this but it isn't working...
<%!
import="java.util.Calendar"
%>
Thanks.
P.S. - I got a dog on Saturday!<%@page import="java.util.calendar" %>
Oops... forgot the "page" in there ...That's what I get for using GUI's too much!!! :) -
Two managed beans in same jsp page
Hello
First this could be a stupid question, but i just can't find a solutions on this problem.
I wondering that could it be a two managed beans in same jsp page, here is a example:
index.jsp
<t:commandLink disabled="#{listBean.currentPage == 1}" id="previous2" type="button" immediate="true" style="font-size:small" action="#{listBean.previousPage}">
<h:outputText value="Edellinen" id="prev"/>
</t:commandLink>
<t:commandLink disabled="#{listBean.currentPage == listBean.totalPages}" id="next2" type="button" immediate="true" style="font-size:small;" action="#{listBean.nextPage}">
<h:outputText value="Seuraava" id="next"/>
</t:commandLink>
then i have a dataTable like this:
<t:dataTable value="#{customerListBean.customerBeans}"
binding="#{customerListBean.dataTable}" preserveDataModel="true" style="text-align:left">
My problem is that when i push a commandLink it doesn't refresh a dataTable. Does anyone know a solution here or is this just a impossible way to do it?
Thanks for help.when i push nextPage (commandLink) it's call action
and count a new range of dataset and after that it's
calls a method which is declared on subClass and that
method get a new data of database on given params.
and put it on DataTable.
So listBean is upper class and customerListBean
extends on ListBeanNo, it doesn't work that way as you expected. You have created two independent instances. They doesn't communicate automatically with each other or so. Just use one CustomerListBean instance and call the inherited methods of ListBean on the #{customerListBean} managed bean instance. -
How to call the form bean value on jsp withthe help of jstl tag
hi
all friends
i am working in struts & i use jstl tag in jsp. i have one problem rise is how to call the form bean value in jsp page by using jstl tag.
i now how to retrive the value through jsp:logic
eg. <logic:empty name="userListForm" property="users">
NO USER FOUND
</logic:empty>
see * userListForm mean formbaen name.
* users means collection object.
so how can i write above e.g in jstlYou use the jstl core:if or core:choose combined with the EL:
<c:if test="${empty users.userListForm}">
NO USERS FOUND
</c:if>I suggest you lookup the jsp expression language (EL) using google, it's very powerful. -
Hi all
I have a bean that I want to use in two JSP's. When I use it the first time it works fine but for the second JSP it returns a NullPointerException. I have my scope as "application".
In my JSP I am calling the bean as such:
<jsp:useBean id="abc" scope="application" class="ABC" />
<%
ABC bean = (ABC)session.getAttribute("abc");
%>
Please assist me with this.
ThanxI thought <jsp:useBean id="abc" scope="session" class="ABC" />and<%
ABC abc = (ABC)session.getAttribute("abc");
%>do the same thing...!!!!! Am I wrong..?
Getting back to the problem. One reason, I can think about, causing a NullPointerException may be because the session attribute is not set previously. Do you have piece of code somewhere in the servlet or before which sets the attribute in the session.?
Some thing like session.setAttribute("abc", new ABC()); -
Can i import java fx in jsp or html?
can i import java fx in jsp or html?
coolsayan.2009 wrote:
just to test i did rigt-click on my web-based jsp project project->new item->other->javaFX stage and wrote the example code like:
but got all red under lined word in all the lines what to do???Ouch! Not being familiar with NetBean, I am not sure, but I fear you mix stuff.
"web-based jsp project" => so you write JSP or HTML stuff there, no? Like including the dtfx.js file and putting the javafx({ ... }) call in the proper places.
"wrote the example code like (JavaFX code)" => Maybe it should be in a separate JavaFX project? Then generate the .jar file and use it in the above project.
Now maybe I am misleading (if there is a a JavaFX stage in new items of the projects, perhaps NB allows it?) so I hope somebody knowing NB better than me will help you.
Just in case: JavaFX code goes to .fx files; you cannot embed JFX code in JSP pages. -
Defining the path for the use of beans in a JSP
Hello,
I would like to use a bean in a JSP file, via the <jsp:usebean> directive.
I didn't find any property (weblogic property) which could define the path
to the directory of my beans classes.
So :
1) i have put the path of this directory in the weblogic classpath in the weblogic
start script.
2) i made the same with the java classpath.
Both solutions don't work at all.
Any suggestion would be appreciated.
Thanks in advance.
We use the \weblogic\myserver\serverclasses for beans..
of course we pack beans into jar files, and these jar files are included into
the wls classpath..
"Sylvain R." <[email protected]> wrote:
>
>Hello,
>I would like to use a bean in a JSP file, via the <jsp:usebean> directive.
>I didn't find any property (weblogic property) which could define the
>path
> to the directory of my beans classes.
>So :
>1) i have put the path of this directory in the weblogic classpath in
>the weblogic
>start script.
>2) i made the same with the java classpath.
>
>Both solutions don't work at all.
>
>Any suggestion would be appreciated.
>Thanks in advance.
>
Maybe you are looking for
-
Problem in viewer in macmini connected with svga
I have a macmini connected to a SVGA monitor and have the following problem in Final Cut Pro : When passing any clip, master templates , etc to the timeline and rendering , when played in the viewer sees the picture skips or freezes. In the Canvas lo
-
Policy Agent 2.2 for Apache HTTP Server
hi, I'm trying to configure Policy Agent 2.2 for apache http server. The agent seems to be installed properly, in fact when I access the protected resource, I get the Access Manager login page. Then I log into access manager, but I'm redirected to an
-
How to resume the flow back to the main process after Subprocees Completes
I have a Work Flow process such that Main Process calls Sub process(S1), S1 calls Subprocess S2 , S2 calls Subprocees S3 and so on.. Via Status monitor I could see that the instance had successfully completed the subprocess S1 , but then the flow is
-
Customised view objects in OAF
Is there any way to find all customised view objects in OAF?
-
How to open the period which has already closed in MM
How to open the period which has already closed in MM.