aspose file tools*
The moose likes Servlets and the fly likes Response  various from struts page and jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Response  various from struts page and jsp page" Watch "Response  various from struts page and jsp page" New topic
Author

Response various from struts page and jsp page

Yog Ananth
Greenhorn

Joined: Dec 28, 2004
Posts: 27
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.
Eugene Lucash
Ranch Hand

Joined: Feb 19, 2005
Posts: 77
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 {
......
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Response various from struts page and jsp page
 
Similar Threads
printing values
forwarding to jsp
Struts2-json plugin not serializing action class to json
Migrating Application - From Struts with AJAX to JSF with AJAX
send SOAP Request without Response