Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2

 
nag manchi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have one issue .in struts2 ...
suppose i have one "table1" in the database.and this table1 having form and action classes.and table2 having also form and action classes.
In Table1 data is.
number name
1 xxxx
2 yyyy
3 zzzzzz.

and this having one.jsp page having two fields .one is for 'number' and one is for 'name'.

and second.jsp page having so many fields,and number feild also by using Table1.

but i want to use Table1 number in second.jsp
when trying open page is second.jsp its auotmatically number field should be 4 because in table1 already we use 3 fields there how to write the code and how to handle this stitutaion pleases slove this .
 
Ankit Garg
Sheriff
Posts: 9528
32
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
suppose i have one "table1" in the database.and this table1 having form and action classes.and table2 having also form and action classes

I'm trying to figure out what you are trying to say. Database tables don't have any form or action classes. They only have columns and rows. Basically what I think you are trying to say is that there are two tables, table1 and table2. table1 has two fields- number and name. table2 has a number field and some other fields. Now you want to know the next ID that will be generated in table1 by the database (assuming that number field is incremented automatically in the database). You'll use that next ID that will be generated in table1 on second.jsp. Now first of all what I didn't understand is what is the flow of your application. Is the user first shown one.jsp, and from there they move to second.jsp?? Also what is the exact relationship between table1 and table2. Also if you are going to use that ID that you'll find out, you might face some problems, as there could be more than one people using your application. So if more than one user gets the same value for the number column, then table2 might have two rows with the same value for the number field.

If I'm completely off course, then you can correct me as I couldn't understand what you are trying to do...
 
nag manchi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok i understand what i give wrong message ...

see i have one jsp page iam posting here jsp code




see in this jsp code first field is loading/unloading plan doc no.these field is not manual enter field we take the value from loading/unloading plan Table ok.my requirement is if suppose loading/unloading plan table are having 3 fields ,in the name of docno1,docno2,docno3.iam trying to open this jsp(which i posted).after opening the jsp loading/unloading plan the first filed docno filed is docno4(because like that auto generated).i think this understandable..
 
Ankit Garg
Sheriff
Posts: 9528
32
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is a very long code, and you didn't UseCodeTags either, but I've added them for you for now. Basically do you just want us to tell you how to find the next ID that will be generated in the database in a table??
 
nag manchi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam not get any answer can you please give me some suggestions for that
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic