Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

malik ge

Ranch Hand
+ Follow
since May 13, 2011
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 malik ge

Sorry for not being specific.

What I meant to say is that if array list's size is unknown. Meaning, I don't know if there are going to be 3 elements or 4 or more than that.
7 years ago
Hi,

I know how to get values from the following array list.

[some string 1, some string 2, some string 3]



I can either loop through it and store these values into strings or get the values by index:


This is when I know how many values are there going to be in an array list.

But if I don't know, how many values are there going to be in an array list, then how can I get them?

For example, if I am trying to get 3 values from an array list, but in that array list there are more than 3 values, then how to handle that situation?

Thanks.
7 years ago
By transferring mean,
I enter http://localhost/myapp/openid.jsp as openid url at consumer's site. Like when using google I enter https://www.google.com/accounts/o8/id

But the google's url saved at consumer's site is like this https://www.google.com/accounts/o8/id?id=xxxxxxxxxxxxxxxxxx
Mine url for every user stays the same like http://localhost/myapp/openid.jsp
I would like to know a way by which I can add some parameter at the end of my openid url after authentication.
So that the URL saved at consumer's site looks like
http://localhost/myapp/openid.jsp?user=xxxxxx
7 years ago
Yes that is what I want to do.
But I am not been able to understand how can I do that.

The openId url is http://localhost/myapp/openid.jsp , and that same url is saved for every user on the Consumer site ( which I am also running on a local machine).

After authentication, I want to add ?user=xxxxxx at the end of openid url. Then this openId url will be transferred to Consumer's site.

Like how Google's or yahoo's openId works
7 years ago
Hi,
I don't know if this is the right place to ask question about OpenId, but here it is.

I am using OpenId4Java to create an OpenId Provider. I have put the sample code in a servlet, and it is working fine.

I would like to know,
When I want to log-in to a site using my google account, I enter https://www.google.com/accounts/o8/id in the openId url. After providing my credentials to Google, the openId url provided to the Relying Party by Google looks like:
https://www.google.com/accounts/o8/id?id=xxxxxxxxxxxxxxxxxx

My openId provider url is http://localhost/myapp/openid.jsp
How can I add the user's name after a successful authentication, and send it to Relying Party so that the openId url of the user looks like this:
http://localhost/myapp/openid.jsp?user=xxxxxx

Thanks.
7 years ago
Hi,
I am using primefaces and here is the code for my register.xhtml page.


Managed Bean:



What I want to know if there is a way, that after the Submit button is clicked either:
Disable the command button so that it can't be clicked again.
or
Hide the form after the form is submitted.

Thanks
7 years ago
JSF
Hi,
I have a simple.xhtml page inside WEB-INF folder. I am using PrimeFaces

When I run the application and go to that page, It only shows the text "This is Editor:",
But when I place the same page outside the WEB-INF folder then it show the primeface editor.

Is primefaces tags are not accessible inside WEB-INF folder?
7 years ago
JSF
Finally found a solution.
In web.xml of the web application I placed the code:

7 years ago
Hi,
I am new to JAAS and using this link to create custom Realm and Login module.
I have followed all the steps given in that tutorial.

I have created a web application with only one JSP page (index.jsp) as mentioned there and paste the following code in it:

Welcome ${pageContext.request.userPrincipal.name}


I have also add information to web.xml.
When I run the application it only displays the page with Welcome in it.

I would very much appreciate, if some one could guide me with this.
Should I have to create a LogIn page and then go to index.jsp page or some other steps are required to run the application.

Thanks
7 years ago
I am creating small application for testing.
The reason for "deauthorizing" register.xhtml page is that, first the user can register themselves, then they can login.

Simply check if the user is logged in via some filter and redirect them back to where they came from.


Can you please explain a little more how can I do that?
7 years ago
JSF
Hi,
I am following this post http://aquaryus.wordpress.com/2012/03/29/jsf-login-logout-methods-session-timeouts-page-jumping-issues-facelets/
to redirect user to "login.xhtml" if the user is not logged in.
So far I have 4 pages
  • index.xhtml
  • register.xhtml
  • login.xhtml
  • welcome.xhtml

  • If user tries to go to welcome page, without authentication, he shall be redirected to login page,
    but when I run the application, only login.xhtml page is accessible without authentication.
    After logging in all the pages are accessible.
    I want only welcome.xhtml page to be accessed after authentication.

    My Code:


    Thanks
    7 years ago
    JSF
    Hi,
    In the following code:



    The @WebServlet annotation defines two urlPatterns signIn and signUp.
    I want to know, is it possible if:

  • signIn is passed then servlet should perform some task,
  • and if signUp is passed then some other functionality is performed, other than sign-In's functionality

  • 7 years ago

    Mohamed Sanaulla wrote:You need to have a look at ObjectId class from the MongoDB documentation.

    Recently I wrote an article which on a blog- Using Morphia- Java Library for MongoDB. Here I compared using MongoDB driver and Morphia API.

    PS: I was reluctant to share this link in my first reply tending it to be Blatant Advertisement. But I have code samples there which show you how to retrieve the "id" field from Mongo's BSON



    Thanks a lot man.
    That is exactly what I am looking for.
    It has not only clarify my current problem, but also helped me understanding some other useful things.
    Thanks again.
    8 years ago
    By doing this, I am able to get the records from the mongodb.



    But how can I get the "_id" object from the database.

    This shows the all the record:
    System.out.println(cursor.next());

    { "_id" : { "$oid" : "4fc68190a09ef7490a0b3b40"} , "firstName" : "Some First Name" , "lastName" : "Some Last Name"}



    But when I try to get the id, it gives me "null" value
    8 years ago