Saturday, December 19, 2009

Things to be remembered before including a file in your JSP page.

Their are 3 ways in J2ee [as for as i know ;)] from which you can include a file inisde your JSP. Let see what is the pros cons of each one.

<@inlcude file="someJunkIncludeFile.jsp">
  • As include is a page directive, you CANNOT pass dynamic values (by using scriplets or EL expressions)
  • It copies all the text which are in the included file (say someJunkIncludeFile.jsp) to the parent page.This happens every time when your parent page is getting recompiled, so make sure that if you have more include in a parent page, and the parent page will be recompiled often, then this may lead you a performance overhead :(
  • In advance containers like Tomcat 6, the container will automatically recompile your parent jsp, if any of your child pages or included pages are updated
  • In XML-based Jsp tags, you can specify the <@include/> as
<jsp:include page="someJunkIncludeFile.jsp"/>

  • JSP Action include can allow the dynamic values (by using scriplets or EL expressions) as a argument.(Thats why they call it as jsp Action include)
  • You can pass dynamic argument values to the include JSP page using param attribute.Below is the example which will pass values to the child page.



  • 
        
    
    



  • In your child page you can use the value test in the request scope by accessing.


  • < % =request.getParameter("test") % >

  • You can't pass any input arguments in query string to the child page, when you are including from the parent page

  • 
    

  • In above code test parameter can't be accessed from the child page, as they passed as a input query.
JSTL < c:import url="someJunkIncludeFile.jsp"/ >
  • c:import is 99.99% similar to jsp:include, the only difference i can feel is it can access the resources which are outside your application
  • in the url attribute (name sugest) we need to specify the entire URL of the resource. as below

17 comments:

Jobu said...

This is a nice comparison. easy to remember :)

靴子 said...

great ...........................................................

yahoo said...

人生最大的榮耀,不是永遠不敗,而是屢仆屢戰..............................

奇怪 said...

很棒的分享~如有打擾之處,敬請原諒!........................................

雅雯雅雯 said...

18havno185st成人片0204aaaaaaa片俱樂部免費影片欣賞aaaaa7777788卡提諾成人成人 影片日本卡通野球拳日本卡通色情網日本卡通h漫日本卡通少女日本女藝人圖片網站日本女傭a片日本女優名字日本女優圖庫日本女優姓名日本女優寶貝視訊 辣妹打手槍凹凸電影院線上免費看影片微風成人情色 網微風成人sex999免費影片情色聊天松島楓免費影片a383girl影音城維克斯成人999無瑪試看圖av影片下載網際論壇情色小站曼雪兒黃色小說曼雪兒色 f 情小說曼雪兒色情免費小說曼雪兒色情小說曼雪兒色情文章

黎仁南 said...

天下攘攘,皆為利往;天下熙熙,皆為利來. ....................................................

黃郁順 said...
This comment has been removed by a blog administrator.
RexTemples20144 said...

Nice Post~!!!. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

茂鴻 said...

以簡單的行為愉悅他人的心靈,勝過千人低頭禱告........................................

偉子生誠 said...

裸體寫真全裸美女圖片色情訊息黃色圖片自拍裸體圖片sex裸露圖片18限85cc a片台灣色情網站免費色情圖一夜激情聊天情色聊天室限制級爆乳女優作愛巨乳學院性愛情慾陰脣一夜情下體網愛聊天鹹濕做愛自拍成人圖庫成人影城性關係視訊情人性影片觀賞裸照淫美成人論壇av寫真自拍裸女貼圖av圖情色性愛貼圖成人vcdsexy辣妹視訊聊天色情視訊淫婦台灣情色論壇丁字褲貼圖免費a片影片淫蕩女人live show男女做愛火辣妹妹激情網愛聊天美女裸照免費色情網站

妍慧 said...

pleasure to find such a good artical! please keep update!!........................................

Br1207yantScipio1 said...

Readiness is all.......................................................

Fe024lixV_Ferrari1 said...

Quality is better than quantity.......................................................

怡君 said...

貼圖寫真視訊援交露點爆乳潮吹裸體裸照裸女愛愛無碼尋夢視訊聊天a漫a片a圖一夜情一葉情人妻激情情色寫真美女自拍辣妹自拍正妹自拍美女走光辣妹走光正妹走光脫衣秀脫衣走光色情自慰自拍成人

JereLacoste0俊榮 said...
This comment has been removed by a blog administrator.
kittycha said...
This comment has been removed by a blog administrator.
佳梅 said...

You are flattering me..............................................................

Post a Comment

 

This content comes from a hidden element on this page.

The inline option preserves bound JavaScript events and changes, and it puts the content back where it came from when it is closed.
Click me, it will be preserved!

If you try to open a new ColorBox while it is already open, it will update itself with the new content.

Updating Content Example:
Click here to load new content