473,385 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Getting Property file values in welcome page of web application

madhoriya22
252 100+
Hi,
This is the code of the entrypage of my web application.
Expand|Select|Wrap|Line Numbers
  1. <%@page contentType="text/html"%>
  2. <%@page pageEncoding="UTF-8"%>
  3. <%@page import="com.spi.defecttracker.vo.PropertiesVO"%>
  4. <%@page session="true" %>
  5. <html>
  6. <head>
  7.     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  8.     <title>JSP Page</title>
  9. </head>
  10. <body>
  11. <%
  12. PropertiesVO urlProperty = (PropertiesVO)session.getAttribute("URLPropertiesList");
  13. System.out.println("host:\t"+urlProperty.getHost()+"\tPort:\t"+urlProperty.getPort());
  14. %>
  15. <form method="POST" action="http://<%=urlProperty.getHost()%>:<%=urlProperty.getPort()%>/DefectTracker/RequestHandler">
  16.     Click Here To Access Defect Tracker&nbsp;
  17.     <input type="submit" value="Start Defect Tracker" >
  18.     </p>
  19.     <input type="hidden" name="SCREEN_ID" value="0" />
  20. </form>
  21. </body>
  22. </html>
  23.  
  24.  
Previously this file was a .html file. But to change the url in all the files what I did ....... I am getting the url properties from the Properties file. Now this thing is working in all the jsp file except this welcome jsp file. It is throwing NullPointerException and host and port values are not coming.

I am setting the propertyVO object in session after execution of this entry page. How should I make it work.
Need ur help !
Sep 6 '07 #1
7 2198
r035198x
13,262 8TB
Hi,
This is the code of the entrypage of my web application.
Expand|Select|Wrap|Line Numbers
  1. <%@page contentType="text/html"%>
  2. <%@page pageEncoding="UTF-8"%>
  3. <%@page import="com.spi.defecttracker.vo.PropertiesVO"%>
  4. <%@page session="true" %>
  5. <html>
  6. <head>
  7.     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  8.     <title>JSP Page</title>
  9. </head>
  10. <body>
  11. <%
  12. PropertiesVO urlProperty = (PropertiesVO)session.getAttribute("URLPropertiesList");
  13. System.out.println("host:\t"+urlProperty.getHost()+"\tPort:\t"+urlProperty.getPort());
  14. %>
  15. <form method="POST" action="http://<%=urlProperty.getHost()%>:<%=urlProperty.getPort()%>/DefectTracker/RequestHandler">
  16.     Click Here To Access Defect Tracker&nbsp;
  17.     <input type="submit" value="Start Defect Tracker" >
  18.     </p>
  19.     <input type="hidden" name="SCREEN_ID" value="0" />
  20. </form>
  21. </body>
  22. </html>
  23.  
  24.  
Previously this file was a .html file. But to change the url in all the files what I did ....... I am getting the url properties from the Properties file. Now this thing is working in all the jsp file except this welcome jsp file. It is throwing NullPointerException and host and port values are not coming.

I am setting the propertyVO object in session after execution of this entry page. How should I make it work.
Need ur help !
Pinpoint the line(s) throwing the exception (println) and just don't do whatever it is if urlProperty is null.

Something like
Expand|Select|Wrap|Line Numbers
  1. String host = "";
  2. String port = "";
  3. PropertiesVO urlProperty = (PropertiesVO)session.getAttribute("URLPropertiesList");
  4. if(urlProperty != null) {
  5.      host = urlProperty.getHost();
  6.      port =  urlProperty.getPort();
  7. }
Sep 6 '07 #2
madhoriya22
252 100+
Pinpoint the line(s) throwing the exception (println) and just don't do whatever it is if urlProperty is null.

