Re: href
Michael Burke wrote: I've got a jsp page that iterates through a list of web links, I can t figure out how to use just the link without it being appended to http://localhost... Here's the page in question: %@ taglib uri=/bean prefix=bean % %@ taglib uri=/html prefix=html % %@ taglib uri=/logic prefix=logic % %@ taglib uri=/template prefix=template % br/ html:errors/ br/ table cellpadding=2 width=80% tr td /td td bCategories/b /td /tr logic:iterate name=allLinksList id=links scope=request type=linkapp.entity.Links tr td a href='bean:write name=links property=url/' bean:write name=links property=url//a /td /tr /logic:iterate /table - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] I thought this was an easy question, as I said in my first post when I iterate and print a list of hyperlinks the link gets appended to the link of my webapp (http://localhost:8080/linkapp) instead of just being an independant link. any suggestions would be appreciated. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: href
Michael Burke wrote: I've got a jsp page that iterates through a list of web links, I can t figure out how to use just the link without it being appended to http://localhost... Here's the page in question: %@ taglib uri=/bean prefix=bean % %@ taglib uri=/html prefix=html % %@ taglib uri=/logic prefix=logic % %@ taglib uri=/template prefix=template % br/ html:errors/ br/ table cellpadding=2 width=80% tr td /td td bCategories/b /td /tr logic:iterate name=allLinksList id=links scope=request type=linkapp.entity.Links tr td a href='bean:write name=links property=url/' bean:write name=links property=url//a /td /tr /logic:iterate /table - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Sorry for the questions, I realized if I didn't enter a correct address (http://www...) it gets appended to my webapp address. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: href
bean:write name=links property=url//a bean:write only print your bean property value in JSP outputStream. You should look at data type used for your url property, and it's toString() method. Nico. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [href to perform an action]
Responses below... Cindy Horn at SF x4874 [EMAIL PROTECTED] wrote: I have a jsp with a list of shipment data where hrefs are defined on the equipment keys. I would like the client to click on the link to drill down from the list to a detailed jsp. If I do the following: a href=/vcsc/shipmentTracking.do?equipmentNumber=MATU33445 I get a 404 url not found. How do I get the link to go to the shipmentTracking Action? Do I need to create a form on the jsp and use the onClick javascript to set the action of the form? First, that should technically work, assuming that that is the correct relative path to the action. Make sure you have the correct path being defined. (As a hint, when you click the link and get a 404, look at what is in the address bar at that point. I have found that the webapp base is usually lost if you do an HREF such as this.) Second, though, I would recommend using the html:link tag for things such as this. Used in conjunction with global-forwards for your actions, this relieves you of having to worry about keeping the web-app base, and it also gives a lot of flexibility with the creation of the queryString. Examples are in the users guide, though I would be happy to provide you with some more, if you need. -josh -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: href to perform an action
No, if #1 is your application name (i.e. you deployed vcsc.war) and #2 is correctly defined in your struts-config, then all should be fine (btw. case matters) a href=/vcsc/shipmentTracking.do?equipmentNumber=MATU33445 #1#2 James Mitchell Software Engineer/Struts Evangelist http://www.open-tools.org Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. - Albert Einstein (1879-1955) -Original Message- From: Cindy Horn at SF x4874 [mailto:CHorn;matson.com] Sent: Wednesday, October 30, 2002 12:58 PM To: Struts (E-mail) Subject: href to perform an action I have a jsp with a list of shipment data where hrefs are defined on the equipment keys. I would like the client to click on the link to drill down from the list to a detailed jsp. If I do the following: a href=/vcsc/shipmentTracking.do?equipmentNumber=MATU33445 I get a 404 url not found. How do I get the link to go to the shipmentTracking Action? Do I need to create a form on the jsp and use the onClick javascript to set the action of the form? Thanks in advance, Cindy -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: href to perform an action
I've tried the html:link tag and I get a 500: 10.3.5.43 - - [30/Oct/2002:12:05:42 -0800] GET /vcsc/shipmentTracking.do?equipmentNumber=MATU334466 HTTP/1.1 500 53 This is the tag I'm using: html:link href=/vcsc/shipmentTracking.do paramId=equipmentNumber paramName=container paramProperty=equipmentNumber bean:write name=container property=equipmentNumber//html:link I have debugging lines in my Action class and those are not getting invoked. Does the action class not accept a GET? -Original Message- From: Penubothu, Rajani [mailto:rpenubothu;epocrates.com] Sent: Wednesday, October 30, 2002 10:17 AM To: '[EMAIL PROTECTED]' Subject: Re: href to perform an action You might want to checkout html:link/ tag. Using that tag, you need to use attributes page=/vcsc/shipmentTracking.do. You can even pass parameters using other attributes like paramProperty,paramId and paramName etc Thanks,Rajani. Cindy Horn at SF x4874 [EMAIL PROTECTED] wrote in message news:769F76EB4C93D31192850008C7B98C1106097180@mnc03p2e... I have a jsp with a list of shipment data where hrefs are defined on the equipment keys. I would like the client to click on the link to drill down from the list to a detailed jsp. If I do the following: a href=/vcsc/shipmentTracking.do?equipmentNumber=MATU33445 I get a 404 url not found. How do I get the link to go to the shipmentTracking Action? Do I need to create a form on the jsp and use the onClick javascript to set the action of the form? Thanks in advance, Cindy -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: href to perform an action
Then why would this not work? The first line I have in my perform method is a debug line and this is not showing up. It's behaving as though it can not find the action class. Here is my definition in the config file: action path=/shipmentTracking type=com.matson.shipment.web.ShipmentTrackingAction name=shipmentTrackingForm scope=session -Original Message- From: David Graham [mailto:dgraham1980;hotmail.com] Sent: Wednesday, October 30, 2002 12:46 PM To: [EMAIL PROTECTED] Subject: RE: href to perform an action Actions do accept GET requests. From: Cindy Horn at SF x4874 [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts (E-mail) [EMAIL PROTECTED] Subject: RE: href to perform an action Date: Wed, 30 Oct 2002 12:25:32 -0800 I've tried the html:link tag and I get a 500: 10.3.5.43 - - [30/Oct/2002:12:05:42 -0800] GET /vcsc/shipmentTracking.do?equipmentNumber=MATU334466 HTTP/1.1 500 53 This is the tag I'm using: html:link href=/vcsc/shipmentTracking.do paramId=equipmentNumber paramName=container paramProperty=equipmentNumber bean:write name=container property=equipmentNumber//html:link I have debugging lines in my Action class and those are not getting invoked. Does the action class not accept a GET? -Original Message- From: Penubothu, Rajani [mailto:rpenubothu;epocrates.com] Sent: Wednesday, October 30, 2002 10:17 AM To: '[EMAIL PROTECTED]' Subject: Re: href to perform an action You might want to checkout html:link/ tag. Using that tag, you need to use attributes page=/vcsc/shipmentTracking.do. You can even pass parameters using other attributes like paramProperty,paramId and paramName etc Thanks,Rajani. Cindy Horn at SF x4874 [EMAIL PROTECTED] wrote in message news:769F76EB4C93D31192850008C7B98C1106097180@mnc03p2e... I have a jsp with a list of shipment data where hrefs are defined on the equipment keys. I would like the client to click on the link to drill down from the list to a detailed jsp. If I do the following: a href=/vcsc/shipmentTracking.do?equipmentNumber=MATU33445 I get a 404 url not found. How do I get the link to go to the shipmentTracking Action? Do I need to create a form on the jsp and use the onClick javascript to set the action of the form? Thanks in advance, Cindy -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org _ Surf the Web without missing calls! Get MSN Broadband. http://resourcecenter.msn.com/access/plans/freeactivation.asp -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: href to perform an action
500 is an internal server error. Can you check your log files and try to find more detail or even a stack trace? James Mitchell Software Engineer/Struts Evangelist http://www.open-tools.org Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. - Albert Einstein (1879-1955) -Original Message- From: Cindy Horn at SF x4874 [mailto:CHorn;matson.com] Sent: Wednesday, October 30, 2002 5:15 PM To: 'Struts Users Mailing List' Subject: RE: href to perform an action Then why would this not work? The first line I have in my perform method is a debug line and this is not showing up. It's behaving as though it can not find the action class. Here is my definition in the config file: action path=/shipmentTracking type=com.matson.shipment.web.ShipmentTrackingAction name=shipmentTrackingForm scope=session -Original Message- From: David Graham [mailto:dgraham1980;hotmail.com] Sent: Wednesday, October 30, 2002 12:46 PM To: [EMAIL PROTECTED] Subject: RE: href to perform an action Actions do accept GET requests. From: Cindy Horn at SF x4874 [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts (E-mail) [EMAIL PROTECTED] Subject: RE: href to perform an action Date: Wed, 30 Oct 2002 12:25:32 -0800 I've tried the html:link tag and I get a 500: 10.3.5.43 - - [30/Oct/2002:12:05:42 -0800] GET /vcsc/shipmentTracking.do?equipmentNumber=MATU334466 HTTP/1.1 500 53 This is the tag I'm using: html:link href=/vcsc/shipmentTracking.do paramId=equipmentNumber paramName=container paramProperty=equipmentNumber bean:write name=container property=equipmentNumber//html:link I have debugging lines in my Action class and those are not getting invoked. Does the action class not accept a GET? -Original Message- From: Penubothu, Rajani [mailto:rpenubothu;epocrates.com] Sent: Wednesday, October 30, 2002 10:17 AM To: '[EMAIL PROTECTED]' Subject: Re: href to perform an action You might want to checkout html:link/ tag. Using that tag, you need to use attributes page=/vcsc/shipmentTracking.do. You can even pass parameters using other attributes like paramProperty,paramId and paramName etc Thanks,Rajani. Cindy Horn at SF x4874 [EMAIL PROTECTED] wrote in message news:769F76EB4C93D31192850008C7B98C1106097180@mnc03p2e... I have a jsp with a list of shipment data where hrefs are defined on the equipment keys. I would like the client to click on the link to drill down from the list to a detailed jsp. If I do the following: a href=/vcsc/shipmentTracking.do?equipmentNumber=MATU33445 I get a 404 url not found. How do I get the link to go to the shipmentTracking Action? Do I need to create a form on the jsp and use the onClick javascript to set the action of the form? Thanks in advance, Cindy -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org _ Surf the Web without missing calls! Get MSN Broadband. http://resourcecenter.msn.com/access/plans/freeactivation.asp -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: href to perform an action
The generated link must look like: a href=/context/shipmentTracking.do?param1=value1link/a If you have that link and it still doesn't work, it's likely to be your Action class. Try substituting your action for the struts ForwardAction and see what happens. David From: Cindy Horn at SF x4874 [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: href to perform an action Date: Wed, 30 Oct 2002 14:15:06 -0800 Then why would this not work? The first line I have in my perform method is a debug line and this is not showing up. It's behaving as though it can not find the action class. Here is my definition in the config file: action path=/shipmentTracking type=com.matson.shipment.web.ShipmentTrackingAction name=shipmentTrackingForm scope=session -Original Message- From: David Graham [mailto:dgraham1980;hotmail.com] Sent: Wednesday, October 30, 2002 12:46 PM To: [EMAIL PROTECTED] Subject: RE: href to perform an action Actions do accept GET requests. From: Cindy Horn at SF x4874 [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts (E-mail) [EMAIL PROTECTED] Subject: RE: href to perform an action Date: Wed, 30 Oct 2002 12:25:32 -0800 I've tried the html:link tag and I get a 500: 10.3.5.43 - - [30/Oct/2002:12:05:42 -0800] GET /vcsc/shipmentTracking.do?equipmentNumber=MATU334466 HTTP/1.1 500 53 This is the tag I'm using: html:link href=/vcsc/shipmentTracking.do paramId=equipmentNumber paramName=container paramProperty=equipmentNumber bean:write name=container property=equipmentNumber//html:link I have debugging lines in my Action class and those are not getting invoked. Does the action class not accept a GET? -Original Message- From: Penubothu, Rajani [mailto:rpenubothu;epocrates.com] Sent: Wednesday, October 30, 2002 10:17 AM To: '[EMAIL PROTECTED]' Subject: Re: href to perform an action You might want to checkout html:link/ tag. Using that tag, you need to use attributes page=/vcsc/shipmentTracking.do. You can even pass parameters using other attributes like paramProperty,paramId and paramName etc Thanks,Rajani. Cindy Horn at SF x4874 [EMAIL PROTECTED] wrote in message news:769F76EB4C93D31192850008C7B98C1106097180@mnc03p2e... I have a jsp with a list of shipment data where hrefs are defined on the equipment keys. I would like the client to click on the link to drill down from the list to a detailed jsp. If I do the following: a href=/vcsc/shipmentTracking.do?equipmentNumber=MATU33445 I get a 404 url not found. How do I get the link to go to the shipmentTracking Action? Do I need to create a form on the jsp and use the onClick javascript to set the action of the form? Thanks in advance, Cindy -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org _ Surf the Web without missing calls! Get MSN Broadband. http://resourcecenter.msn.com/access/plans/freeactivation.asp -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org _ Unlimited Internet access -- and 2 months free! Try MSN. http://resourcecenter.msn.com/access/plans/2monthsfree.asp -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: href to perform an action
you have to add an input attribute to your action definition that points to the jsp that has your form on it. Struts needs to know where to forward to when there are errors. Validation is done in the ActionForm.validate() method. See the users guide for details. David From: Cindy Horn at SF x4874 [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: href to perform an action Date: Wed, 30 Oct 2002 15:25:23 -0800 This is the error I have in the log: [WebAppServletContext(852414,vcsc,/vcsc)] action: No input form, but validation returned errors Where is this validation taking place? -Original Message- From: James Mitchell [mailto:jmitchtx;telocity.com] Sent: Wednesday, October 30, 2002 2:24 PM To: Struts Users Mailing List Subject: RE: href to perform an action 500 is an internal server error. Can you check your log files and try to find more detail or even a stack trace? James Mitchell Software Engineer/Struts Evangelist http://www.open-tools.org Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. - Albert Einstein (1879-1955) -Original Message- From: Cindy Horn at SF x4874 [mailto:CHorn;matson.com] Sent: Wednesday, October 30, 2002 5:15 PM To: 'Struts Users Mailing List' Subject: RE: href to perform an action Then why would this not work? The first line I have in my perform method is a debug line and this is not showing up. It's behaving as though it can not find the action class. Here is my definition in the config file: action path=/shipmentTracking type=com.matson.shipment.web.ShipmentTrackingAction name=shipmentTrackingForm scope=session -Original Message- From: David Graham [mailto:dgraham1980;hotmail.com] Sent: Wednesday, October 30, 2002 12:46 PM To: [EMAIL PROTECTED] Subject: RE: href to perform an action Actions do accept GET requests. From: Cindy Horn at SF x4874 [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts (E-mail) [EMAIL PROTECTED] Subject: RE: href to perform an action Date: Wed, 30 Oct 2002 12:25:32 -0800 I've tried the html:link tag and I get a 500: 10.3.5.43 - - [30/Oct/2002:12:05:42 -0800] GET /vcsc/shipmentTracking.do?equipmentNumber=MATU334466 HTTP/1.1 500 53 This is the tag I'm using: html:link href=/vcsc/shipmentTracking.do paramId=equipmentNumber paramName=container paramProperty=equipmentNumber bean:write name=container property=equipmentNumber//html:link I have debugging lines in my Action class and those are not getting invoked. Does the action class not accept a GET? -Original Message- From: Penubothu, Rajani [mailto:rpenubothu;epocrates.com] Sent: Wednesday, October 30, 2002 10:17 AM To: '[EMAIL PROTECTED]' Subject: Re: href to perform an action You might want to checkout html:link/ tag. Using that tag, you need to use attributes page=/vcsc/shipmentTracking.do. You can even pass parameters using other attributes like paramProperty,paramId and paramName etc Thanks,Rajani. Cindy Horn at SF x4874 [EMAIL PROTECTED] wrote in message news:769F76EB4C93D31192850008C7B98C1106097180@mnc03p2e... I have a jsp with a list of shipment data where hrefs are defined on the equipment keys. I would like the client to click on the link to drill down from the list to a detailed jsp. If I do the following: a href=/vcsc/shipmentTracking.do?equipmentNumber=MATU33445 I get a 404 url not found. How do I get the link to go to the shipmentTracking Action? Do I need to create a form on the jsp and use the onClick javascript to set the action of the form? Thanks in advance, Cindy -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org _ Surf the Web without missing calls! Get MSN Broadband. http://resourcecenter.msn.com/access/plans/freeactivation.asp -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: HREF issue
I've used the following style and it's worked could probably streamline it a bit with a custom tag or something: SCRIPT language=JavaScript function openWindow() { window.open( , CreateNew, height=500,width=550,resizable=1,scrollbars=1 ); } /SCRIPT html:link page=LoadObject.do?parent=trueaction=Edittype=%= newType %accNum=%= accField.value% target=CreateNew onclick=openWindow(); bean:message key=whatever.the.link.name.is/ /html:link _\|/___ generation-d development andrew b forman -Original Message- From: Sidhartha Jain [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 24, 2002 8:52 AM To: [EMAIL PROTECTED] Subject: HREF issue Hi I am waiting for the solution for my problem for someone and seems no one is responding to it.I dunno know why this is happening.I would highly appreciate if someone could help me solve my problem. here i am stating my problem once again. I am having an issue with html:link tag of struts. I think I don't know how to use it. Actually I have a java script fucntion which looks like this function launchEdit(field, accField, relation, newType) { currentField = document.editForm.field; currentAccField = document.editForm.accField; isRelation = relation; var url = 'LoadObject.do?parent=trueaction=Edittype='+newType+'accNum='+a ccField.value; window.open(url,'CreateNew','height=500,width=550,resizable=1,scro llbars=1'); } And it needs to be called by passing the parameters that would also be dynamic for me (which will change everytime we call it.) Can Someone throw some light on this issue as to how we achieve this functionality . I would be highly thankful to you. Thanks in Advance Sidhartha -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: HREF link question - oops!
Sorry about the last message. It didn't work due to a spelling mistake on my part. The html:link tag seems to work as expected. Thanks again, Rick At 02:18 PM 6/14/01 -0700, you wrote: Hi Craig, Thanks for your response. Unfortunately, it still doesn't work. I tried two different approaches: with the html:base/ tag and without it, and I get the same result in both cases: I code the following link: html:link page=/jsp/prodinfo/prodinfo.jspIntroduction/html:link The html source (in the browser, Netscape 4.6.1 or IE 4.72) shows: When I use the html:base/ tag: base href=http://localhost:8080/backup/jsp/prodinfo/prod-info.jsp; in the HTML head section, and The link is generated as: a href=/backup/jsp/prodinfo/prodinfo.jspIntroduction/aas the href link When I mouse over the link in the browser, the status line at the bottom of the browser window displays: http://localhost:8080/backup/jsp/prodinfo/prod-info.jsp When I click the link, I get the following in the browser window: Not Found (404) Original request: /backup/jsp/prodinfo/prodinfo.jsp Not found request: /backup/jsp/prodinfo/prodinfo.jsp Am I doing something wrong? Must be, since you use this approach all the time. Thanks again for your help. It is greatly appreciated. Rick Horowitz At 09:59 AM 6/14/01 -0700, you wrote: On Wed, 13 Jun 2001, Rick Horowitz wrote: Hi, I'm trying to use href links with Struts templates, and can't figure out how to make my href links work properly. [Templates seem to work just fine, otherwise.]... my compliments. 1. I want to use Struts html:link tags so that to automatically do URL session encoding. Struts does this automatically for you. 2. I want to use absolute URLs to make coding of urls more robust. For example, if I have a directory structure of JSPs: jsp jsp/prodinfo jsp/faq ...I want to be able to code the url something like... jsp/faq/faq1.jsp or jsp/prodinfo/info1.jsp, in case I change the directory structure, rather than using relative links, e.g. ../faq/faq1.jsp. I have found it best to use context-relative URLs starting with a / character throughout my applications, rather than trying to use relative links -- for the reasons that you are probably familiar with. To do that for links, use the page attribute to specify the destination -- Struts will prepend the context path of the current application for you, so that the browser always goes the right place. For example, you might code: html:link page=/jsp/faq/faq1.jspTo the FAQ/html:link 3. For the portion of the website that I'm currently working on, I am creating href links from one JSP to other JSPs. [For other portions of the website, I will be using an MVC architecture, hence forwarding from a servlet to a JSP and vice versa.] It works either way, but remember that links directly from one page to another bypasses the controller -- and therefore bypasses the stuff that the controller servlet does for you. 4. I have tried various approaches to using the html:base/ tag in the HTML HEAD section of my Struts template file, not using a base tag, and have tried using the following to set the html base: BASE HREF=%= http://; +request.getServerName() +: +request.getServerPort() +request.getContextPath() %/ Although the latter works with regular a href tags, it does not seem to work with html:link Struts tags. See the html:base/ tag for a way to do this automatically. However, whether you create it yourself or not, the base element affects only relative hyperlinks. If you follow my suggestion above (always use context-relative links), you won't need it. I have tried a variety of combinations of these base tags with a variety of combinations of url encodings, but cannot seem to get them to work -- except with regular a href tags using the BASE HREF=%= http://; +request.getServerName() +: +request.getServerPort() +request.getContextPath() %/ base tag setting. Thank you in advance to anyone who can help, Rick Horowitz Craig Rick Horowitz Rick Horowitz
Re: HREF link question
On Wed, 13 Jun 2001, Rick Horowitz wrote: Hi, I'm trying to use href links with Struts templates, and can't figure out how to make my href links work properly. [Templates seem to work just fine, otherwise.]... my compliments. 1. I want to use Struts html:link tags so that to automatically do URL session encoding. Struts does this automatically for you. 2. I want to use absolute URLs to make coding of urls more robust. For example, if I have a directory structure of JSPs: jsp jsp/prodinfo jsp/faq ...I want to be able to code the url something like... jsp/faq/faq1.jsp or jsp/prodinfo/info1.jsp, in case I change the directory structure, rather than using relative links, e.g. ../faq/faq1.jsp. I have found it best to use context-relative URLs starting with a / character throughout my applications, rather than trying to use relative links -- for the reasons that you are probably familiar with. To do that for links, use the page attribute to specify the destination -- Struts will prepend the context path of the current application for you, so that the browser always goes the right place. For example, you might code: html:link page=/jsp/faq/faq1.jspTo the FAQ/html:link 3. For the portion of the website that I'm currently working on, I am creating href links from one JSP to other JSPs. [For other portions of the website, I will be using an MVC architecture, hence forwarding from a servlet to a JSP and vice versa.] It works either way, but remember that links directly from one page to another bypasses the controller -- and therefore bypasses the stuff that the controller servlet does for you. 4. I have tried various approaches to using the html:base/ tag in the HTML HEAD section of my Struts template file, not using a base tag, and have tried using the following to set the html base: BASE HREF=%= http://; +request.getServerName() +: +request.getServerPort() +request.getContextPath() %/ Although the latter works with regular a href tags, it does not seem to work with html:link Struts tags. See the html:base/ tag for a way to do this automatically. However, whether you create it yourself or not, the base element affects only relative hyperlinks. If you follow my suggestion above (always use context-relative links), you won't need it. I have tried a variety of combinations of these base tags with a variety of combinations of url encodings, but cannot seem to get them to work -- except with regular a href tags using the BASE HREF=%= http://; +request.getServerName() +: +request.getServerPort() +request.getContextPath() %/ base tag setting. Thank you in advance to anyone who can help, Rick Horowitz Craig
Re: HREF link question
Hi Craig, Thanks for your response. Unfortunately, it still doesn't work. I tried two different approaches: with the html:base/ tag and without it, and I get the same result in both cases: I code the following link: html:link page=/jsp/prodinfo/prodinfo.jspIntroduction/html:link The html source (in the browser, Netscape 4.6.1 or IE 4.72) shows: When I use the html:base/ tag: base href=http://localhost:8080/backup/jsp/prodinfo/prod-info.jsp; in the HTML head section, and The link is generated as: a href=/backup/jsp/prodinfo/prodinfo.jspIntroduction/aas the href link When I mouse over the link in the browser, the status line at the bottom of the browser window displays: http://localhost:8080/backup/jsp/prodinfo/prod-info.jsp When I click the link, I get the following in the browser window: Not Found (404) Original request: /backup/jsp/prodinfo/prodinfo.jsp Not found request: /backup/jsp/prodinfo/prodinfo.jsp Am I doing something wrong? Must be, since you use this approach all the time. Thanks again for your help. It is greatly appreciated. Rick Horowitz At 09:59 AM 6/14/01 -0700, you wrote: On Wed, 13 Jun 2001, Rick Horowitz wrote: Hi, I'm trying to use href links with Struts templates, and can't figure out how to make my href links work properly. [Templates seem to work just fine, otherwise.]... my compliments. 1. I want to use Struts html:link tags so that to automatically do URL session encoding. Struts does this automatically for you. 2. I want to use absolute URLs to make coding of urls more robust. For example, if I have a directory structure of JSPs: jsp jsp/prodinfo jsp/faq ...I want to be able to code the url something like... jsp/faq/faq1.jsp or jsp/prodinfo/info1.jsp, in case I change the directory structure, rather than using relative links, e.g. ../faq/faq1.jsp. I have found it best to use context-relative URLs starting with a / character throughout my applications, rather than trying to use relative links -- for the reasons that you are probably familiar with. To do that for links, use the page attribute to specify the destination -- Struts will prepend the context path of the current application for you, so that the browser always goes the right place. For example, you might code: html:link page=/jsp/faq/faq1.jspTo the FAQ/html:link 3. For the portion of the website that I'm currently working on, I am creating href links from one JSP to other JSPs. [For other portions of the website, I will be using an MVC architecture, hence forwarding from a servlet to a JSP and vice versa.] It works either way, but remember that links directly from one page to another bypasses the controller -- and therefore bypasses the stuff that the controller servlet does for you. 4. I have tried various approaches to using the html:base/ tag in the HTML HEAD section of my Struts template file, not using a base tag, and have tried using the following to set the html base: BASE HREF=%= http://; +request.getServerName() +: +request.getServerPort() +request.getContextPath() %/ Although the latter works with regular a href tags, it does not seem to work with html:link Struts tags. See the html:base/ tag for a way to do this automatically. However, whether you create it yourself or not, the base element affects only relative hyperlinks. If you follow my suggestion above (always use context-relative links), you won't need it. I have tried a variety of combinations of these base tags with a variety of combinations of url encodings, but cannot seem to get them to work -- except with regular a href tags using the BASE HREF=%= http://; +request.getServerName() +: +request.getServerPort() +request.getContextPath() %/ base tag setting. Thank you in advance to anyone who can help, Rick Horowitz Craig Rick Horowitz