Re: In struts, How to solve this with Database and jsp?

2009-10-04 Thread Tommy Pham
--- On Sun, 10/4/09, kaushal.sharma  wrote:

> From: kaushal.sharma 
> Subject: Re: In struts, How to solve this with Database and jsp?
> To: user@struts.apache.org
> Date: Sunday, October 4, 2009, 3:49 PM
> 
> 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
> 


Then you don't know how to do post data via GET/POST ?  Which is the basic of 
html form submission.  Case in point:

1) The client (you) have data to submit to the server (either javascript or 
html form which still be either GET/POST).  Struts doesn't care how the data is 
submitted (javascript, html form, curl, or another TCP app doing HTTP 
calls/POST) unless you use struts specific tags which you didn't mention nor 
show the related code.

2) On the server (your web app), you can use servlet, Struts, or other 
framework to accept or not, validate, and sanitize the input.  If you don't 
understand how struts accept html form type data input submission, you could 
try google or read the struts documentation/guide related to the struts version 
you're implementing.  Or provide the Struts related code you have already, the 
Struts version you're implementing, and the error message(s) where your code 
fails.  Which you also didn't provide.

3) Using database abstraction layer to make changes to the DB, which at this 
point is not Struts related.  Thus goes back to original reply of using JDBC 
calls, or more advance concepts (like EJB, persistence, etc).

Regards,
Tommy


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



Re: In struts, How to solve this with Database and jsp?

2009-10-04 Thread Paweł Wielgus
Hi,
below is pseudo code for form representing new row:

< form action="yourInsertAction" >
< input type="text" value="...place row value here " name="rowValue" />
< input type="submit" value="add row" />
< /form >

then in Action:

DB.insertNewRow(myForm.getRowValue());

But i don't understand what You mean by saying that You have created
add and delete function in javascript?
Are You using some ajax framework like jquery or something?

All in all this is very common and simple task,
the only way to upload something to Action is by submitting a form,
and reading it's fields in Action.

Are You aware of Struts workflow looks like?
If not, it will be very hard for You to go further, and if so i
recomend reading about it first.

Best greetings,
Paweł Wielgus.


2009/10/4 kaushal.sharma :
>
> Hi Pawel,
>
> Thanks for your reply.
>
> but not sure with this.
>
> can you suggest me with some code as i have created to function for add and
> delete a row in javascript, i need to send back the operations done on jsp
> to my asction servlet with the values so that my servlet can updated the
> database.
>
> hope you will have something to provide me.
> if you want to see the code i can provide you that.
>
>
> Please suggest.
>
>
> -Thanks & Regards,
> Kaushal K. Sharma
>
>
>
>
> Paweł Wielgus wrote:
>>
>> Hi Kaushal,
>> You can treat a html form as a representation of a new row in Your
>> table (for example at the bottom of the table),
>> then this form can be submited to an AddRowAction and after inserting
>> this "new row" to a DB redirected back to ListRowsAction.
>> Also you can add link to edit properties of one row on another jsp in
>> every one row (many "edit this row" links),
>> or create one huge form that will use indexed properties to edit all
>> rows in place,
>> keep in mind that the perfect solution is dependant of the situation,
>> so You have to choose how it will be better for Your users.
>>
>> Hope that helps.
>>
>> Best greetings,
>> Paweł Wielgus.
>>
>>
>>
>>
>> 2009/10/4 kaushal.sharma :
>>>
>>> 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 
> 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...

Re: In struts, How to solve this with Database and jsp?

2009-10-04 Thread kaushal.sharma

Hi Pawel,

Thanks for your reply.

but not sure with this.

can you suggest me with some code as i have created to function for add and
delete a row in javascript, i need to send back the operations done on jsp
to my asction servlet with the values so that my servlet can updated the
database.

hope you will have something to provide me. 
if you want to see the code i can provide you that.


Please suggest.


-Thanks & Regards,
Kaushal K. Sharma

 


Paweł Wielgus wrote:
> 
> Hi Kaushal,
> You can treat a html form as a representation of a new row in Your
> table (for example at the bottom of the table),
> then this form can be submited to an AddRowAction and after inserting
> this "new row" to a DB redirected back to ListRowsAction.
> Also you can add link to edit properties of one row on another jsp in
> every one row (many "edit this row" links),
> or create one huge form that will use indexed properties to edit all
> rows in place,
> keep in mind that the perfect solution is dependant of the situation,
> so You have to choose how it will be better for Your users.
> 
> Hope that helps.
> 
> Best greetings,
> Paweł Wielgus.
> 
> 
> 
> 
> 2009/10/4 kaushal.sharma :
>>
>> 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 
 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, 

Re: In struts, How to solve this with Database and jsp?

2009-10-04 Thread Paweł Wielgus
Hi Kaushal,
You can treat a html form as a representation of a new row in Your
table (for example at the bottom of the table),
then this form can be submited to an AddRowAction and after inserting
this "new row" to a DB redirected back to ListRowsAction.
Also you can add link to edit properties of one row on another jsp in
every one row (many "edit this row" links),
or create one huge form that will use indexed properties to edit all
rows in place,
keep in mind that the perfect solution is dependant of the situation,
so You have to choose how it will be better for Your users.

Hope that helps.

Best greetings,
Paweł Wielgus.




2009/10/4 kaushal.sharma :
>
> 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 
>>> 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-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> Fo

Re: Need immediate help - Struts, my job is stuck

2009-10-04 Thread kaushal.sharma

Hi Paul,

Thanks for your prompt reply. i can understand you were in hurry for
something important. not a prob.

But as i am new to struts, i need suggestions with some code help. Hope you
can help me at this level.



-Thanks & Regards
Kaushal K. Sharma






Paul Benedict-2 wrote:
> 
> Kaushal,
> 
> I don't have time to read all the source you posted, but here's my
> answers to your direct questions:
> 
> First   :   I need to populate the values from database to this jsp page
> during the opening of this page
> 
>>> You need to have an action mapping for this. Something like
>>> /loadmydata.do
> 
> Second  : how can I add row to this table dynamically so that I can enter
> a
> few records and save the data to the database.
> 
>>> You can use JSP  to loop over a list of an array, and produce
>>> new  and  elements.
> 
> Third  :  When I save the records the values must go to ActionServlet,
> where
> I need them all in an ArrayList.
> 
>>> You need a second action mapping for this. Remember this pattern: Use
>>> one action for loading data, another action for saving the data.
> 
> Paul
> 
> On Sun, Oct 4, 2009 at 6:40 AM, kaushal.sharma
>  wrote:
>>
>> Hi,
>>
>> Sorry to be late here, but i need an immediate help. I am new to struts
>> and
>> recently put into a struts project.
>>
>> FYI
>>
>> I have a jsp file, where I am getting values from SQL SERVER 2000
>> database
>> using an Action Class and A Form Bean.
>> This jsp view is as a tabular format, where data is populated.
>>  Selectbox         text          checkbox        checkbox        text
>> text             cancel_image
>>
>> This page having operations like   cancel_row / save_table / add_row
>>
>> First   :   I need to populate the values from database to this jsp page
>> during the opening of this page
>> Second  : how can I add row to this table dynamically so that I can enter
>> a
>> few records and save the data to the database.
>> Third  :  When I save the records the values must go to ActionServlet,
>> where
>> I need them all in an ArrayList.
>>
>> Kindly see the code below.
>>
>> -Thanks & Regards,
>>
>>
>> // JSP
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Need-immediate-help---Struts%2C-my-job-is-stuck-tp25737228p25742091.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: In struts, How to solve this with Database and jsp?

2009-10-04 Thread kaushal.sharma

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 
>> 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-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: In struts, How to solve this with Database and jsp?

2009-10-04 Thread Tommy Pham
 Original Message 
> From: kaushal.sharma 
> 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-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org

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



In struts, How to solve this with Database and jsp?

2009-10-04 Thread kaushal.sharma

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:
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?
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?

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; ihttp://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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Dyanamic properties in Struts2

2009-10-04 Thread Tommy Pham
 Original Message 
> From: Scott Smith 
> To: Struts Users Mailing List 
> Sent: Fri, October 2, 2009 4:35:06 PM
> Subject: Dyanamic properties in Struts2
> 
> Has anyone found a good way to do the following. 
> 
> 
> 
> I have a menu on a web page.  The strings used to display menu items are
> in properties files and so the tags on the web page reference the menu
> property name instead of hard-coding the actual string .  Therefore, I
> can have an English version of the property file and a Spanish version
> of the property file and different users will see different language
> versions of the menu.  All that works fine.
> 
> 
> 
> Now the customer wants to be able to change the translations of the
> strings on the fly.  It's easy enough to give them a web page that
> allows them to look at the various strings and type in a new/different
> Spanish version of an English string.  But writing that out to the
> property file doesn't cause Struts2 to reload the property file and so
> anyone looking at a web page will see the old translation and not the
> new translation.  
> 
> 
> 
> I can see how to do this by doing a custom version of the struts tags
> that get the property values and completely re-implement the property
> support in struts/java.  But, it seems like there should be an easier
> way.  
> 
> 
> 
> Is there a way to get at the properties class instances (for different
> languages) that are loaded into the jvm and change the values on the
> fly?  I'd like to piggyback on the existing java support for the java
> properties class (and maybe put the different properties out in a
> database instead of in property files).
> 
> 
> 
> Does anyone have any suggestions?  

