aspose file tools*
The moose likes JSP and the fly likes Help with this code! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Help with this code!" Watch "Help with this code!" New topic
Author

Help with this code!

campos teixeira
Ranch Hand

Joined: May 23, 2004
Posts: 51
I am trying to connect to the database and I tested as an java application and it was ok but no success as a Web app. I am using eclipse with it and MS Access.

This is my code for the login:


This is the process.jsp page:


Should I put request or session??

This is the class:


DO I have to create a session in the class like
and then set the atributes like :


But that means I have to use a Servlet?? Is that the only solution to my problem to use a Servlet Or Can I put declare this in the process page?? As it is only for testing anyway.

I have another way to do to where I create and 2 methods in the class to open and close the connection in the process.jsp page.

Anyone opinion woulb be welcome ok

Thanks
campos teixeira
Ranch Hand

Joined: May 23, 2004
Posts: 51
The above method if(myBean.validate()) in the jsp page is authenticate not validate.

Also Can I put this in the code to instantiate the bean like:
import java.util.ResourceBundle; and inside the authenticate method
ResourceBundle bandle = ResourceBundle.getBundle("data04");

Is that the way to do it?? The code compiles but only calls the process.jsp page and doesnt connect to the database??

thanks
campos teixeira
Ranch Hand

Joined: May 23, 2004
Posts: 51
data04 is the bean myBean ok
Jia Bin Tang
Greenhorn

Joined: Mar 06, 2008
Posts: 16
campos teixeira wrote:data04 is the bean myBean ok


I couldn't find any of the bean that is data04.

Anyway here is my code for the login bean:



I can't seem to do the log in even I have these files:

login:



Can someone tell me what is wrong with my codes? Need it urgently. Thanks.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Jia Bin Tang wrote:Can someone tell me what is wrong with my codes?

There are too much and I am not motivated enough to point them all out.

But I would say, this one really, really, surprised me:


I can spot at least 5 (think)faults in here.
Jia Bin Tang
Greenhorn

Joined: Mar 06, 2008
Posts: 16
Bauke Scholtz wrote:There are too much and I am not motivated enough to point them all out.

But I would say, this one really, really, surprised me:


I can spot at least 5 (think)faults in here.


Hahah! I guess I'm not getting very logical here. I do a dummy copy and paste here and there, so I guess that's one of the reasons why it isn't correct.
I get the idea from here:



I don't understand this line as you put:


The other one was:



And due to the rule of using the dispatcher servlet, I can't use these servlets in my program.
Jia Bin Tang
Greenhorn

Joined: Mar 06, 2008
Posts: 16
Nobody wants to help me on this?
Zaeed McColin
Ranch Hand

Joined: Jan 13, 2009
Posts: 90
Mr/Ms Campos Teixeira
I'm new in JSP and JSF too
but i think your solution is not cool

I think it's better that use JPA (an entity bean) for Database connection with a simple JSP page with JSTL or a servlet

it's really cool and secure use JSF for authorizing users

good luck mi amigo



Open source
Jia Bin Tang
Greenhorn

Joined: Mar 06, 2008
Posts: 16
ArAsh Dex wrote:Mr/Ms Campos Teixeira
I'm new in JSP and JSF too
but i think your solution is not cool

I think it's better that use JPA (an entity bean) for Database connection with a simple JSP page with JSTL or a servlet

it's really cool and secure use JSF for authorizing users

good luck mi amigo



My solution is based on school's requirement, that we try not to use entity bean. If there isn't such a rule, I'd have used EJB long ago.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with this code!