Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2007

Tip: Looking for answers? Try searching our database.

Want new request on jsp:include

Thread view: 
adamcrume@gmail.com - 18 Sep 2007 21:15 GMT
I have a servlet with a mapping like /myServlet/* which serves content
based on the URL.  It works great when it gets called alone.  However,
I also want to be able to include it in a jsp using <jsp:include
page="/myServlet/stuff"/>.  The problem is that in that case the
servlet gets the request URL of the JSP, not itself, so it doesn't
know to serve up "stuff".  Is there a way to do this purely using the
URL, without passing it parameters?
Manish Pandit - 18 Sep 2007 22:06 GMT
On Sep 18, 1:15 pm, adamcr...@gmail.com wrote:
> I have a servlet with a mapping like /myServlet/* which serves content
> based on the URL.  It works great when it gets called alone.  However,
[quoted text clipped - 3 lines]
> know to serve up "stuff".  Is there a way to do this purely using the
> URL, without passing it parameters?

Instead of basing the actions on the URL, you might want to consider
using query-strings. So, myServlet can still be there, but instead of /
myServlet/getMeCoffee, the request URL will be more like /myServlet/
getMe?item=coffee.

This way, you an use include tag and pass parameters.

<jsp:include page="/myServlet/getMe">
   <jsp:param name="item" value="coffee"/>
</jsp:include>

-cheers,
Manish
adamcrume@gmail.com - 18 Sep 2007 22:27 GMT
> On Sep 18, 1:15 pm, adamcr...@gmail.com wrote:
>
[quoted text clipped - 19 lines]
> -cheers,
> Manish

I had though about that, and it works, but it just feels like a hack
to me, rather than a solution.  If it can't be done, perhaps it should
be chalked up to a limitation of the J2EE spec.

Thanks for your input, though.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.