What about using DB backend for localization?  You'll have to make major 
changes in your code.  Once you have implemented DB backend, you can add/remove 
languages, or change the translations dynamically without having to deploy the 
new version of the app.  The changes to the language & translations can be done 
by anyone via the web UI with the proper privileges.

Regards,
Tommy


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



Re: Need immediate help - Struts, my job is stuck

2009-10-04 Thread Paul Benedict
Kaushal,

I don't have time to read all the source you posted, but here's my
answers to your direct questions:

First   :   I need to populate the values from database to this jsp page
during the opening of this page

>> You need to have an action mapping for this. Something like /loadmydata.do

Second  : how can I add row to this table dynamically so that I can enter a
few records and save the data to the database.

>> You can use JSP  to loop over a list of an array, and produce new 
>>  and  elements.

Third  :  When I save the records the values must go to ActionServlet, where
I need them all in an ArrayList.

>> You need a second action mapping for this. Remember this pattern: Use one 
>> action for loading data, another action for saving the data.

Paul

On Sun, Oct 4, 2009 at 6:40 AM, kaushal.sharma
 wrote:
>
> Hi,
>
> Sorry to be late here, but i need an immediate help. I am new to struts and
> recently put into a struts project.
>
> FYI
>
> I have a jsp file, where I am getting values from SQL SERVER 2000 database
> using an Action Class and A Form Bean.
> This jsp view is as a tabular format, where data is populated.
>  Selectbox         text          checkbox        checkbox        text
> text             cancel_image
>
> This page having operations like   cancel_row / save_table / add_row
>
> First   :   I need to populate the values from database to this jsp page
> during the opening of this page
> Second  : how can I add row to this table dynamically so that I can enter a
> few records and save the data to the database.
> Third  :  When I save the records the values must go to ActionServlet, where
> I need them all in an ArrayList.
>
> Kindly see the code below.
>
> -Thanks & Regards,
>
>
> // JSP

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



Re: Access Denied error with Struts 2.1.8

2009-10-04 Thread Dan R. Olsen III
I am on a Windows box and the permissions are the same as the 
permissions version 2.1.6 which is working.


When I click the MD5 link I get a page not found so I can't check the 
checksum.


On 10/3/2009 9:23 AM, Dale Newfield wrote:

Dan R. Olsen III wrote:
I moved the project to a path with no spaces and I am still getting 
the same access denied error.


And what are the permissions on that deployed file? (not the input 
file, but the one pointed to by the error message)


Also, is that file valid?  Is there a chance you got a bad download? 
Did you check the checksum?


-Dale

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



Need immediate help - Struts, my job is stuck

2009-10-04 Thread kaushal.sharma

Hi,

Sorry to be late here, but i need an immediate help. I am new to struts and
recently put into a struts project.

FYI

I have a jsp file, where I am getting values from SQL SERVER 2000 database
using an Action Class and A Form Bean.
This jsp view is as a tabular format, where data is populated.
 Selectbox text  checkboxcheckboxtext   
   
text cancel_image  

This page having operations like   cancel_row / save_table / add_row

First   :   I need to populate the values from database to this jsp page
during the opening of this page
Second  : how can I add row to this table dynamically so that I can enter a
few records and save the data to the database.
Third  :  When I save the records the values must go to ActionServlet, where
I need them all in an ArrayList.

Kindly see the code below.

-Thanks & Regards,


// JSP 
...


<%@ page contentType="text/html;charset=UTF-8" language="java"%>

<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean"; prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html"; prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic"; prefix="logic"
%>







 
  
 

 
  
  



Attention



 


PARTNER-EDIT CONTROL 
  









ACCOUNT ID/NAME
PAGE ID
TABLE NAME
FIELD NAME
DISPLAY FIELD VALUE
ALLOW EDIT
RECORD HISTORY
REQ
HELP TEXT
 



 <% 
 for (int count=0; count<10; count++){%>
 



Select Partner Name 







   





   



   







 











 ../images/cancelCross.jpg
   


 <%--