• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help with this code!

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
data04 is the bean myBean ok
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nobody wants to help me on this?
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Jia Bin Tang
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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'm all tasted up for a BLT! This tiny ad wants a monte cristo!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic