struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "kaushal.sharma" <kaushalksharma.mt...@gmail.com>
Subject Re: In struts, How to solve this with Database and jsp?
Date Sun, 04 Oct 2009 20:49:00 GMT

Hi Tommy,

I know the fundamental of java, but quite new to struts.

i know my action is getting the data from the database and populating the
jsp tabular form through a bean and same at reverse.

but my query is...

how to add a row/ delete a row /save complete form to/from my database
through a javascript function

i tried it but just got stuck.

if you need i can provide you my code. Please help me with some code
suggestion. :confused:


-Thanks & Regards,
Kaushal K. Sharma




Tommy Pham wrote:
> 
> ---- Original Message ----
>> From: kaushal.sharma <kaushalksharma.mtech@gmail.com>
>> To: user@struts.apache.org
>> Sent: Sun, October 4, 2009 12:59:57 PM
>> Subject: In struts, How to solve this with Database and jsp?
>> 
>> 
>> Hi All,
>> 
>> i am new to struts and i have a problem to store the values to my
>> database
>> and retrieve the values to my jsp, hope you people can solve this ....
>> :confused: 
>> 
>> i am getting the records from database to my jsp, in a tabular format as
>> 1
>> Record in 1 ROW.
>> for ex.
>> 
>> >> First ROW Record       >>   1. selectbox     2. textfield     3.
>> checkbox    
>> >> 4. checkbox     5. textfield     6. checkbox     7. CancelIMAGE
>> >> Second ROW Record   >>   1. selectbox     2. textfield     3. checkbox
   
>> >> 4. checkbox     5. textfield     6. checkbox     7. Cancel IMAGE
>> 
>> :working:
> 
> If I'm not mistaken, the problem you're facing is not with Struts in
> particular but with understanding the fundamentals of Java.
> 
>> Q 1.  How can i get the values for all the fields from the database and
>> how
>> can i store all of them back to database?
> 
> Basic is straight JDBC calls.  More advanced is EJB, persistence (like
> Hibernate), etc.  Before getting into JDBC or more advanced technology,
> strong grasp of basic SQL syntax is required.
> 
>> Q 2.  I am not using 
> for this tabular form, and i used to Javascript
>> functions on my JSP page, 
>>         ONE for "DELETE ROW" and 
>>         SECOND for "ADD NEW ROW"
>>         Both functions are working fine on jsp but not sure how these
>> functions will delete and add the row from / to database?
>> 
> 
> See above.  Full understanding of database access layer will answer this
> question for you.
> 
> Regards,
> Tommy
> 
>> FYI
>> 
>>       function addRow(tableID)                                            
>>             {
>>                 var table = document.getElementById(tableID);
>>                          var rowCount = table.rows.length;
>>                 var row = table.insertRow(rowCount);
>>                 var colCount = table.rows[0].cells.length;
>> 
>>                 alert(table.rows.length - 1);                 // deleting
>> the 
>> first row
>> in counter for table index...
>> 
>>                 for(var i=0; i
>>                 {
>>                     var newcell = row.insertCell(i);
>> 
>>                     newcell.innerHTML = table.rows[1].cells[i].innerHTML;       

>>       
>>                 }
>>             }
>>             
>> 
>>             function deleteRow(target) 
>>             {
>>                 do {
>>                     if ( target.nodeName.toUpperCase() == 'TR' ) {
>>                         target.parentNode.removeChild(target);
>>                         break;
>>                     }
>>                     alert(target);
>> 
>>                 } while ( target = target.parentNode );
>> 
>>             }
>> 
>> 
>> 
>> hope you people don't mind to provide me the code and helpful tips, as i
>> am
>> new to struts i feel you people will help me this way ASAP.  :-)
>> 
>> One more thing, please provide me some example tutorials for struts, so
>> that
>> i'll understand,
>> 
>> 
>> -Thanks in Advance.
>> Kaushal K. Sharma
>> 
>> 
>> 
>> 
>> -- 
>> View this message in context: 
>> http://www.nabble.com/In-struts%2C-How-to-solve-this-with-Database-and-jsp--tp25741588p25741588.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/In-struts%2C-How-to-solve-this-with-Database-and-jsp--tp25741588p25742053.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message