Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 29th, 2002, 07:24 PM
pflick pflick is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Phoenix AZ
Posts: 22 pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 h 48 m 19 sec
Reputation Power: 0
substitution variable(?)

Not quite sure how to phrase this. We're trying to figure out how to pass what would be a global variable as opposed to a session variable. I work with SAS a lot, so if someone is familiar with SAS macrovariables, perhaps they can offer the correct translation. We tried a $, but that doesn't quite do what we need (in SAS, you assign a value to a macrovar, either hardcoded or dynamically -- we are trying to do the latter). I know I've done this before, but for the life of me, I can't remember how and I can't remember what to look for, so I've been going a bit nuts this weekend. Help? Thanks very much.


Example:

String text = "newText";

String <%= text %> = "True Description";

I would like to dynamically create a String called newText and place "True Description" as its value.

Kind regards,
Pat Flickner

Reply With Quote
  #2  
Old July 31st, 2002, 09:15 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
I'm not sure what you're trying to do. You can define variables that are outside of the main method the jsp compiles into by using <%! ... %>. So:
<%!
String text = "newText";
%>
Then later you'd have:
<%
text = "True Description";
%>

Be careful if you do this though, as most application servers will try to process concurrent requests to your jsp as separate threads, and reassigning the value in multiple threads will lead to problems.

You can do something like:
<%
String text = "newText";
text = "True Description";
%>
The value is: <%=text%><br>
<%
text = "New description";
%>
The value is: <%=text%><br>

Like I said, I'm not sure what you're trying to do. And I've never used SAS

Reply With Quote
  #3  
Old July 31st, 2002, 10:17 PM
pflick pflick is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Phoenix AZ
Posts: 22 pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 h 48 m 19 sec
Reputation Power: 0
What I'm attempting to do is address an java servlet object by a different name. It was suggested that we use a hash table, but this seems an awful roundabout way to get something simple done. I would have thought that we could pass the value to the servlet, but it doesn't accept it -- drops the last portion of what we want.

We're calling an object, mdvi. We want to address it as mdvi_prod and mdvi_dev so that we can display the results side by side from the same starting browser (we have a main browser that submit links to child browsers, so this is causing us some issues and we think it's the reason we can't easily just pass the value we want to see).

Sorry -- sometimes extracting information from me can be like pulling molars. Twisted molars. Embedded. Sideways.

Reply With Quote
  #4  
Old August 1st, 2002, 01:19 AM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
Umm... still confused.
It sounds to me like you're trying to have a browser open two child windows, both displaying information from the same object (mdvi), but calling the object by different names (mdvi_prod and mdvi_dev, respectively). Is that right?
How are you passing the values to the servlet? And what exactly are you trying to pass?

Reply With Quote
  #5  
Old August 1st, 2002, 12:35 PM
pflick pflick is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Phoenix AZ
Posts: 22 pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 h 48 m 19 sec
Reputation Power: 0
Confusion understandable. We have nothing to do with the parent-child relationship going on here. If I had my way, our Web Police would take their mitts off the thing, but that ain't gonna happen. So, I'm stuck.

Basically, what you are saying is correct: The parent can call as many child browsers as it chooses. The problem arises in our set of links; apparently, we're the only ones who know how to actually use jsp to code dynamically; the other team hard-codes everything, so they don't have an issue. But it takes five minutes to implement an application using our jsp's as opposed to their five weeks, minimum, and that's only once you've completed the back end.

Anyway, because of its truly dynamic nature, the jsp's rely upon data tables to feed it information. This works for passing info to the jsp and to the objects, but it doesn't work with loading an object, inherit the original object. (I think I said that right.) Hence, the quandry.

Doex that shed any more light?

Reply With Quote
  #6  
Old August 1st, 2002, 05:32 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
Ok, so you're wanting to pass an object from one browser window to another, is that right?
Well, then you've got choices.
request, session, and application.
I *think* the request object can store objects, but I'm not sure on that. You'll probably want one of the other two. I'd recommend session, unless you're only wanting one object available to every user of the system.
In your main window you'd have something like:
mdvi my_obj = new mdvi();
String obj_name = "mdvi";
session.setAttribute( obj_name, my_obj );
And your link would be:
somepage.jsp?obj_name=<%=obj_name%>
Then the child page:
mdvi new_obj = session.getAttribute( request.getParameter( "obj_name" ) );

Is that what you had in mind?

Reply With Quote
  #7  
Old August 1st, 2002, 07:14 PM
pflick pflick is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Phoenix AZ
Posts: 22 pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level)pflick User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 h 48 m 19 sec
Reputation Power: 0
We'll try it. It looks like it just might work. Thanks! I'll let you know what happens.

Pat

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > substitution variable(?)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway