• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

<c:url>

 
nisha chidella
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what's the difference between these:


1. click here

2. click here

the first works while the second doesn't.In the second the request doesn't go to inputComment.jsp when i click on the link while in the first it goes to inputComment.jsp. var is just an attribute of c:url, so why would it make any difference ? when i view the source code from the brower, i see href=""(empty string) for the second option.

 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nisha,

Please quote your source and try to more clear while posting, so ranchers can help you in better way
 
nisha chidella
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i don't know how to post this..my code is not displaying.

i have
1. <c:url value='/inputComment.jsp' />
and
2.<c:url value='/inputComment.jsp' var='inputURL' />

as value for href.

the first link works while the second doesn't.In the second the request doesn't go to inputComment.jsp when i click on the link. var is just an attribute of <c:url>, so why would it make any difference ? when i view the source code from the browser, i see href=""(empty string) for the second option.hope i am clear.

Source is: page 455 in my HFSJ(topic:<c:url> for all your hyperlink needs)
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure,
But just try to invoke the "var" attrubute with the "scope" attribute set. I hope inputComment.jsp belongs to the same context.
 
nisha chidella
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

just try to invoke the "var" attribute with the "scope" attribute set.



that makes no difference.still doesn't work.


I hope inputComment.jsp belongs to the same context.


yup. it belongs to same application. I mentioned that the first option works.
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you find the solution??
 
nisha chidella
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nope.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


1. <c:url value='/inputComment.jsp' />
and
2.<c:url value='/inputComment.jsp' var='inputURL' />


If 'var' is used with value attribute , it assigns the 'value' to the 'var' attribute , where as when 'value' attribute is used alone, it writes to HTML . and thats why you see "" when var is used and "/inputComment.jsp'", when 'value' alone is used. HTH.

 
nisha chidella
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so, we do href="${inputURL}" when we use the var attribute in this example.
thanks it helped.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup you got it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic