• 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
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Response various from struts page and jsp page

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have two web pages one is a jsp page and another one is struts page how i differentiate in servlet whether the response is from jsp or the response is from struts. Please clear my doubts.
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Most novices misunderstand the flow of web applications.
When response is sended back to browser, browser do not have
any special knowledge who generated request (servlet, jsp, struts(manual?,jsp?,velocity?)).
But you can pass this information by yourself. For example, generate hidden
field in response form, so your next submit processing can investigate this parameter.

--> Render response
Servlet -->
out.print("<input type='hidden' name='generator' value='servlet'/>");
Jsp -->
<%= ssdsd %><input type='hidden' name='generator' value='jsp'/>

--> Submit
-->
String gen = request.getParameter("generator");
if (gen != null && gen.equals("jsp")) {
...
} else {
......
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic