• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

How to display the resulting JSP of a servlet in another frame?

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I am developing a small application using JSP and Servlets, in which I am trying to implement MVC architecture.

1) In the database(oracle), I have a small table ,
2) In the model class I am trying to retrieve that table using Connection object, and storing the result in a ResultSet.
3) I am using a bean class(which has private variables, that reflect the columns in the database table), to set the values from ResultSet and get that values using setter methods.
4) I am storing the objects of that bean class in an ArrayList and setting that ArrayList object as an attribute on the request object and then "RequestDispatch"ing to a JSP page.
5) In the JSP page, I am trying to print the details from that ArrayList.

All the above mentioned process in working correctly, but what problem I am facing is,
My Home page has part of HTML like this


<html>
<head><title>home page</title></head>
<frameset rows="20%,80%>
<frame src="heading.jsp" name="heading"/>
<frameset cols="20%,80%>
<frame src="mainmenu.jsp" name="mainmenu"/>
<frame src="body.jsp" name="body"/>
</body
</html>

 
Nikhil Reddy Lingala
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
and my mainmenu.jsp has following html code


<html>
<body>
<a href="details.do?Action="FullDetails" target="body">Details</a>
</body>
</html>



details.do above corresponds to a servlet, which will do the background processing and returns the ArrayList to the
JSP mentioned.

I am being displayed with an error in the target frame that "HTTP method GET is not supported by this URL"

I understand that I have to use POST method.. but how should I mention that the method is POST within the <a> tag?
 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
You are getting this error as there is no <form> tag in the mainmenu.jsp. Specify the tag.
regards
sudha
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by sudha swami:
You are getting this error as there is no <form> tag in the mainmenu.jsp. Specify the tag.


Almost, but not quite. Just adding a form tag will not help. A POST cannot be generated from an anchor (<a>) tag, so you do need a form. But rather than an <a>tag, make the URL the action of the form and specify a method of POST.
 
Nikhil Reddy Lingala
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have just modified my servlet,
initially I have overriden doPost method.. but now I have overriden service method.. after this.. its perfectly working...!!!
 
Nikhil Reddy Lingala
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Originally Posted by Bear Bibeault:
But rather than an <a>tag, make the URL the action of the form and specify a method of POST.



I didn't quite really grab what you said..
You wanted me to do which one of the following?
1) declare a form, whose action is calling the required servlet and whose method is post. and then mention <a> somewhere in the JSP, whose action is same as that of the form declared before.

or

2) declare a form, and mention method=post, action is calling that servlet, and give it some name. Now from the <a> tag, mention action="<name of the form>"
 
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to "post" something out of link,


 
Something about .... going for a swim. With this tiny ad ...
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic