This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes add all selected data to datalist and send back to servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "add all selected data to datalist and send back to servlet" Watch "add all selected data to datalist and send back to servlet" New topic
Author

add all selected data to datalist and send back to servlet

kumar amara
Greenhorn

Joined: Oct 27, 2009
Posts: 24
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
kumar amara
Greenhorn

Joined: Oct 27, 2009
Posts: 24
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
Bartender

Joined: Apr 07, 2010
Posts: 1644
    
  24

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

Joined: Oct 27, 2009
Posts: 24
iAM GETTING just nothing
when i submit the request
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1644
    
  24

Are you getting any rows from the database? put some System.out.println() statements in your code.
kumar amara
Greenhorn

Joined: Oct 27, 2009
Posts: 24
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
Bartender

Joined: Apr 07, 2010
Posts: 1644
    
  24

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

Joined: Oct 27, 2009
Posts: 24


is the code of all the pages is correct?
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1644
    
  24

try submitting "/ReportServ" instead of "ReportServ"
kumar amara
Greenhorn

Joined: Oct 27, 2009
Posts: 24


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
Bartender

Joined: Apr 07, 2010
Posts: 1644
    
  24

  • 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

    Joined: Oct 27, 2009
    Posts: 24
    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
    Bartender

    Joined: Apr 07, 2010
    Posts: 1644
        
      24

    Ok, let's not try to get into tomcat issues here. What is your compiler complaining about?
    kumar amara
    Greenhorn

    Joined: Oct 27, 2009
    Posts: 24
    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

    Joined: Jan 10, 2002
    Posts: 60810
        
      65

    The warnings can simply be ignored.


    [Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
    kumar amara
    Greenhorn

    Joined: Oct 27, 2009
    Posts: 24
    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

    Joined: Jan 10, 2002
    Posts: 60810
        
      65

    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.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: add all selected data to datalist and send back to servlet
     
    Similar Threads
    retreiving data through jsp
    servlet dispatcher not works
    The max input fields for servlet can handle
    weird functioning of servlet
    Retaining selected values in a portlet