tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeff.guttada...@abbott.com
Subject Re: Writing a bean
Date Mon, 25 Feb 2002 19:31:37 GMT

Additionally, there are syntax problems with your insert statement line as
well (missing double quotes around the whole parameter).  Might want to think
about taking these kind of questions to a java newsgroup (comp.lang.java.help
or comp.lang.java.programmer) for more/better responses, since they're not
really Tomcat-related... yet.  ;)

HTH,
-Jeff



                                                                                         
                         
                    Mark                                                                 
                         
                    <markd@bellso        To:     "Tomcat Users List" <tomcat-user@jakarta.apache.org>
             
                    uth.net>             cc:                                          
                            
                                         Subject:     Re: Writing a bean                 
                         
                    02/25/02                                                             
                         
                    01:05 PM                                                             
                         
                    Please                                                               
                         
                    respond to                                                           
                         
                    "Tomcat Users                                                        
                         
                    List"                                                                
                         
                                                                                         
                         
                                                                                         
                         




For starters, your lines of code using request.getParameter() seem to have
syntax errors.  The method getParameter() takes a String as it's argument
and returns a String.


At 10:01 PM 2/25/2002 +0530, you wrote:
>Hi,
>I wanted to write a java bean inside my JSP programme. My requirement is
like this
>
><%
>Connection con = (.........);
>statement = con.createStatement();
>request.getParameter(name);
>request.getParameter(phone);
>rs = st.executeQuery("select * from uma where name="+name);
>if(rs.next())
>{
>    out.println("name is present in db");
>    printContent();
>}
>else
>{
>    int x = st.executeUpdate(insert into uma values('"+name+"','"+phone+"');
>}
>%>
><%
>public void printContent()
>{
>    I wanted to do some printing stuff here basically HTML coding.
>}
>%>
>
>The printContent() method is giving me errors. I get Statement Expected
near the above method. Can any one help me? If there is any other way could
any one tell me what it is?
>
>Uma
>

--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>






--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message