Something like
Expand|Select|Wrap|Line Numbers
  1. String host = "";
  2. String port = "";
  3. PropertiesVO urlProperty = (PropertiesVO)session.getAttribute("URLPropertiesList");
  4. if(urlProperty != null) {
  5. host = urlProperty.getHost();
  6. port = urlProperty.getPort();
  7. }
Hi,
Actually this is entry page of application. After execution of this page I am setting the propertyVO object in the session. Thats why these host and port values are not coming to this page and thats why it is throwing exception.
What I need is to set this object in the session before the execution of this entry page.
Sep 6 '07 #3
r035198x
13,262 8TB
Hi,
Actually this is entry page of application. After execution of this page I am setting the propertyVO object in the session. Thats why these host and port values are not coming to this page and thats why it is throwing exception.
What I need is to set this object in the session before the execution of this entry page.
Well then set the properties as soon that page is entered.
Instead of getting the properties just set them in the session.
Sep 6 '07 #4
madhoriya22
252 100+
Well then set the properties as soon that page is entered.
Instead of getting the properties just set them in the session.
Hi,
That is the problem.. I dont know how to set properties in the session as soon as that page is entered. Remember that page is verty first page of the appl. and it is a welcome file also ..
Expand|Select|Wrap|Line Numbers
  1.  
  2. <welcome-file>
  3.          EntryPage.jsp
  4. </welcome-file>
  5.  
Sep 6 '07 #5
r035198x
13,262 8TB
Hi,
That is the problem.. I dont know how to set properties in the session as soon as that page is entered. Remember that page is verty first page of the appl. and it is a welcome file also ..
Expand|Select|Wrap|Line Numbers
  1.  
  2. <welcome-file>
  3.          EntryPage.jsp
  4. </welcome-file>
  5.  
How were you setting it after that first page?
Sep 6 '07 #6
madhoriya22
252 100+
How were you setting it after that first page?
Hi,
After pressing button on that first page the control goes to the requesthandler serlvet. In servlet based on screen Id of the first page a function is called. In that function I am setting all the session attributes.
Sep 6 '07 #7
r035198x
13,262 8TB
Hi,
After pressing button on that first page the control goes to the requesthandler serlvet. In servlet based on screen Id of the first page a function is called. In that function I am setting all the session attributes.
So create the properties object in the first JSP instead or don't try to access it in that JSP if you don't want to create it there or maybe I'm missing something here ...
Sep 6 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Nathan Sokalski | last post by:
I have a user control that contains three variables which are accessed through public properties. They are declared immediately below the "Web Form Designer Generated Code" section. Every time an...
8
by: bryan | last post by:
Is there any way I can get the application path (the one returned by Request.ApplicationPath) in the Application_Start method in Global.asax? Request is not valid there. On a related note, is there...
8
by: Brent White | last post by:
If you need more information, I'd be glad to give it, but I am developing an ASPX page so that the user can select multiple values for a specific field, then pass them on (using Crystal Reports 10...
3
by: Michael Glass | last post by:
I'm working on an ASP.Net web app using VS2005 and the .Net 2.0 framework, and I have a serious problem with the page I'm currently working on. The page has, among other things, two FormViews and a...
7
by: Aaron Gray | last post by:
I put together the following code to get the href's parameters :- function GetParameters() { var arg = new Object(); var href = document.location.href; if ( href.indexOf( "?") != -1) { var...
1
by: kamleshsharmadts | last post by:
I am using Ajax with struts in web application. from jsp i am calling a function of ajax.js onclick of a button. code of that call function which calling from jsp given as below:- ...
4
by: Avi | last post by:
Hi I am creating web application in which i want to assign by default values to the property which i had created my own. In that one of the property is of type color and i am unable to assign...
6
by: WT | last post by:
Hello, Using VS2005. I have an assembly library that can be called from a Web site asp.net application or from a winform application. From this library I need to retrieve a path using simply a...
9
Catalyst159
by: Catalyst159 | last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows: Part A: Maximum FAR and Floor Area: Part B: Gross Floor Area of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.