Win a copy of Java by Comparison (eBook) this week in the Java in General forum!

Goutham Pallipati

Greenhorn
+ Follow
since Aug 13, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Goutham Pallipati

You can not mix up things.

Either you use Form Based Authentication (You can design your own login page still and configure, but only one login page per application) or you design your own security and authentication mechanism.

The Access Control to Resources is set using <security-constraint> if your web application is properly organized then you can omit some or all resource from security.(When they are accessed you wont be kicked back to the login page)

Check this link. http://java.dzone.com/articles/understanding-web-security

The main aim behind Form Based Authentication is to check for whether user is active or not when accessing a resource within web application. Previously this was achieved by writing filters and checking for session and roles on access of resource. Now this has been made simple and user need not code for security checks.
7 years ago
you can use any jsp file as login page in form based authentication. Remember this is the page to which user will be redirected in case of session expiry or in case anyone tries to access the pages within web application according to security constraints defined.

Hope this helps.
7 years ago
As per my knowledge there is no way to get the active connection count. It Internal to the container to judge on how many connections to keep. Still you can find the Maximum no. of connections allowed in the container setting. If there is a limit at database side on number of connections allowed you can tweak the connection pool settings to match it.

by the way why do you need that.
I could interpret few things from pic but not sure if they are correct.

Here is my understanding.
You call servlet from jsp.
Then a Standard DAO class is called from Servlet.

Just few Hints:
Normally establishing the Database connection takes time, hence you can implement connection pooling and then access the connection in DAO.
Avoid singleton pattern for DAO.
Also use PreparedStatements if the queries are not adhoc.
Remember most of the times badly written queries cause more performance issues. Try tuning Queries by indexing and other methods.

use "select rownum, distinct salary from emp order by salary"
Hi,

>> Is there a way to get the active connections from the connection Pool.
Did not get your question.
DataSource.getConnection always returns an active connection if you are using Connection Pooling.

You have to close the connection when using connection pool so that it is returned to the pool and can serve other components.
You can do it in finally block of the code.
you can try DatabaseMetaData.getUserName this will give you user name used in connection. If you need all users in system Not sure what level of previliges you have but can try Oracle specific query "select * from DBA_USERS".

Check this link for more details on DBA_USERS table.

http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_4174.htm
Any Object in fact can be used in any Java Class.

But to obtain the ServletContext Object you need a servlet and further it can be passed to any Class as method parameter and can be used.

Hope this helps. If you are trying to pass it to remote Object remember that it will be Pass by Value also I am not sure if ServletContext is serialized or not.
8 years ago
Is your requirement to show all radio buttons as one set. then hee is some sample code.

<% while(rs.next()) { %>
<input type="radio" NAME="heyou" value="<%=rs.getString(1)%>"><%=rs.getString(1)%>

<%}%>

8 years ago
JSP
Hi,
Make sure that the app.classpath includes your lib folder in the project.

Thanks & Regards,
Goutham Kumar P.

if you are checking whether there exists a record for given condition the I would suggest to use following instead of count.
because count often result in full table scans.


using count

Select count(1) from emp where empno=121;

using exists it becomes

select count(1) from emp where exists (select empno from emp where empno=121)
Hi,
In your case your are not getting the reference of the Bean where as the Reference of the Remote Object (Stub Class) which can be same in case of stateless bean.

you do a lookup to the given bean and the server returns a reference in the form of RemoteObject Stub class implementation of your Remote interface.

So when you call the equals method you are calling it on the Local Stub which extends LocalWrapperClass specific to container which might equate the
actual bean to which the stub is pointing to. So if your lookup returns the remote reference to the same SessionBean in the memory then the equals might pass.

No clear on the entire complex concepts but what I can say is if you lookup returns the references to same object in the Object Pool then the equality would pass.
if you want the response status to be part of the response try jsp:include.

Is it like you want the request to be directed to nextPage.jsp??
9 years ago
JSP
A simple answer would be

Session facade Pattern applies to Entity beans you write a session bean and give access to session bean for performing DB operation instead of Entity bean directly because exposing entity beans is not recommended as they represent DB there would not be any control over the operation from client.

Business Delegate pattern is when you want to do multiple tasks as a part of service you can have a delegated bean(can be event a normal Java Bean) for each task and call the respective task on each delegate this will keep the Main session bean simple and the main bean would not be doing all the complex logic.
Have a hidden field in the form for primary key say

Also have a Primary key field for each row appended with index.
if you are using one Edit button for each row use the following script.

You can generate the below code easily using JSP for loop.

<form>
<input type="hidden" name="pkey"/>
<tr>
<td><input type="checkbox" name="key0" value="kkk"/></td>
<td>...all your row data</td>
<td><input type="button" name="edit1" on click="return submitform(0)"/>
</tr>
<tr>
<td><input type="checkbox" name="key1" value="xxx"/></td>
<td>...aall your row data</td>
<td><input type="button" name="edit0" on click="return submitform(1)"/>
</tr>
.
.
.



function submitform(var index) {
vay keyFieldName="key"+index;
document.forms.form1.pkey.value= document.getElement By Id( keyFieldName );
document.forms.form1. submit ();
}
9 years ago
JSP