Using RDBMS Realm with JSP, again
I submitted this post using the web interface after I "asked Bea" and now it
seems like I'm a total newbie :) So I repost to make it more readable..
Hi,
I am fairly new to J2EE and I am trying to figure out how I can apply the
RDMSRealm to restrict access to jsp files
Do I use ACL's in the database to restrict access to jsp's or,
Do I use the web.xml deployment descriptor in the a similar fashion as the
Gold_customer in the petstore,
What is the difference?
Does anyone know about a nice example?
Sincerely,
ilya
We have used the <security-constraint> tags in web.xml. This tag specifies which
'security roles' has access to specific resource collection (e.g. one or more
servlets or JSPs). The 'security roles' are then mapped in weblogic.xml to one
ore more groups and/or users as defined in the group and user tables in the RDBMS.
regards,
Simen R.
"ilya" <[email protected]> wrote:
I submitted this post using the web interface after I "asked Bea" and
now it
seems like I'm a total newbie :) So I repost to make it more readable..
Hi,
I am fairly new to J2EE and I am trying to figure out how I can apply
the
RDMSRealm to restrict access to jsp files
Do I use ACL's in the database to restrict access to jsp's or,
Do I use the web.xml deployment descriptor in the a similar fashion as
the
Gold_customer in the petstore,
What is the difference?
Does anyone know about a nice example?
Sincerely,
ilya
Similar Messages
-
hello friends,
i'm new to jsp. i want to create an html form that accepts username and a value from four radio buttons and display back the entered name and checked radio button's value using java bean.
i use the <jsp:setProperty id="" property="*"> method. i don't know how to access the radio buttons value from the html.
also when i use an additional field other than username the jsp page is showing error.
Please give me the correct method to use java bean with jsp in this circumstance.
thank you.thank you, but i have a problem left. the case is like this.
i got the jsp and bean worked fine when i have a sinle input text field.
but when i added a second text field i recieved the following error.
javax.servlet.ServletException: basket.newbean.getUserPass()Ljava/lang/String;
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.newform.process_jsp._jspService(process_jsp.java:69)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
where userPass is the new form element. I have made the subsequent chanes in my bean program and jsp file.
pls hlp. -
Scope when using a JavaBean with JSP
what is the meaning of this question .....?
"Which of the following can not be used as the scope when using a JavaBean with JSP? "
question 4
site :http://java.sun.com/developer/Quizzes/jsptut/The question is clearly written. I don't see how you can be confused. But let's assume you are since you would not have posed the question.
Dumbed-down:
There are 4 scopes or areas of variable visibility in JavaServer Pages. Which of those can areas can not be used with JavaBeans?
Does that help? -
Can you use threads in a web application that uses JSP's plus Servlets and Beans ?
We have a JRUN 3.1 application using JSPs, Servlets and Beans. Shortly after we went live it became apparent that any 2 users using the same object experienced problems as one object was overwriting another. In a panic the problem was solved by whacking SYNCHRONISED on all objects.
Now we want to write another application, are there strategies for using Threads with JSPs?
Would this be part of the webserver configuration or would the application be coded in a certain way ?
Please can you give me a simplistic answer or point me to some documentation that gives a simple overview.
Thanks SteveHi,
You can use thread with jsp, i am sending u a example
package thread;
import java.io.Serializable;
public class TaskBean implements Runnable, Serializable {
private int counter;
private int sum;
private boolean started;
private boolean running;
private int sleep;
public TaskBean() {
counter = 0;
sum = 0;
started = false;
running = false;
sleep = 100;
protected void work() {
try {
Thread.sleep(sleep);
counter++;
sum += counter;
} catch (InterruptedException e) {
setRunning(false);
public synchronized int getPercent() {
return counter;
public synchronized boolean isStarted() {
return started;
public synchronized boolean isCompleted() {
return counter == 100;
public synchronized boolean isRunning() {
return running;
public synchronized void setRunning(boolean running) {
this.running = running;
if (running)
started = true;
public synchronized Object getResult() {
if (isCompleted())
return new Integer(sum);
else
return null;
public void run() {
try {
setRunning(true);
while (isRunning() && !isCompleted())
work();
} finally {
setRunning(false);
And JSP page start.jsp
<% session.removeAttribute("task"); %>
<jsp:useBean id="task" scope="session"
class="thread.TaskBean"/>
<% task.setRunning(true); %>
<% new Thread(task).start(); %>
<jsp:forward page="status.jsp"/>
///////////////// status .jsp
<jsp:useBean id="task" scope="session"
class="thread.TaskBean"/>
<HTML>
<HEAD>
<TITLE>JSP Progress Bar</TITLE>
<% if (task.isRunning()) { %>
<SCRIPT LANGUAGE="JavaScript">
setTimeout("location='status.jsp'", 1000);
</SCRIPT>
<% } %>
</HEAD>
<BODY>
<H1 ALIGN="CENTER">JSP Progress Bar</H1>
<H2 ALIGN="CENTER">
Result: <%= task.getResult() %><BR>
<% int percent = task.getPercent(); %>
<%= percent %>%
</H2>
<TABLE WIDTH="60%" ALIGN="CENTER"
BORDER=1 CELLPADDING=0 CELLSPACING=2>
<TR>
<% for (int i = 10; i <= percent; i += 10) { %>
<TD WIDTH="10%" BGCOLOR="#000080"> </TD>
<% } %>
<% for (int i = 100; i > percent; i -= 10) { %>
<TD WIDTH="10%"> </TD>
<% } %>
</TR>
</TABLE>
<TABLE WIDTH="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<TD ALIGN="CENTER">
<% if (task.isRunning()) { %>
Running
<% } else { %>
<% if (task.isCompleted()) { %>
Completed
<% } else if (!task.isStarted()) { %>
Not Started
<% } else { %>
Stopped
<% } %>
<% } %>
</TD>
</TR>
<TR>
<TD ALIGN="CENTER">
<BR>
<% if (task.isRunning()) { %>
<FORM METHOD="GET" ACTION="stop.jsp">
<INPUT TYPE="SUBMIT" VALUE="Stop">
</FORM>
<% } else { %>
<FORM METHOD="GET" ACTION="start.jsp">
<INPUT TYPE="SUBMIT" VALUE="Start">
</FORM>
<% } %>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
////////////////////////////// stop.jsp
<jsp:useBean id="task" scope="session"
class="thread.TaskBean"/>
<% task.setRunning(false); %>
<jsp:forward page="status.jsp"/>
deploy it into ur server and run start.jsp
and see whatb happens -
How to generate html-code using csv input with JSP or JAVA???
Hello,
I want to read out a .csv-file and generate html-code dynmically with JSP in an EP6 Application. The problem is, that the csv-file cant be located or openend.
BTW if every knows a good tutorial or weblog for this, please post the link.
Its located in a par-archive under:
/>dist>files
I tried various methods, in the doContent mehtod or with JSP. Everytime same result.
Here part of the code I tried in the doContent():
public class CSV extends AbstractPortalComponent
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
String strWRoot = request.getWebResourcePath();
String contentCSV="", line="";
String linesep = System.getProperty("line.separator");
File fileLoadCSV = new File(strWRoot+"/files/ma_infosysteme.csv");
boolean exCSV = fileLoadCSV.exists();
boolean reCSV = fileLoadCSV.canRead();
int a=0;
if(exCSV&&reCSV){
response.write("ok");
try {
BufferedReader inputCSV = new BufferedReader(new FileReader(fileLoadCSV));
while((line=inputCSV.readLine())!=null){
contentCSV=contentCSVlinelinesep;
a++;
inputCSV.close();
catch(IOException ioex){
System.out.println("Fehler");
else {
response.write("not ok");
response.write("<br>Wroot: "+strWRoot);
response.write("<br>File: "+fileLoadCSV);
response.write("<br>exists: "+exCSV);
response.write("<br>read: "+reCSV);
response.write("<br>Input: "+contentCSV);
The Output is:
not ok
Wroot: /irj/portalapps/DHTML
File: \irj\portalapps\DHTML\files\ma_infosysteme.csv
exists: false
read: false
Input:
So thanks to everyone who can give me a good hint.
Bye.Without really looking too much into this it looks like the problem is with the way in which you are trying to open the file. I believe that when creating a File object you need to use a physical path. By using the getWebResourcePath() method you are retrieving the URL to this file and not the physical path name. There is another method (can't remember the exact name) called getPublicResourcePath() (or something similar) which will return the physical path to this file, i.e. c:\usr\sap\.....etc. If you try it this way it may well work
I hope this helps
D -
Hi,
Now maybe eveyone knows that the RDBMS Realm provided by weblogic 6.0 isn't production
ready, and miss some functions, for examples, change password, or add group no.
It is suprised for me that weblogic didn't support these basic functions of RDBMSRealm
and didn't provide suitable documentation for implementing this RDBMS Realm.
So I ask for help that if everyone know how to implement one function: changeCredential.
I know the weblogic.management.configuration.Uer object has this method (User.changeCredential(oldPass,
newPass)). I know I have to provide one additional database schema for updating
user password. I know I should add a method in the RDBMSDelegate and RDBMSRealm
classes. But I don't the suitable method signature, and couldn't find internal
method call when the user click the "change" button changing password in the Console.
Thank you very much for any idea or help. Also I'd like to deeply discuss other
security issues.
Is any project use the RDBMS realm?
By the way, if anyone try to directly update the database tables as a means to
implement this issues. I have tried this approach, and it seems work fine except
for some catching delay. Can anyone tell me if this is an effective method?
ThxThis RDBMS Realm issue is really bother me too. I was wondering if anyone use the
RDBMS Realm for production. it is difficult to find what the architecture the
RealmMBean object and RealmManager is. Any idea let me know. Good luck.
"andy Zhong" <[email protected]> wrote:
>
Hi,
Now maybe eveyone knows that the RDBMS Realm provided by weblogic 6.0
isn't production
ready, and miss some functions, for examples, change password, or add
group no.
It is suprised for me that weblogic didn't support these basic functions
of RDBMSRealm
and didn't provide suitable documentation for implementing this RDBMS
Realm.
So I ask for help that if everyone know how to implement one function:
changeCredential.
I know the weblogic.management.configuration.Uer object has this method
(User.changeCredential(oldPass,
newPass)). I know I have to provide one additional database schema for
updating
user password. I know I should add a method in the RDBMSDelegate and
RDBMSRealm
classes. But I don't the suitable method signature, and couldn't find
internal
method call when the user click the "change" button changing password
in the Console.
Thank you very much for any idea or help. Also I'd like to deeply discuss
other
security issues.
Is any project use the RDBMS realm?
By the way, if anyone try to directly update the database tables as a
means to
implement this issues. I have tried this approach, and it seems work
fine except
for some catching delay. Can anyone tell me if this is an effective method?
Thx -
Ok, so im pretty new to this JSP lark and have a question.
I have Java Classes resting in .java files, i need to know how
do i link these files to my .jsp page so that the classes/variable etc.
declared with the java files are recognised when they are come
across in the .jsp file.
I dont know if I have explained that properly.Just include this statement at the top of your jsp:
<%@page import="yourpackage.yourclass"%>
The .java files should of course be compiled into .class files prior to using (and you don't include the extension when importing). -
Problem using JDBC driver with JSP
Hi, I am trying to connecto to my mysql server via a JSP page, but it seems that there is a problem with the driver call or something in my configuration that unables me to connect. I have the mysql-connector-java-3.0.7-stable driver.
This is how my classpath looks like:
CLASSPATH=/home/hooper/Sources/mysql-connector-java-4.0.7-stable/lib:/home/hooper/Sources/mysql-connector-java-3.0.7-stable/com:/home/hooper/Sources/mysql-connector-java-3.0.7-stable/mysql-connector-java-3.0.7-stable-bin.jar:/usr/java/j2sdk1.4.1_02:.:/usr/java/j2sdk1.4.1_02/lib/tools.jar:/usr/java/j2sdk1.4.1_02
And this is my JSP page code:
<%@ page language="java" import= "java.sql.*"%>
<%
Connection con = null;
String userName = "hooper";
String password = ""; //No password
String url = "jdbc:mysql://localhost/test";
//Load the Driver class file
Class.forName("com.mysql.jdbc.Driver");
//Make a connection to the MySQL database
con = DriverManager.getConnection (url, userName, password);
out.println ("Database connection established");
if (con != null){
//Close the connection
con.close();
%>
And this is the error I get from Tomcat4.1.18:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: com.mysql.jdbc.Driver
root cause
javax.servlet.ServletException: com.mysql.jdbc.Driver
I hope someone can help me with this.
Thanks,
LuisHi..
Try using this way
String userName = "hooper";
String password = ""; //No password
String url = "jdbc:mysql://localhost:3306/test";
Class.forName("org.gjt.mm.mysql.Driver");
try to download the driver for mysql and add it to your classpath
Hope this works
Regd
Vasi -
WLS5.1 SP8: Using RDBMS Realm
Hi All,
I've hacked the rdbmsrealm example from the standard WLS5.1 install to use
the schema in my Oracle 8.1.6 database instread of the cloudscape db, and
everything is fine. However...
I'm a little in the dark about how much interaction my EJBs should have with
the realm? I initially had a bean which controlled user creation by
populating the same database table that is now mapped to by my
realm.properties. Should I now delegate the user creation to the realm
classes instead of my bean?
I've looked through what I think is all the documentation, but still cannot
really find the "how is it used" information I require.
byeeeeeeeeeeeeeeee
Thanks in advance.The 'nice' way to do what you want is to have your realm implement
the ManageableRealm interface and call those methods instead of
changing the database directly from the Bean.
Also make sure your realm has a way to refresh it's cache (if you
use one) when Users/Groups/ACLs are added/changed in your underlying
data store.
-Don
"Andy Marks" <[email protected]> wrote:
Hi All,
I've hacked the rdbmsrealm example from the standard WLS5.1
install to use
the schema in my Oracle 8.1.6 database instread of the
cloudscape db, and
everything is fine. However...
I'm a little in the dark about how much interaction my
EJBs should have with
the realm? I initially had a bean which controlled user
creation by
populating the same database table that is now mapped
to by my
realm.properties. Should I now delegate the user creation
to the realm
classes instead of my bean?
I've looked through what I think is all the documentation,
but still cannot
really find the "how is it used" information I require.
byeeeeeeeeeeeeeeee
Thanks in advance. -
Problem in using java bean with jsp
Hi,
This is my code and i get this error. Not able to trace the mistake.
bean.html
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Fname</title>
</head>
<body>
<form method="POST" action="http://localhost:8080/beanjsp.jsp">
<p>Fname: <input type="text" name="T1" size="20"></p>
<p>Lname: <input type="text" name="T2" size="20"></p>
<p> </p>
<p> </p>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
</body>
</html>
beanjsp.jsp
<jsp:useBean id="bean" class="beans.FirstBean" scope="application" />
<jsp:setProperty name="bean" property="fname" param="T1" />
<jsp:setProperty name="bean" property="lname" param="T2" />
THE FIRST NAME IS <%=bean.getFname() %>
THE LAST NAME IS <%=bean.getLname() %>
FirstBean.java
//CREATING A BEAN
package beans;
import java.io.*;
public class FirstBean
private String fname;
private String lname;
FirstBean()
fname="";
lname="";
public void setFname(String fn)
fname=fn;
public void setLname(String ln)
lname=ln;
public String getFname()
return fname;
public String getLname()
return lname;
error report
org.apache.jasper.JasperException: /beanjsp.jsp(2,0) The value for the useBean class attribute beans.FirstBean is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1223)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Generator.generate(Generator.java:3270)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:189)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)I have placed the beans package folder containing FirstBean.class inside classes folder of ROOT directory.
I don't know what s wrong with my code :( ... Plz help asap.
Thanks,
AkshathaI have placed the beans package folder containing FirstBean.class >inside classes folder of ROOT directory.Place it in the WEB-INF/classes folder
ram. -
How to use RDBMS Realm in Weblogic Commerce Server?
Hi All,
Same as the subject.
Thx
RayYou should read the security information in the Servlet 2.2 specification
that WL 5.1 implements:
http://java.sun.com/products/servlet/download.html
Chapter 11 deals with declarative and programmatic security, and includes a
section on roles:
11.4 Roles
A role is an abstract logical grouping of users that is defined by the
Application Developer or
Assembler. When the application is deployed, these roles are mapped by a
Deployer to security
identities, such as principals or groups, in the runtime environment.
A servlet container enforces declarative or programmatic security for the
principal associated with
an incoming request based on the security attributes of that calling
principal. For example,
1. When a deployer has mapped a security role to a user group in the
operational environment. The
user group to which the calling principal belongs is retrieved from its
security attributes. If the
principal's user group matches the user group in the operational environment
that the security
role has been mapped to, the principal is in the security role.
2. When a deployer has mapped a security role to a principal name in a
security policy domain, the
principal name of the calling principal is retrieved from its security
attributes. If the principal is
the same as the principal to which the security role was mapped, the calling
principal is in the
security role.
Cameron Purdy
http://www.tangosol.com
"Hari" <[email protected]> wrote in message
news:[email protected]..
Hello Gurus,
I am new to Weblogic server and I am trying to investigate how to make
use of security roles in weblogic server (5.1.0). Can anyone point me
to some documentation. Specifically, I am looking for instance level,
and method level security and how to use it.
Thanks for taking your time to read this e-mail.
Thank You all in advance,
Hari. -
Using owa_cookie.send with JSPs
Hello all... I have a procedure that I use owa_cookie.send to send a cookie in the HTTP header. How do I get it from a JSP now? If I include this cookie in my xxx.home procedure, do I need to do anything special to be able to get it when I navigate to my JSP?
Thank you all in advance.
Jonathan Coreil-- GET_ALL returns an array of name/value pairs of all HTTP_COOKIES
-- sent from the browser. The name/value pairs appear in the order
-- that they were sent from the browser.
PROCEDURE owa_cookie.get_all
(names OUT vc_arr,
vals OUT vc_arr,
num_vals OUT INTEGER);
the number of vals is > 0 if the cookie is stored at the clients side. I implement it just.
I quest the number of cookies
if l_NumVals = 0 then
Send cookie;
redirect_URL('...');
else
get_Cookie_Content;
end if;
It may not help you. Please specify your problem if possible.
Regards Torsten -
How Use Multi Pages with JSP pages
I have a lot of records, so i want to display from 10 to 10 and use a numeric menu in the botton of the page. the problem is how a make that with java code and html or java script.
thanks for your help
LeonMex. from M�xico CitySearch for pager taglibs. Ur solution lies there.
Moreover u can refer www.jsptags.com , I am using the pager taglib from jsptags and it's quite easy to use.
Hope that Helps.
thanks and regards. -
What RAD tool should i use with JSP??
I would like to know what RAD (opensource) to use to work with JSP and MySQL.
If anyone could help
thank youIf you are using the Sun Java System Enterprise Studio, the Web Application Framework will provide you with all the tools you need to create a JSP/Servlet based web application that scales in performance like no other framework. Coupled with a WYSIWYG HTML editor like Dreamweaver and your RAD app dev is covered.
For MySQL, there are some really nice GuI clients out there. This is a link to the one I have used:
http://www.mysql.com/products/
If you are using the Sun Java Studio, don't forget to add the MySQL jdbc driver so that you can access your DB at development time and use the Sql Model wizards from within the Web Application Framework tools.
If your app is not concerned with serious scalability, and you are looking to build your app using the latest standards (JSF - Java Server Faces), you can download the Sun Java Studio Creator. It's more of a VB.NET/ASP like development environment with a WYSIWYG HTML form painter. Very slick. You can download here:
http://developers.sun.com/prodtech/javatools/jscreator/index.jsp
Here's a primer for Creator:
http://developers.sun.com/prodtech/javatools/jscreator/reference/techart/primer.html
The Creator forum is here:
http://swforum.sun.com/jive/forum.jspa?forumID=123
To recap, use Web Application Framework if you require the utmost in a mature, stable, and scalable web application. WAF apps can be deployed to any J2EE server.
If you require a webapp based on the latest standard JSF implementation, and dev productivity is more important than enterprise strength scalability, then Creator is a great choice.
cheers
craig -
Is RDBMS Realm industrial-strength?
I can see that several people are using RDBMS Realm, which started out as an
example. Is the version shipped with WLS 6.0 reliable and robust? Is it
suitable for a commercial application?The RDBMS Realm shipped with WLS is a sample.
It is not industrial strength. For example,
the schema is string based and pretty slow.
Also, it doesn't support adding new groups or
acls via the console.
-Tom
"Al Fontes" <[email protected]> wrote:
I can see that several people are using RDBMS Realm, which started out
as an
example. Is the version shipped with WLS 6.0 reliable and robust? Is
it
suitable for a commercial application?
Maybe you are looking for
-
Synaptics multi-touch driver not working
Hello, I've got a problem with my multi-touch pad. I have, without meaning to, deleted my synaptics pointing device driver and, obviously, it stopped working. I have already followed severeal times instructions by other forums but it would
-
First of all, my knowledge of PC's etc is very limited, so when answering, can you make it as easy to understand as possible ?I?have a Zen Touch and have just bought a new lap top that runs Vista and has Windows Media player installed I have never up
-
HT204032 is this firmware update compatible with Lion?
I have set my MacBook Air to dual boot Lion and Mountain Lion, is this firmware update (MacBook Air SMC firmware update 1.6) compatible with Lion? So if I boot the MacBook into Mountain Lion, accept the firmware update, and then boot into Lion will
-
Local query properties throwing UNCAUGHT EXCEPTION
Hi Gurus After execution of a query, when I tried to change the query properties,like Zero suppression, currency conversion etc.. its getting an error message as given below and getting disconnected "Program Error in Class SAPMSSY1 method: UNCAUGHT E
-
Environment variables not set by the install process
Hello, Installed 11.5.10 on Redhat LIniux AS3.0 None of the env variables (like APPL_TOP, OA_HTML, AR_TOP etc.,) are set by the install process do I need to run a separate script to set these varibales? Thanks