• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

add all selected data to datalist and send back to servlet

 
kumar amara
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am selecting data from 2 tables s2tab ,s3tab
using inner join
and i want to send that resultset data to a servlet through a datalist.
insted of like this
i want to automatically add all the selected data to servlet and that willl dispatch to a jsp

I want this model because iam already selectig the data by their column names and calculated columns also
any idea please tell me


SERVLET

NOTE:closed properly I JUST COPIED A NEEDED PAT
BEAN METHOD


when i click iam not getting any error A BLANK PAGE WITH URL HAVING SERVLET NAME
THE SQL STATEMENT GETTING RESULT WHEN I TESTED MANUALLY
THEN SERVLET/ BEAN PROBLEM PLEASE TELL ME


Thanks in advance!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34207
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kumar,
The data has to be stored in something to be set as a request attribute. If not a list, you could use a custom data structure or the like.
 
kumar amara
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually In my application i have to select 80 columns from these 2 tables using inner join
So i felt to get the result set as whole and send the same to servlet as arraylist and the servlet will set the arraylist to a jsp page. if you could help me with some code i will be able to get.
iam getting them by using the bellow code But don't know how to complete
please verify the below code and suggest me




BeanMethod
Please observe that iam calculating the data and select in note1 comment


I truly not ready with my jsp page
I want to get them in a manner if it is null print nothing if it is not then display Is it possible to use ${} type way i need your help in jsp .
Thanks in advance
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2343
90
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kumar,

I don't know whether I understand your question properly, but let me try to give an answer:
You have put the result in an ArrayList ( with the name "msg" ) and you are now forwarding to you JSP where your want to show the results, right?
In your JSP you want to print nothing if the list is empty: for that you can use EL. With a <c:forEach> you can go step through the list. Something like this:

Does this answer your question?
Regards,
Frits
 
kumar amara
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
iAM GETTING just nothing
when i submit the request
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2343
90
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you getting any rows from the database? put some System.out.println() statements in your code.
 
kumar amara
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please see the first post of this thred where I put my latest code
I wrote out.println in servlet but same result(!) i.e not at all displaying any message
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2343
90
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see the print statement in your Servlet code, but can you post your web.xml, so that I can see you <servlet> and <servlet-mapping>
 
kumar amara
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


is the code of all the pages is correct?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2343
90
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try submitting "/ReportServ" instead of "ReportServ"
 
kumar amara
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I got this but the problem is not in web.xml , calling jsp page
may be in servlet/bean method/aptcresult page
but i think the compiler warning for unchecked exception/my code in the said above three cused the blank page dispalyed

Some one could please help me to solve this
even i used @for unchecked exception but i still get the warning
hope i will get from this forum
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2343
90
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  • Try tracing the path from your original JSP to the result JSP. If you put System.out.println() in your servlet code you can see (in the console window of tomcat) whether the path to the ReportServ is ok.
  • If that is ok, uncomment all the Servlet code and forward to your result JSP. Make sure that your result JSP only contains some HTML.
  • If you get to your result JSP, than you know that your path is ok. After that try uncommenting small pieces of code and see when and where it fails.
  •  
    kumar amara
    Greenhorn
    Posts: 24
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Iam using tomcat5.5.28 and its not having starup.bat
    in bin directory
    iam using service runner
    So how could i open tomcat console
    But i have other mvc program which inserts data in to mysql db and gives me success as message which i gor through getattrbute of result.jsp for that
    My sincere doubt is the problem really not in bean or jsp i really wonder i write that code
    At the same time i got unchecked warnigs when i compile my bean file isn't that causing the error ?
     
    Frits Walraven
    Creator of Enthuware JWS+ V6
    Saloon Keeper
    Pie
    Posts: 2343
    90
    Android Chrome Eclipse IDE
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Ok, let's not try to get into tomcat issues here. What is your compiler complaining about?
     
    kumar amara
    Greenhorn
    Posts: 24
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Note:ReportBean.java uses unchecked or unsafe exceptions
    use -xlint:....

    it comes when i compile bean file

    and are you sure that my servlet,bean,result jsp code is correct
    @SuppressWarnings("unchecked") even i put this no use

    anbody having good idea regarding my code please help me
     
    Bear Bibeault
    Author and ninkuma
    Marshal
    Pie
    Posts: 64716
    86
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    The warnings can simply be ignored.
     
    kumar amara
    Greenhorn
    Posts: 24
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    when i did all the code in my servlet i get output .
    But the servlet ,jsp view seperated it stucks.
    actually my post not get the right answer ,
    any idea how can i include a jsp page in my print writer out.println
    bcz my menu should be displayed along with the arraylist result.

    I still hope any settings in web.xml ,servlet,bean method to get my loving array list in jsp page
    Please help me .
     
    Bear Bibeault
    Author and ninkuma
    Marshal
    Pie
    Posts: 64716
    86
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    kumar amara wrote:bcz my menu should be displayed along with the arraylist result.

    "bcz" is not a word. Please use real words when posting to the forums.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic