Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question

 
Peter Masreblta
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Question#1:
Can rewritten URLs be used for state management in case the client submits an HTML form rather than clicking a hyperlink?
Qustion#2:
Which abstract class, designed to be extended to provide implementation dependent implementations thereof, by conformant JSP engine runtime environments?
Thanks
[This message has been edited by Peter Masreblta (edited October 26, 2001).]
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
#1 Yes, the URL provided to the action portion of the form tag must be encoded with HttpServletResponse.encodeURL()
#2 I think this is the information you are looking for:
Most JSP pages use HTTP, and their implementation classes must implement the HttpJspPage interface, which extends JspPage . If the protocol is not HTTP, then the class will implement an interface that extends JspPage.
------------------
I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
 
Sreenivasa Majji
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carl is right. I never tried a JSP with other than HTTP protocal. To check which interface was implemented check the generated servlet.
/Sreenivasa Kumar Majji.
 
Peter Masreblta
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Thanks Carl and sreenivasa.
The two questions above are from SCWCD@Whiz.
The answers and explanations are:
Question#1:
Answer: Rewritten URLs can't be used for state management in case the client submits an HTML form rather than clicking a hyperlink.
Explanation: Rewritten URLs pass state information between the client and server by embedding information in the URL of all hyperlinks within an HTML document. The information is passed in the query string of a URL in the form of name/value pairs. For e.g.

http://www.whizlabs.com/servlets/SampleServlet?bcolor=blue
This method is only effective when the client follows a hyperlink. If a client needs to submit an HTML form by clicking a button, the Hidden Variables method is used.
Question#2:
Answer: PageContext
Explanation: The PageContext class is an abstract class, designed to be extended to provide implementation dependent implementations thereof, by conformant JSP engine runtime environments. A PageContext instance is obtained by a JSP implementation class by calling the JspFactory.getPageContext() method, and is released by calling JspFactory.releasePageContext(). An example of how PageContext, JspFactory, and other classes can be used within a JSP Page Implementation object is given elsewhere.
The PageContext provides a number of facilities to the page/component author and page implementor, including:
-a single API to manage the various scoped namespaces
-a number of convenience API�s to access various public objects
-a mechanism to obtain the JspWriter for output
-a mechanism to manage session usage by the page
-a mechanism to expose page directive attributes to the scripting environment
-mechanisms to forward or include the current request to other active components in the application
-a mechanism to handle errorpage exception processing
I am still not quite sure about question#1.
Question#2 is very confusing.
Thanks
[This message has been edited by Peter Masreblta (edited October 27, 2001).]
[This message has been edited by Peter Masreblta (edited October 31, 2001).]
 
Tim Duncan
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Peter Masreblta:
Answer: Rewritten URLs can't be used for state management in case the client submits an HTML form rather than clicking a hyperlink.

This is nonsense! HTML forms can use GET or POST methods, in fact the *default* method is GET. In practice, of course, forms will often use POST, but that's not the point.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic