Web.xml - can't get the url from xml file..
Hi all,
Im a beginner @ jsp =)
My question is as follow..I cant get base from the web.xml file.
This is a shorten version of my web.xml..
<web-app>
<welcome-file-list>
<welcome-file>Default.jsp</welcome-file>
</welcome-file-list>
<!-- Define the controller servlet -->
<servlet>
<servlet-name>ControllerServlet</servlet-name>
<servlet-class>ControllerServlet</servlet-class>
<!-- Define initial parameters that will be loaded into
the ServletContext object in the controller servlet -->
<init-param>
<param-name>base</param-name>
<param-value>http://localhost:8080/burnaby/ControllerServlet</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>ControllerServlet</servlet-name>
<url-pattern>/ControllerServlet</url-pattern>
</servlet-mapping>
</web-app>
And my jsp file:
<%
String base = (String) application.getAttribute("base");
String imageUrl = (String) application.getAttribute("imageUrl");
%>
<table width="740" cellpading="0" height="75" cellspacing="0" border="0">
<tr>
<td align="left" bgcolor="#F6F6F6">
<font face="Verdana" size="3">Sky's E-mall!</font>
</td>
<td align="right" bgcolor="#F6F6F6">
<a href="<%=base%>?action=displayShoppingCart"><img border="0" src="<%=(imageUrl + "cart.gif" )%>"></a>
���
</td>
</tr>
</table>
I have written it of a book im reading and i cant get it to work. Base and imageUrl always become null.
thank you
/Robert
I'm a little new to JSPs and servlets too, but I'll give this one a shot. I think since your variables like 'base' are servlet initial parameters, they don't get initialized until you actually call the servlet ( I'm not 100% on this, though). Try calling the servlet and having it forward the response back to your original JSP and see if you get values then.
Similar Messages
-
Why I can't get the cookie from this web site when I can get it from google
public static void main(String[] args) throws Exception {
// I can get the cookie from "http://www.baidu.com"
// String domain1 = "http://www.baidu.com/";
// String domain2 = "www.baidu.com";
// I can get the cookie from "http://www.google.com"
// String domain1 = "http://www.google.com/";
// String domain2 = "www.google.com";
// I can not get the cookie from "http://www.csdn.net"
String domain1 = "http://www.csdn.net/";
String domain2 = "www.csdn.net";
URL url = new URL(domain1);
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestProperty("User-Agent", "Internet Explorer");
httpConn.setRequestProperty("Host", domain2);
httpConn.connect();
String cookie = httpConn.getHeaderField("Set-Cookie");
System.out.println(cookie);
My question is: How can I get the cookie from the web site:http://www.csdn.net?I found it in my computer , the location is: C:\Documents and Settings\zhijun\Cookies\zhijun@csdn[2].txt
and there are many characters, they are:
__utma
17226283.1339458738.1221633513.1223535733.1223539291.58
csdn.net/
1600
786595712
30107528
1029600608
29960677
__utmz
17226283.1223539291.58.57.utmccn=(organic)|utmcsr=baidu|utmctr=VB.NET%B2%BB%C4%DC+%B6%CF%B5%E3|utmcmd=organic
csdn.net/
1600
4189609856
29997389
1029910608
29960677
LastVisitedForum
b7e466c6-291a-4072-acee-15d2be78c647*b5f1380c-f04c-4682-861a-54357b14186a*0a4a010e-8694-4139-b91f-a4ee1374981b*caa7532e-956b-4661-a53f-d46e3f1a8187*8b327318-2c42-4a49-8aed-ef8c33697e7f
csdn.net/
1536
2105548800
29964700
960690608
29960677
userid
2018946
csdn.net/
1536
1900813440
29963485
771368976
29960669
__utmb
17226283
csdn.net/
1600
1849111424
29960681
1029760608
29960677
ABCDEF
X1rZPCiZupWekhlTu78xWhr2Oj5GmFwk0J%252b8COfIv7IvVh2PgEPu2V7ooeZuUnene2j%252fDKJsNnZWYBSQxVkTfunvGq%252fDYuzFALM0ugLUmppZAHgfUWgQ%252bziPRLLJyFdzUpHwfG%252fReU8SfFy588HH02NPWPsO8RjgtHym%252bcJdUOnIH5J%252bkPEj%252b%252bZwlSPb5u0M0mPQRU1gOScfY4b981MifF4ksep8sZp1Ro2ofGHIg6l%252bgJ0P0XFASz2cJU8Objo%252f
csdn.net/
1536
1900813440
29963485
770898976
29960669
QWERTOP
6695
csdn.net/
1536
1900813440
29963485
771058976
29960669
activeUserName
boxiuzhen
csdn.net/
1536
1900813440
29963485
771058976
29960669
UserName
boxiuzhen
csdn.net/
1536
1900813440
29963485
771058976
29960669
PName
542a00960558bf1690fe08696d1245f407130025d59bd14ad6430f
csdn.net/
1536
1900813440
29963485
771368976
29960669
Is this prove that the csdn web site which I can not get the cookie is not using url-rewriting? -
How Can we get the data from Non-SAP to SAP in WebDynpro
Hi,
I hope u understand my query, How can we get the data from Non-SAP to SAP thru WebDynpro Programming.
Help out with the steps for getting the data or procedure.
Regards,
MutyapuYou can expose the APIs in the Non-SAP backend as Web Services, and consume them in SAP by creating an Enterprise Proxy. Then these can be called just like normal class methods from Web Dynpro.
Regards,
Nithya -
How Can i get the URL of a page
How Can i get the URL of a page . like in ASP the
Request.QueryString() ...
ThanksAre you wanting actual URL or just the url (query string
variables)?
For url variables you would reference the structure.variable
name like so:
#url.variablename#
So if you had a url like this:
http://www.somedomain.com?page=home&action=view
You could access the variables like so:
#url.page#
#url.action#
If you are wanting to actual page you could use:
#cgi.script_name#
Bryan Ashcraft (remove brain to reply)
Web Application Developer
Wright Medical Technologies, Inc.
=============================
Macromedia Certified Dreamweaver Developer
Adobe Community Expert (DW) ::
http://www.adobe.com/communities/experts/
"Yasmin_lady" <[email protected]> wrote in
message
news:e4fhjv$fpl$[email protected]..
> How Can i get the URL of a page . like in ASP the
Request.QueryString()
> ...
> Thanks -
Is it possible to get the URL from which user came to Apex Application?
Hi,
I have 1 web site which is created by Apex. And I have to create similar sites with slight differences. For example, even though the contents are almost same, each telephone # have to be modified.
So, if possible, I want to use only 1 web site and depending on the URL from which user came, change some information on the page. Is it possible?
And if it is possible, what if the user set Apex URL as favorite and visit it after some days?Thank you Scott,
This is the one.
But I have another issue.
If a user comes to our page from their link directly, I can identify where he come from. But if he added our site to Bookmark and comes to our site through the link, is it possible to identify his original route?
If it is impossible, I will create other Apex Application and put each URL to the link in order to catch where the user is from. -
How can i get thes songs from ipod nano to the itunes libary??
hi
i have ipod nano and i sync it with over 500 songs .....my bad i lose all that songs on my libary .... how can i get thes songs from ipod nano to the itunes libary??See this older post from another forum member Zevoneer on different ways to copy content from your iPod to your computer.
https://discussions.apple.com/thread/2452022?start=0&tstart=0
B-rock -
I want to develop a software with AirPaly service for business things. How can I get the permission from Apple?
This one is used in Windows laptop, and I want it support AirPlay service, but Apple doesn't publish the AirPlay protocol.
Many thanks.Create a developer account, then access he developers forums and see if you can find the information that way
The other option would be to simply contact Apple directly. -
My wife has an I Tunes account on our PC, I have an I tune account on my Mac Book Pro. How can I get the music from her account on the PC to my account on the Mac Book and I phone?
IflyDavie wrote:
I need help to delete my icloud account from my iPad. It has "Find my iPad" on it and won't let me delete without the old password. I don't want to reset password as it will require reset of Mac Book Pro and 2 iphones. Help appreciated.
Your description of the problem is a bit confusing. Do you have ONLY ONE Apple ID or do you have MORE THAN ONE? -
Can anyone let me know how can i get the ouput from BW in .txt format.
Can anyone let me know how can i get the ouput from BW in .txt format. See we can get output as Excel(i.e BEX) and manually convert it into txt format. I need a direct or automated way to do the same.no human intervention.
mail me at [email protected] or post answer in sdn.Please do not multiple post across forums..
how can i save the data in BEX reports in .txt format automatically
This helps in keeping track of answers and avoids the issue of repeated answers across forums...
Please close one of the threads as answered and provide the link that you want to follow
Arun -
How can I get the events from a java program?
I want to make a monitor to watch a java program.How can I get the events from the GUI of this program some as mouse cliking, keyinput. So I can watch these in my monitor.
ThanksHi,
To put a monitor to the events occuring in the GHUI u need to register required components with the appropriate EventListeners.
Liek if u want to get notified when a mouse is clicked, then u need to add The MouseListener to the component which u want to be monitored.
Say
myFrame which is the JFrame object which shuld be monitored for the events.
Then in ur program u have to add following code
myFrame.addMouseListener( someObectReference );
Here the someObjectReference should be an instance to a concrete class ..i.e. U write a class like the following
public class MyMouseListener implements MouseListener {
// override the followig methods
public void mouseClicked(MouseEvent me){ sop("MOUSE CLICKED ON THE FRAME");}
public void mousePressed(MouseEvent me){}
public void mouseReleased(MouseEvent me){}
If u dont want to use another class for listening to the events. Then u can make teh current class monitor the events. To do so ur class should implement the appropriate listener and should override the required methods.
and u should say myFrame.addMouseListenet( this );
thats it -
If i got an iphone 5 and synced it with my computer,
can i get the contract from my iphone 4 to a iphone 5 without upgrading the contract?
(So that i will still have the same contract) (I have verizon.)Ask Verizon.
You will have to activate the phone through them. -
my computer crashed and I no longer have the itunes library. i get an error msg that my iphone 3g is synced to another library - how can I get the info from the phone to the itunes library without losing everything? How do I delete old audiobooks from my iphone?
You can transfer itunes purchases: File>Devices>Transfer Purchases
The iphone is not a storage/backup device. The sync is one way - computer to iphone. The exception is itunes purchases.
It has always been very basic to always maintain a backup copy of your computer. Use your backup copy to put everything back. -
I have an old iPod Classic with 80 GB (I think) of space. I saved all my songs in an external hard drive, but the iTunes library resided in an old computer (no longer working). Can I get the library from my iPod and use it in my new computer (Windows)?
You might want to check your process for moving your iTunes music against this: http://support.apple.com/kb/HT4527.
-
Can I get the library from my Ipod touch next generation back to my PC?
Can I get the library from my Ipod touch next generation back to my PC?
My PC got a virus and I had to reinstall windows from scratch so I lost most of my music. I had a backup program that died in the middle of it so only half came back. the only place that I have all the songs is on the ipod. if I let it sinc it will loose the half that I do not have.
Any ideas on which direction I should go?If your iPod is set to update automatically you need to take care connecting to an empty iTunes. You can use a keyboard command to prevent your iPod auto-syncing with iTunes. While connecting the iPod to the computer on Windows with iTunes installed hold down the Shift + Ctrl keys together. This will stop the iPod from auto-syncing with iTunes and the iPod will appear in the source list. Wait until you are sure the iPod has mounted, and that it will not auto sync and then you can let the keys go. This may take between 20 to 30 seconds depending on your computer: iTunes - Keyboard Shortcuts for Windows
If at any point you get a message that your iPod is linked to another library and asking if you want to link to this one and replace all your songs etc, press "Cancel". Pressing "Erase and Sync" will irretrievably remove all the songs from your iPod.
If you only want to copy your purchases to the computer that can be done using iTunes, you'll find details in this article: Copying iTunes Store purchases from your iPod or iPhone to a computer
For everything else (including purchases) there are a number of third party utilities that you can use to retrieve the music files and playlists from your iPod Touch or iPhone. You'll find that they have varying degrees of functionality and some will transfer data (such as playcounts and ratings), movies, videos, photos, podcasts and games as well.
A selection of iPod/iPhone to iTunes utilities:
Senuti Mac Only (iPod Touch & iPhone compatible)
SharePod Windows Only (iPhone and iPod Touch compatible)
TuneJack Windows Only (iPhone and iPod Touch compatible)
iPodRip Mac & Windows (iPhone and iPod Touch compatible)
Music Rescue Mac & Windows (iPhone and iPod Touch compatible)
iPod Music Liberator Mac & Windows (iPhone and iPod Touch compatible)
iGadget Mac & Windows (iPhone and iPod Touch compatible)
iRepo Mac & Windows (iPhone and iPod Touch compatible)
iPod Access Mac & Windows (iPhone and iPod Touch compatible)
TouchCopy Mac & Windows (iPhone and iPod Touch compatible) -
Hello everybody out there.
Which way can I get the screensaver from Lion get back on Mountain Lion??
Thanks
malibu0978Thanks very much I have contacted them via this. Just hope they respond quickly- rather annoing! Greatly appreciated though
Maybe you are looking for
-
Error: 500 internal server error
Hi everyone, I'm using sharePoint online and I want to add a new button for log out. I added this in my <asp:Content ContentPlaceHolder> <a href="/_layouts/SignOut.aspx">Log out</a> but I got 500 error. why is that? thank you!
-
Calling web service from ABAP - version 4.6C
Hi, I would like to know how to call a web service from ABAP. Version is 4.6C. Any help would be greatly appreciated. Thank you, Rekha
-
Can't remove a default start up program from any .rar applications
As said in the title I am currently using windows vista and accidentally put a default application from my computer to start up any .rar files that I choose. Is there any way I could remove this and return it to the unknown third party application,
-
Cisco 5508 Wireless Controller in HA mode
Hello, is there a support of 1+1 mode (HA mode) at 5508 Controller? If yes Is there a HA bundle or do we have to order two identical 5508 controller ? Thanks for response. Richard
-
i transfer the jpg file but it shows no previwe available and the transfered file is always 8kb short //package ksm.mulitiserver; import java.io.*; import java.net.*; import java.sql.*; public class MultiServer private ServerSocket Server;