Hi frnds i want to help in servlet,java bean and JSP

hi friends i'm right now in M.SC(IT) and i want to do project in SERVLET,,JAVA BEANS and JSP ,
so pls give me a title about that
NOTE: I develop a project in group(2 persons there)
my email id is : [email protected] , [email protected] , [email protected]

You cannot pair your iPod to a cell phone, so forget about it.
The only way you can get free WiFi is to hang out at a Denny's, a Starbucks, or a truck stop, and I don't think your parents would approve....

Similar Messages

  • Help please! Java application and web application...

    Hi,
    I have a problem with inserting a java application (Main.java) in a web application(index.jsp).
    I found a source demo of a drag and drop application on the Internet, but now I want to
    have the drag and drop application work in a Jpanel/JFrame in a webapplication.
    The drag and drop application code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class Main {
        public static void main(final String[] args) {
            final ButtonGroup grp = new ButtonGroup();
            final JPanel palette = new JPanel(new FlowLayout(FlowLayout.LEFT));
            palette.setBorder(BorderFactory.createTitledBorder("Palette"));
            final MainPanel mainPanel = new MainPanel();
            mainPanel.setPalette(palette);
            for(int j=0; j<4; j++){
                final JToggleButton btn = new JToggleButton("Panel "+(j+1));
                palette.add(btn);
                grp.add(btn);
                btn.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        mainPanel.setAdding(btn.getText());
            final JFrame f = new JFrame("Drag and drop panels");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(palette, BorderLayout.WEST);
            f.getContentPane().add(mainPanel, BorderLayout.CENTER);
            f.setSize(800, 600);
            f.setVisible(true);
    class MainPanel extends JPanel implements MouseListener, MouseMotionListener {
        private JPanel palette;
        private String adding="";
        private SubPanel hitPanel;
        private int deltaX, deltaY, oldX, oldY;
        private final int TOL = 4;  //tolerance
        public MainPanel() {
            setLayout(null);
            addMouseListener(this);
            addMouseMotionListener(this);
        public void mousePressed(final MouseEvent e) {
            if( adding != "" ){
                setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                SubPanel sub = new SubPanel(adding);
                add(sub);
                sub.setSize(sub.getPreferredSize());
                sub.setLocation((int)e.getX(),(int)e.getY());
                revalidate();
                adding = "";
                return;
            Component c = getComponentAt(e.getPoint());
            if (c instanceof SubPanel) {
                hitPanel = (SubPanel) c;
                oldX = hitPanel.getX();
                oldY = hitPanel.getY();
                deltaX = e.getX() - oldX;
                deltaY = e.getY() - oldY;
                if( oldX < e.getX()-TOL ) oldX += hitPanel.getWidth();
                if( oldY < e.getY()-TOL ) oldY += hitPanel.getHeight();
        public void mouseDragged(final MouseEvent e) {
            if (hitPanel != null) {
                int xH = hitPanel.getX();
                int yH = hitPanel.getY();
                int xDiff = e.getX()-oldX;
                int yDiff = e.getY()-oldY;
                int cursorType = hitPanel.getCursor().getType();
                if( cursorType == Cursor.W_RESIZE_CURSOR){           //West resizing
                    hitPanel.setBounds( e.getX(), yH, hitPanel.getWidth() - xDiff, hitPanel.getHeight() );
                }else if( cursorType == Cursor.N_RESIZE_CURSOR){     //North resizing
                    hitPanel.setBounds( xH, e.getY(), hitPanel.getWidth(), hitPanel.getHeight() - yDiff );
                }else if( cursorType == Cursor.S_RESIZE_CURSOR){     //South resizing
                    hitPanel.setSize( hitPanel.getWidth(), hitPanel.getHeight() + yDiff );
                }else if( cursorType == Cursor.E_RESIZE_CURSOR){     //East resizing
                    hitPanel.setSize( hitPanel.getWidth() + xDiff, hitPanel.getHeight() );
                }else if( cursorType == Cursor.NW_RESIZE_CURSOR){     //NorthWest resizing
                    hitPanel.setBounds( e.getX(), e.getY(), hitPanel.getWidth() - xDiff, hitPanel.getHeight() - yDiff );
                }else if( cursorType == Cursor.NE_RESIZE_CURSOR){     //NorthEast resizing
                    hitPanel.setBounds( xH, e.getY(), hitPanel.getWidth() + xDiff, hitPanel.getHeight() - yDiff );
                }else if( cursorType == Cursor.SW_RESIZE_CURSOR){     //SouthWest resizing
                    hitPanel.setBounds( e.getX(), yH, hitPanel.getWidth() - xDiff, hitPanel.getHeight() + yDiff );
                }else if( cursorType == Cursor.SE_RESIZE_CURSOR){     //SouthEast resizing
                    hitPanel.setBounds( xH, yH, hitPanel.getWidth() + xDiff, hitPanel.getHeight() + yDiff );
                }else{      //moving subpanel
                    hitPanel.setLocation( e.getX()-deltaX, e.getY()-deltaY );
                oldX = e.getX();
                oldY = e.getY();
        public void mouseMoved(final MouseEvent e) {
            Component c = getComponentAt(e.getPoint());
            if (c instanceof SubPanel) {
                int x  = e.getX();
                int y  = e.getY();
                int xC = c.getX();
                int yC = c.getY();
                int w  = c.getWidth();
                int h  = c.getHeight();
                if(       y >= yC-TOL   && y <= yC+TOL && x >= xC-TOL   && x <= xC+TOL  ){
                    c.setCursor(new Cursor(Cursor.NW_RESIZE_CURSOR));
                }else if( y >= yC-TOL   && y <= yC+TOL && x >= xC-TOL+w && x <= xC+TOL+w ){
                    c.setCursor(new Cursor(Cursor.NE_RESIZE_CURSOR));
                }else if( y >= yC-TOL+h && y <= yC+TOL+h && x >= xC-TOL   && x <= xC+TOL ){
                    c.setCursor(new Cursor(Cursor.SW_RESIZE_CURSOR));
                }else if( y >= yC-TOL+h && y <= yC+TOL+h && x >= xC-TOL+w && x <= xC+TOL+w ){
                    c.setCursor(new Cursor(Cursor.SE_RESIZE_CURSOR));
                }else if( x >= xC-TOL   && x <= xC+TOL ){
                    c.setCursor(new Cursor(Cursor.W_RESIZE_CURSOR));
                }else if( y >= yC-TOL   && y <= yC+TOL ){
                    c.setCursor(new Cursor(Cursor.N_RESIZE_CURSOR));
                }else if( x >= xC-TOL+w && x <= xC+TOL+w ){
                    c.setCursor(new Cursor(Cursor.E_RESIZE_CURSOR));
                }else if( y >= yC-TOL+h && y <= yC+TOL+h ){
                    c.setCursor(new Cursor(Cursor.S_RESIZE_CURSOR));
                }else{
                    c.setCursor(new Cursor(Cursor.MOVE_CURSOR));
        public void mouseReleased(final MouseEvent e) { hitPanel = null; }
        public void mouseClicked(final MouseEvent e) {}
        public void mouseEntered(final MouseEvent e) {}
        public void mouseExited(final MouseEvent e) {}
        public void setAdding(final String string) {
            adding = string;
            setCursor(new Cursor(Cursor.HAND_CURSOR));
        public void setPalette(final JPanel panel) { palette = panel; }
    class SubPanel extends JPanel {
        public SubPanel(final String name) {
            setPreferredSize(new Dimension(100, 100));
            setBorder(new TitledBorder(new LineBorder(Color.BLACK), name));
    }This application works with JFrame, but I want to display the JFrame in a webapplication (JSP Page).
    I'm using Netbeans 6.0 (GlassFish) to create webapplication using Visual Web JavaServer Faces.
    So in summary:
    How can i display the drag and drop application into a JFrame (better in a JPanel) in a webapplication (index.jsp)??
    Hope you can help...
    Thanks in advance...
    Greetings,
    Rajsh

    So have an applet that opens a JFrame... JSP or not has nothing to do with it, since it's nothing but HTML the client gets.
    You can't have a JFrame embedded in an HTML page. And if you could have an applet but don't know how to get that copied code to fit inside (I mean, content pane is content pane), you might want to consider learning how to do that.

  • Has somebody who can help me please  with JavaMail and JSP ?

    I am new in JSP
    And I would wish to create a JSP to send an email with attachment.
    For the compilation of my JavaBeans I use JBuilder 9 Personnel version
    Then I have j2sdk1.4.0
    In C:\j2sdk1.4.0\
    For the installation of the API javamail
    it is necessary to download two jar files Mail.jar and activation .jar
    http://java.sun.com/products/javamail/javadocs/index.html
    it is done!
    then, I copied my two files mail.jar and activation.jar in the directory
    C:\j2sdk1.4.0\lib
    And in
    C:\jBuilder 9 \jdk1.4\lib
    I have family Windows XP
    Then from DOS in the the directory c:\ Documents and Settings\MEBARKIA
    I have to add this line:
    SET CLASSPATH=c:\j2sdk1.4.0\lib\mail.jar;c:\j2sdk1.4.0\lib\activation.jar;
    Finally,
    for a test, I downloaded an example of Javabean from : http://java.sun.com/developer/qow/archive/74/
    the source code is:
    import java.beans.*;
    import java.util.*;
    import java.io.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    public class XYZMail extends Object
    implements java.io.Serializable {
    private ArrayList mailTo
    = new ArrayList();
    private String mailFrom ;
    private String mailSubject ;
    private String mailMessage ;
    private String mailHost;
    private ArrayList mailAttachments = new ArrayList();
    private Properties props;
    private javax.mail.Session sess;
    private InternetAddress[] address
    = { new InternetAddress() };
    public XYZMail() {
    props = new Properties( ) ;
    props = System.getProperties();
    public long sendMail () throws MessagingException {
    props.put("mail.smtp.host", getMailHost() );
    sess = javax.mail.Session.getDefaultInstance(props, null);
    sess.setDebug( Boolean.valueOf( "false" ).booleanValue() );
    int i = 0;
    MimeMessage msg = new MimeMessage(sess);
    msg.setFrom(new InternetAddress( getMailFrom() ));
    for ( Iterator itr = mailTo.iterator( ); itr.hasNext(); ) {
    address[i] = new InternetAddress((String) itr.next()) ;
    msg.setRecipients(Message.RecipientType.TO, address);
    msg.setSubject( getMailSubject() );
    MimeBodyPart mbp1 = new MimeBodyPart();
    mbp1.setText( getMailMessage() );
    Multipart mp = new MimeMultipart();
    mp.addBodyPart(mbp1);
    if ( ! mailAttachments.isEmpty() ) {
    MimeBodyPart mbp2 = new MimeBodyPart();
    FileDataSource fds=new FileDataSource( (String)
    mailAttachments.get(0) );
    mbp2.setDataHandler(new DataHandler(fds));
    mbp2.setFileName( (String) mailAttachments.get(0) );
    mp.addBodyPart(mbp2);
    msg.setContent(mp);
    msg.setSentDate(new Date());
    Transport.send(msg);
    return 1;
    public ArrayList getMailTo ( ) {
    return mailTo;
    public String getMailFrom ( ) {
    return mailFrom;
    public String getMailSubject ( ) {
    return mailSubject;
    public String getMailMessage ( ) {
    return mailMessage;
    public ArrayList getMailAttachments ( ) {
    return mailAttachments;
    public String getMailHost ( ) {
    return mailHost;
    public void setMailHost ( String host ) {
    mailHost = host;
    public void setMailAttachments ( ArrayList attachments ) {
    mailAttachments = attachments ;
    public void setMailMessage ( String msg ) {
    mailMessage = msg ;
    public void setMailSubject ( String subject ) {
    mailSubject = subject ;
    public void setMailFrom ( String from ) {
    mailFrom = from;
    public void setMailTo ( ArrayList to ) {
    mailTo = to;
    I have all these error messages:
    "XYZMail.java" : Erreur No. 704 : acc?s impossible au r?pertoire javax\mail en ligne 6, colonne 1
    "XYZMail.java" : Erreur No. 704 : acc?s impossible au r?pertoire javax\mail\internet en ligne 8, colonne 1
    "XYZMail.java" : Erreur No. 704 : acc?s impossible au r?pertoire javax\activation en ligne 9, colonne 1
    "XYZMail.java" : Erreur No. 302 : classe javax.mail.Session non accessible ; aucune classe ni source trouv? pour javax.mail.Session en ligne 22, colonne 20
    "XYZMail.java" : Erreur No. 300 : classe InternetAddress introuvable dans classe gestionbadges.XYZMail en ligne 23, colonne 9
    "XYZMail.java" : Erreur No. 300 : classe MessagingException introuvable dans classe gestionbadges.XYZMail en ligne 31, colonne 32
    "XYZMail.java" : Erreur No. 300 : classe InternetAddress introuvable dans classe gestionbadges.XYZMail en ligne 24, colonne 9
    "XYZMail.java" : Erreur No. 302 : classe javax.mail.Session non accessible ; aucune classe ni source trouv? pour javax.mail.Session en ligne 34, colonne 19
    "XYZMail.java" : Erreur No. 300 : classe MimeMessage introuvable dans classe gestionbadges.XYZMail en ligne 38, colonne 1
    "XYZMail.java" : Erreur No. 300 : classe MimeMessage introuvable dans classe gestionbadges.XYZMail en ligne 38, colonne 23
    "XYZMail.java" : Erreur No. 300 : classe InternetAddress introuvable dans classe gestionbadges.XYZMail en ligne 40, colonne 17
    "XYZMail.java" : Erreur No. 300 : classe InternetAddress introuvable dans classe gestionbadges.XYZMail en ligne 42, colonne 18
    "XYZMail.java" : Erreur No. 302 : classe Message.RecipientType non accessible ; aucune classe ni source trouv? pour Message.RecipientType en ligne 46, colonne 27
    "XYZMail.java" : Erreur No. 300 : classe MimeBodyPart introuvable dans classe gestionbadges.XYZMail en ligne 50, colonne 1
    "XYZMail.java" : Erreur No. 300 : classe MimeBodyPart introuvable dans classe gestionbadges.XYZMail en ligne 50, colonne 25
    "XYZMail.java" : Erreur No. 300 : classe Multipart introuvable dans classe gestionbadges.XYZMail en ligne 53, colonne 1
    "XYZMail.java" : Erreur No. 300 : classe MimeMultipart introuvable dans classe gestionbadges.XYZMail en ligne 53, colonne 20
    "XYZMail.java" : Erreur No. 300 : classe MimeBodyPart introuvable dans classe gestionbadges.XYZMail en ligne 57, colonne 1
    "XYZMail.java" : Erreur No. 300 : classe MimeBodyPart introuvable dans classe gestionbadges.XYZMail en ligne 57, colonne 25
    "XYZMail.java" : Erreur No. 300 : classe FileDataSource introuvable dans classe gestionbadges.XYZMail en ligne 59, colonne 1
    "XYZMail.java" : Erreur No. 300 : classe FileDataSource introuvable dans classe gestionbadges.XYZMail en ligne 59, colonne 24
    "XYZMail.java" : Erreur No. 300 : classe DataHandler introuvable dans classe gestionbadges.XYZMail en ligne 61, colonne 25
    "XYZMail.java" : Erreur No. 300 : variable Transport introuvable dans classe gestionbadges.XYZMail en ligne 70, colonne 1
    Thanks for your's help!!!!!

    Thank you very much for your answer wew64.
    Yes, I have a local server TOMCAT
    But the problem
    It is on the compilation I do not arrive has to compile my javabean XYZMail java
    With jbuilder 4
    However I have to configure my CLASSPATH on the level of DOS
    And on the variables of enivrements of Windows XP.
    I copied the two files mail.jar and activation.jar everywhere
    In
    C:\j2sdk1.4.0\lib
    And in
    C:\j2sdk1.4.0\jre
    C:\j2sdk1.4.0\jre\lib
    Even case with
    c:\jBuider 4
    thanks.

  • How to keep the servlet java code the JSP engine generated?

    Hello there!
              I am using some JSP in a web application, and would like to take a llok
              at the servlet java files th weblogic JSP engine generated.
              In my weblogic.properties file I have the following line:
              "# Set up WebLogic JSP properties
              weblogic.httpd.register.*.jsp=weblogic.servlet.JSPServlet
              weblogic.httpd.initArgs.*.jsp=\
              pageCheckSeconds=1,\
              compileCommand=F:/VisualCafeEE/bin/sj.exe,\
              workingDir=F:/weblogic/myserver/classfiles,\
              verbose=true,\
              keepgenerated=true"
              However, the only things I can find are the class files compiled from
              the servlet java files.
              Any suggestions?
              Thanks.
              Jeff.
              

    Moerover, if you follow the example web.xml Weblogic provides
              (http://www.weblogic.com/docs51/classdocs/sample_web_xml.html), the parser
              would complaint big time.
              The <servlet> and <context-param> tags have to be switched.
              Jeff
              "John J. Feigal" wrote:
              > I'm not sure why, but specifying keepgenerated=true in weblogic.properties
              > did not do the job for us.
              >
              > We had to add the following to our application's web.xml file:
              >
              > <!-- keepgenerated initArg to JSPServlet -->
              > <context-param>
              > <param-name>weblogic.jsp.keepgenerated</param-name>
              > <param-value>true</param-value>
              > </context-param>
              >
              > --
              > John J. Feigal Voice (651)766-8787 (main)
              > Sr. Technical Consultant (651)766-7249 (direct)
              > Ensodex, Inc. Fax (651)766-8792
              > 4105 N. Lexington Ave., Suite 150 email [email protected]
              > Arden Hills, MN 55126 WebSite http://www.ensodex.com
              >
              > "Jong Lee" <[email protected]> wrote in message
              > news:[email protected]...
              > >
              > > You have the init arg "keepgenerated" tunred on in weblogic.properties.
              > > The java file should be kept in the same directory of your jsp file.
              > >
              > > You can also use "jspc" to generate the java source.
              > > i.e:
              > > "java weblogic.jspc -keepgenerated yourjspfile"
              > >
              > >
              > >
              > >
              > >
              > > Jeff Wang <[email protected]> wrote:
              > > >Hello there!
              > > >
              > > >I am using some JSP in a web application, and would like to take a llok
              > > >at the servlet java files th weblogic JSP engine generated.
              > > >
              > > >In my weblogic.properties file I have the following line:
              > > >
              > > >"# Set up WebLogic JSP properties
              > > >weblogic.httpd.register.*.jsp=weblogic.servlet.JSPServlet
              > > >weblogic.httpd.initArgs.*.jsp=\
              > > > pageCheckSeconds=1,\
              > > > compileCommand=F:/VisualCafeEE/bin/sj.exe,\
              > > > workingDir=F:/weblogic/myserver/classfiles,\
              > > > verbose=true,\
              > > > keepgenerated=true"
              > > >
              > > >However, the only things I can find are the class files compiled from
              > > >the servlet java files.
              > > >
              > > >Any suggestions?
              > > >
              > > >Thanks.
              > > >
              > > >Jeff.
              > > >
              > >
              

  • Need help in countdowntimer in java bean for jsp page

    hi..im student..i need help with countdowntimer in jsp page..with java bean component..im use XHTML MP for my jsp page so i can use it in cellular phone with WAP 1..can anybody help me with this problem..thx

    hi..im student..i need help with countdowntimer in jsp page..with java bean component..im use XHTML MP for my jsp page so i can use it in cellular phone with WAP 1..can anybody help me with this problem..thx

  • Servlet to Bean to JSP

    I have a JSP that sends two form values to a servlet. I want to send those parameters to a bean for calculation and then send the results back to the JSP. I am stuck on the Servlet code and don't know how to send it back with the bean don't know how to start the bean:
    import javax.servlet.*;
    int rate, hours;
    public class calculateParamServlet extends HttpServlet{
         public void doPost(HttpServletRequest req, HttpServletResponse res) throws
         ServletException, IOException {
              rate = req.getParameter("hourlyRate");
              hours = req.getParameter("hours");
    }Any help would be appreciated,
    Kent

    A bean is just a Java class so the same rules apply.
    e.g in the doPost method,
    myBean mybean = new MyBean();
    mybean.setRate(rate);
    mybean.setHours(hours);
    out.println(mybean.getCalc());
    If you want to save the reference to the bean, save it in the application or session scope and check for its existence before creating it again. You could also do all this directly from the JSP.
    HTH

  • Plz help me in java bean

    i placed my class file in
    [red] web-infclasses/user/UserData.class
    [\red]but this error can any body help me
    org.apache.jasper.JasperException: /SaveName.jsp(2,0) File "/classes.user.UserData" not found
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
         org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:334)
         org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:367)
         org.apache.jasper.compiler.Parser.parseDirective(Parser.java:468)
         org.apache.jasper.compiler.Parser.parseElements(Parser.java:1426)
         org.apache.jasper.compiler.Parser.parse(Parser.java:133)
         org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
         org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:167)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.

    change your classpath

  • Java mail and jsp -HELP!! HELP!!

    Hi all
    I have a simple email module with a jsp page and a html page I am trying to connect to a yahoo smtp server and send a mail from the webpage to the smtp server - I am getting an Authentication required error.
    error ##
    org.apache.jasper.JasperException: Sending failed;
    nested exception is:
         class javax.mail.MessagingException: 530 authentication required - for help go to http://help.yahoo.com/help/us/sbc/dsl/mail/pop/pop-11.html
    Can anyonne tell me how to use a simple smtp email facility
    how to use an authenticator in the jsp
    ciao
    laodingdockjavaguy

    It's required that you authentificate yourself at the smpt server
    The following snipplet sends a msg using the smtp protocol.
    Transport tr = session.getTransport("smtp");
    tr.connect(smtphost, username, password);
    msg.saveChanges();     // don't forget this
    tr.sendMessage(msg, msg.getAllRecipients());
    tr.close();If this still fails You can also try to set the property mail.smtp.auth to true.
    mail.smtp.auth      boolean      If true, attempt to authenticate the user using the AUTH command. Defaults to false.see also http://java.sun.com/products/javamail/1.3/docs/javadocs/com/sun/mail/smtp/package-summary.html
    for a complete description of the properties supported by the smpt transport.
    hope it helps

  • The relation of Servlet , bean and jsp

    servlet can output to IE directly? I mean that design a servlet adding some code in the service method, compile it, input URL: localhost:8080/test/servletname, can I get result? (Tomcat, register servlet in web.xml)

    yes that's the point!
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class HelloWorld extends HttpServlet {
         public void doGet( HttpServletRequest req, HttpServletResponse resp )
         throws ServletException, IOException {
              resp.getWriter().println( "<html><body>Hello World</body></html>" );
    }

  • Help converting between Java Dates and SQL Dates

    Hey all,
    I'm working on a JSP to allow a user to enter information about news articles into a mySQL database. I'm using text fields for most of the data, and most of it is transferred correctly when the user hits "Submit." However, I am having a problem with the date field of the mySQL database. Basically I'm trying to retrieve the current date from the JSP page, and then insert this into the date field of the appropriate table when the user hits submit. The problem is that I can't typecast a java.util.Date or even a java.util.Calendar to a java.sql.Date object. I've tried lots of approaches, including creating a new instance of java.util.Calendar, getting all its fields and concatenating them onto the date variable, but this doesn't work.
    Anyone know how I could easily convert between java.util.Date or java.util.Calendar and java.sql.Date?
    Thanks!

    Thanks for the help!
    I can correctly display the current date on the page in java.sql.Date format now, but it's still not being inserted into the database correctly. The specific code is as follows:
    java.util.Date dt = new java.util.Date();
    java.sql.Date sqlDate = new java.sql.Date(dt.getTime());
    (As you wrote)
    Then (after connecting to the database etc.):
    PreparedStatement pstmt = con.prepareStatement("INSERT INTO NEWS(NEWSDATE,DAYOFWEEK,AUTHOR,HEADLINE,CLIP,PUBLICATION,LINK,NEWSLOCATION,DATECREATED,DATEMODIFIED,CATEGORY,KEYWORDS,PHOTOURL,PHOTOGRAPHER,AUDIOURL) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
    pstmt.clearParameters();
    pstmt.setString(1,date);
    pstmt.setString(2,dayofweek);
    pstmt.setString(3,author);
    pstmt.setString(4,headline);
    pstmt.setString(5,clip);
    pstmt.setString(6,publication);
    pstmt.setString(7,link);
    pstmt.setString(8,newslocation);
    pstmt.setDate(9,sqlDate);
    pstmt.setString(10,datemodified);
    pstmt.setString(11,category);
    pstmt.setString(12,keywords);
    pstmt.setString(13,photoURL);
    pstmt.setString(14,photographer);
    pstmt.setString(15,audioURL);
    int i = pstmt.executeUpdate();
    pstmt.close();
    All the other fields are retrieved with request.getParameter from text fields. Any idea why the DATECREATED field is being updated to all 0's but the others work fine?
    Thanks again.

  • Need help with a java loop and word program

    do you know any way to get a Scanner object to select a random string in a text file?
    ok pretty much I have a text file that isa list of 5 letter words. I need to select one at random.
    the only way I could think was to scan the file, get the entire nu of words, have Math.random choose a random nu then loop scanner.next() and have the loop condition run the Math.random amount of times
    but... when I do that I CANT ACCESS THE WORD OUTSIDE THE STUPID LOOP grrr...
    i'm annoyed lol
    this is the loop code that selects the random word
    int random = (int) Math.random() * numberOfWordsInFile + 1;
    int chooseLoopCount = 0;
    while (random >= chooseLoopCount)
    String theWord = scan.next();
    theWord = theWord.toLowerCase();
    chooseLoopCount += 1;
    see it's assigned properly to be the output of the scanner in all lower case letters, but outside the loop, the variable doesn't even exist
    anyway any suggestions would be awesome. thx

    String theWord = null;
    while (...)
      // set theWord in the loop
    // access to theWord is now available here, as it is in scope.
    // bear in mind if your loop didn't get executed, theWord is still null

  • Need help with Java Beans and PDA

    How can I get Java Bean applets to work on a PDA, with either Palm or Pocket PC?

    first hit on google
    thankyou for using the georgemc google proxy

  • Help with java beans on initialisation

    hi
    I'm trying to use java beans for the first time
    I'm calling a bean from a JSP page; the bean will not exist when the page is first called
    <jsp:useBean id="user" scope="session" class="business.User" />I want to use properties/private attributes of the user bean to make a form "sticky" on the page, so that once the user has entered something, their input is there the next time they visit the page (eg back or via an href)
    The problem is that the bean creates a user on the first call with properties that are null, which means that "null" is displayed on my form when it first appears
    <td><input type="text" name="firstName" value="<jsp:getProperty name ='user' property='firstName' />"></td>I can code this out using a scriptlet but this defeats the beauty of java beans and jsp tags. How do I translate a null property so that nothing is displayed on the form?
    Thanks for your help

    So.. my mini-designer should be something like an editor,with a pallette with beans(like JavaBeans) and when a user is dragging a bean into a form,my applicaton should generate the code fr that bean....something like that :)

  • MVC Design Help, Single Servlet, How do I access the Model and DB

    Hi all. New here and looking for some help.
    I am currently writing a website that allows the creation of users, that may upload articles and post comments on articles. Im trying to develop using MVC. I have a single controller servlet that processes POST actions throughout the site (eg. InsertArticle, DeleteArticle, ModifyArticle, etc..)
    Now my problem is, just how do I retrieve the articles from the database? .. for example, if I load up a page http://localhost/articles.jsp which should display all the articles currently in the site.. I would have a function say getAllArticles() which should return a collection of all the articles. I can then iterate through the articles in the jsp page.
    I am trying to use <jsp:useBean...etc.> BUT.. my articles bean constructor takes a databaseconnection object as a parameter. If I use useBean I cant pass the databaseconnection object to the bean and I get an error because it cannot create the bean.
    Any help on this would be appreciated as well as any tutorial links. I also looked at the petstore blueprint program on the sun website, but that program has me completely lost with all the xml. I would prefer not to use custom tags or struts for now. I would like to keep it simple with snippets of java code in the jsp pages for data retrieval and display while keeping all the business logic in the beans of the model. I would also like to keep this relatively secure. I am developing using Oracle Jdeveloper 10g.
    Thanks
    Jazz

    Hey steve, thanks for that.. but thats exactly what i
    dont want to do. I also realize that ive been writing
    the ejb's incorrectly to begin with and have begun to
    rewrite them. However maybe I can make it easier..
    what im trying to do is precisely what is in this
    diagram..
    http://gsraj.tripod.com/jsp/jsp.html
    the problem im having is where it passes data back to
    the jsp page.. entity beans cant (or shouldnt?) be
    accessed directly from jsp pages.. which means i
    create a session bean which interacts with the entity
    bean and can return information to the jsp page.. i
    understand what i have to do.. i just dont know how to
    do it.. been searching for google for tutorials and
    etc.. this site is the closest ive come but .. as you
    can see it says "more to come" ..
    thanks again guys really appreciate itAhhh. EJBs. Enterprise Java Beans and JavaBeans are two completely different beasts. I know nothing about EJBs, except:
    1) They are much harder to use (and serve a different purpose I assume) then JavaBeans
    2) Tomcat (the server I use) doesn't support them.
    Sorry I can't be of more help.

  • Help: Compiling servlets

    Hi,
    I have created a servlet java file.
    and when i compile the servlet java file, I am getting error,
    HelloWorld.java:2: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    HelloWorld.java:3: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    HelloWorld.java:5: cannot find symbol
    symbol: class HttpServlet
    public class HelloWorld extends HttpServlet {
    ^
    HelloWorld.java:7: cannot find symbol
    symbol : class HttpServletRequest
    location: class HelloWorld
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    ^
    HelloWorld.java:7: cannot find symbol
    symbol : class HttpServletResponse
    location: class HelloWorld
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    ^
    HelloWorld.java:8: cannot find symbol
    symbol : class ServletException
    location: class HelloWorld
    throws ServletException, IOException {
    ^
    6 errors
    where can i get the missing javax classes?
    Thanks and Regards,
    Rashmy.

    Hi Sreekanth,
    Yes, I am using Tomcat server.
    I have java SDK 6 and J2EE 5.
    I am setting up the path to jdk6 and compiling it.
    is this the correct way?
    and i tried settingup calss path to the servlet-api.jar. but getting the same error.
    Thanks,
    Rashmy.

Maybe you are looking for

  • XML data 32K into CLOB

    Hi all, I am trying to use UTL_FILE.PUT_LINE to output an XML file. This xml file is the result of a select query. Hence converting the result of the select query into xml format using dbms_xmlgen.getxml and storing it in a variable. But the resultan

  • EXS Sampler Problems any one Help Help Help

    I Have recently been having loads of problems with my sampler instruments. When I click on some of them they take a while to load I have used the Project Manager in Logic Pro 7.1.1 to scan and that used to work but now no matter what I do in it wheth

  • How to define transaction semantics for JMS Queues

    Hi, My scenario in Oracle Fusion Middleware 11gR3, SOA Suite, IDE: JDeveloper 11g is as follows: First). receive a message from QueueA, Second). Using the message, call a serviceABC and send the same message into QueueB. I created a syn-BPEL, configu

  • Older version incompability question

    Hey people! I was hoping to get some help with the following question: I'm helping my sister launching her own wordpress (org) website. So I've been looking for nice templates on the web and have found some that suits the job. One template in particu

  • Does Anyone know how to add a new partner to purchase order created on VI01/VI02?

    Does Anyone know how to add a new partner to purchase order created on VI01/VI02? Please, anyone knows that? Regards. Rafael.