• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to use <c:import url=""> with expression.

 
Anand Gajjar
Ranch Hand
Posts: 31
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to change url dynamically in <c:import url="">
is it possible to change it via querystring in jsp page.?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, you can use an EL expression to specify the URL value.
 
Anand Gajjar
Ranch Hand
Posts: 31
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hay thanks for reply...can you give me one example for this....
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you tried? A small example: let's say that there was a scoped variable named fred available that contained the URL. We could write:
 
Anand Gajjar
Ranch Hand
Posts: 31
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir...actually i m to confused in this syntax.
it always give me some errors.
suppose i have one textfield in my jsp page. i want to display website home page when i write "http://www.coderaunch.com" in textfield. or using achor tag.
any idea....
thanks.....
 
Anand Gajjar
Ranch Hand
Posts: 31
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
netbeans give me error like "according to tld, attribute url does not accept any expressions."
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds like your app is misconfigured. Please check the JSP FAQ to make sure that your web.xml is declared correctly (using the Servlets XML schema rather than a DTD), and that you are using the correct URI for the JSTL.

If you have problems, post your web.xml and the TLD declarations in your JSP. Please use code tags when posting code (read UseCodeTags).
 
Anand Gajjar
Ranch Hand
Posts: 31
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok sir....i solved the above expression problem...
now how i get variable value from another page.
means it is possible to set "fred" variable value. using anchor tag ???
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How much do you know about the EL? You can use the EL to access the request parameters on the current URL. Check out the param built-in variable.
 
Anand Gajjar
Ranch Hand
Posts: 31
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
suppose i have one 1 jsp page in which i have one anchor tag like <a href="www.coderaunch.com">click here</a>
so is it possible to store this link name in some variable and open this link via <c:import url="${variable name}"/>
i want to do this only with c:import.
so any idea about this.........
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!