Session based variable
i have a project wich is based on online Testing System i want
a increament in int type variable related to the user session, I have
tryed session.setAtrribute();and session.getAtrribute(); methods but they are not working properly plz sugest me some right idea to solve my this problem
its urgent
thax
ThePals
what's not working?
session.setAttribute("counter", new Integer(0));
Integer counter = (Integer)session.getAttribute("counter");
counter = new Integer(counter.intValue()+1);
session.setAttribute("counter", counter);
Similar Messages
-
Store Session scoped variable in RequestScoped FormHandler?
Hi All,
I need to store a value into session scoped variable in formHandler. Is it possible? For Example, i need to no.of times handleApplyShippingGroups is being called by a User (Session scoped) and write a condition based on that value whose effect is to that User only? But, ShippingGroupFormHandler's scope is "Request"? How to get through this?
Thanks,
VishnuVardhanHi,
You can use the below logic.
In ShippingGroupFormHandler.properties
$class = your.custom.Shippinggroup.fomhandler
profile=/path/to/your/profile/component
In YourShippingGroupFormHandler.java
Inside handleApplyShippingGroups(),
//increment the value
getProfile.setApplySgCallCount(getApplySgCallCount()++);
Before that, add the property - applySgCallCount - to your profile with getter and setters.
Hope this helps.
Please keep posting the issues / updates.
Thanks,
Gopinath Ramasamy -
Access to a logged-in user's information via a session based object
I am in the process of putting together a design for the security layer of a given
application I am working on. The requirements for authentication demand that
the framework take advantage of digital certificates and username/password verification.
The digital certificate end is relatively straightforward in terms of configuration
within WebLogic 6.1. I am planning on implementing a RDBMS security realm for
the username/password verification piece and again, from the documentation I have
seen, it seems relatively straightforward in setting that up as well.
The question I do have is in regards to once the user has successfuly logged in
to the application. Is there anyway to manage and have access to a set of user
info or credentials once they successfuly log in - aka some sort of session based
object that WebLogic Server facilitates? Or is this something that will have
to be explicitly built from our end if requirements do arise that necessitate
user information to be readily available as such?
Any feedback would be helpful....thanks!!Use the cfquery tag to query the database. If you don't know
how to write sql, I have heard good things about the book, Teach
Yourself SQL in 10 Minutes by Ben Forta. -
Different ways to referencing Session State variables
Hi,
According to APEX documentation there's 4 different ways to reference session state variables: http://download-west.oracle.com/docs/cd/B32472_01/doc/appdev.300/b32471/concept.htm#BEICHBBG
In an inline PL/SQL statement, what's the difference when using the different methods? I remember reading something that the bind and static text have a size restrictions. What's the difference between the V() and NV() functions?
Thank you.
MartinMartin,
In PL/SQL, the preferable method is to use bind variable notation, e.g., :P1_ITEM. In HTML contexts, you must use &ITEM. notation. In stored procedures, you can use v or nv, the latter function being identical to the former with the additional characteristic that it raises an exception if the retrieved value is non-numeric.
Scott -
How to invalidate a session based on the session id
How to invalidate a session based on the session id
You have to write your own support for this.
It used to be in the API, but was deprecated as a security hole.
The best way to do it is implement a session listener (javax.servlet.http.HttpSessionListener) which notifies you when sessions are created/destroyed.
You can then keep a map of sessions in your own code, indexed by session Id, and access any/all of them to invalidate as you choose. -
Trace session based on CLIENT_IDENTIFIER
Hello all,
i am on 11.2.0.1....we have a sap application and trying to trace a session from DB end....and seems like the job that the end user runs jumps from one session to another....in this senerio...how would i trace a session ??? i read article about dbms_monitor package to trace it...but as i mention, sap keep chaning the session from one to another.....
i read the below article...
http://ocsurabaya.wordpress.com/2007/07/18/tracing-sql-in-oracle-database-10g/
in which it suggest to set the service name and module name....but the problem is its hard to get the module name as its doing quite a few things....it jumps from one module to another....is there anyway to trace a session based on its CLIENT_IDENTIFIER (from v$session)....as this looks like the domian user account for that user who is running the job....
as i mentioned during that time(when job is ran)...the sid changes, modeule changes...the only thing consistent is the CLIENT_IDENTIFIER ( which seems to be the domian user name )...
so how can i trace a session based on CLIENT_IDENTIFIER ??user8363520 wrote:
Hello all,
i am on 11.2.0.1....we have a sap application and trying to trace a session from DB end....and seems like the job that the end user runs jumps from one session to another....in this senerio...how would i trace a session ??? i read article about dbms_monitor package to trace it...but as i mention, sap keep chaning the session from one to another.....
i read the below article...
http://ocsurabaya.wordpress.com/2007/07/18/tracing-sql-in-oracle-database-10g/
in which it suggest to set the service name and module name....but the problem is its hard to get the module name as its doing quite a few things....it jumps from one module to another....is there anyway to trace a session based on its CLIENT_IDENTIFIER (from v$session)....as this looks like the domian user account for that user who is running the job....
as i mentioned during that time(when job is ran)...the sid changes, modeule changes...the only thing consistent is the CLIENT_IDENTIFIER ( which seems to be the domian user name )...
so how can i trace a session based on CLIENT_IDENTIFIER ??is application 3-tier?
does application utilize connection pooling? -
Session state variables across multiple ApEx applications
We have a suite of loosely integrate ApEx applications that all share a common authentication scheme. When you first log in we attempt to load a series of session state variables with temporary data to streamline various logging and authentication related activities for the life of the session.
However, these session variables seem to disappear when you move from one application to another, so they are not truly tied to just the "session" which carries over across all applications, but the application from which the session state is set.
What is the suggested way, keeping in mind that the data being held may have security related context, to preserve values during a session, but regardless of which ApEx application you are in.
The method we are using to share the authentication is using a common "Cookie Name" from a common subscribed authentication scheme as suggested elsewhere on this site and seems to work very well outside of this specific issue.
Thanks in advance,
BarneyApologies for the delay getting back on this.
My use of the word "disappear" was probably misleading. They were not visible from the second application. When setting "Session State" I was under the impression that it was setting it for the authenticated session, not for the specific application. (I am referring to the: apex_util.set/get_session_state).
Your solution will work fine, as long as I know which application the user last authenticated against. However, it could be one of over 30 (and growing) different applications which would require me writing a program to go through every "p_flow" to try and find a valid value every time I need to reference the field.
It would be really beneficial if you could store true Session variables which stay alive for the life of the authenticated session and is available to anything authenticated against that session id. This would streamline alot of cross-application program development.
The "get/set_session_state" is a misleading as it is not a Session value, but an Application value. The Session exists across multiple applications, while this procedure does not.
Thanks,
Barney -
Session-scope variable for JSP page used in a frame
Hi,
I don't know if there's a way to do this at the same time:
(1)- assign session scope to a variable (in order to be able to retrieve recurrently the previous value each time the JSP is called);
(2)- set its visibility in a way that it could be accessed only by the page that defines it. The JSP is used in a frameset along with an other JSP that can potentially define identical session-scoped variable (You understand why I want to keep them separate)
session.setAttribute():
seems not to be the thing I need
pageContext.setAttribute():
with SESSION_SCOPE, it behaves the same way as session.setAttribute(). with PAGE_SCOPE, condition (1) can't be satisfied.
Does anybody have an idea ?
Thanx in advance.I can see that you will not want to maintain two different files for every possible page on the site!
It may be possible to do something like <frameset rows="*" cols="50%,*">
<frame name="content1" src="file.jsp?frame=one" >
<frame name="content2" src="file.jsp?frame=two" >
</frameset>and then in the jsp<%
String frame=request.getParameter("frame");
session.setAttribute(frame+"AttributeName",attributeValue);
%>This will set up two session attributes - "oneAttributeName" and "twoAttributeName". Depending on how many variables you have, this may prove just as difficult to maintain.
You may end up having to simply pass url parameters between pages to maintain state within the individual frames, which is far from elegant also.
I am interested in how you end up solving this one. -
I want to keep client-specific information for each incoming connection, but i heard it cannot be done with session variable. i read in a book that session variables in a servlet (or scriptlet section of a jsp page) are shared among all incoming threads (therefore all clients) accessing the servlet.
I guess a simple example of what i want to acheive is a shopping cart, but keeping the shopping cart order in a session-like variable specific to the original client machine/user who placed the order.
I thought of doing something like:
request.getSession().setAttribute("ShoppingCart", cart);
inside my doGet() method in a servlet. And a book author says it won't work. He says ff I use a member to keep information about user1, sometimes the session variable may be overwritten by user2 if they are accessing the servlet at the same time.
1) Can someone confirm whether session variables are shared among all incoming requests to the same servlet?
2) If so, how can i easily keep track of incoming user/client mahcine-specific information, without using cookies or other client-side storage methods.
3) If client side storage is necessary (to keep user info), what are the common techniques and the classes used?
I am fairly new to j2ee so i would appriciate it if you can explain in layman's terms.Hi,
Session scope is made to save the user specific information only. All class(servlet) level members(state) can be shared by all incoming thread. So its a bad practice, if we used class level session variable which stores the client specific info.
I dont think session will overwritten if you used session var locally(inside any method).
When any user logs in you should create a new session for that user.
Means if you have LoginServlet.java file which have log in functionality, Here only you need to create new session.
HttpSession session = request.getSession();
Other than this file every where you need to use
request.getSeission(false);
In your case it would be
request.getSession(false).setAttribute("ShoppingCart", cart);
Hope This will help you. -
Coldfusion session/client variables?
We have multiple users using VPN to get to our intranet. When the second user gets on they get the first person's session/client variables?
I have tried looking for the session/client variables and where they are stored but I can't seem to find them. I have tried searching out the cookies.
I would appreciate any help.There are not too many people on this forum that have dabbled with ColdFusion. I used to, but that was more than one decade ago.
Your best bet on getting assistance with your problem, is to go to the ColdFusion forum. -
Session scope variables and weird behaviour of AdfContext()
Hello,
what is the best method and correct API to create a session scope variable?
I am currently using ADFContext().getCurrent().getSessionScope().get()/put(), but it looks like it has some problems: for some unkown reasons I loose the variable, that is get() returns null when called from a method of a (overridden)ViewRowImpl. Why does this happen?
Thanks you in advanceThere are a couple of ways you can set values on a sessions scope but I would have to question if you really need a scope as high as session to accomplish what you want to do. At any rate, you should be able to store the value using the method you described but you could also try setting it using EL by using the setExpressionValue and resolveExpression methods in JSFUtils.java (you can find this in the latest fusion demo application). JSFUtils also has a getFromSession and storeOnSession that you could try.
With all that said I don't think it is good practice to access scope variables from your model layer. You should write your method in the ViewRowImpl class to accept the value as a method parameter and then pass the value in through the binding layer or when invoking the method from your bean class. -
Auth-based Variables - how to preset from only one analysis-permission?
Hi experts,
I've got the following szenario:
A user has got 2 analysis-permissions:
A1:
0CompCode: US11
0Division: 01,02
A2:
0CompCode: US99
0Division: 03,05
Now if this user opens a query with authorization-based variables for 0CompCode and 0Division, he/she'll get the
following preset on the variable-screen:
0CompCode: US11, US99
0Division: 01,02,03,05
(=the union of both value-sets)
If the user now confirms this variable-screen he'll alway run into a permission-error, because e.g. US11, 05 is not a permitted combination.
Is there any way to preset the variables with a valid combination? e.g. US11, 01, 02.
Thanks for your comments in advance.
Kind regards,
MarcoMarc,
Set up an authorization or customer exit variable for Company Code which checks the user authorization, then have the manual entry option for both the characteristics or just 0DIVISION, you can resolve this issue.
In any case, BI would not permit mismatch values and throw errors in the variable screen therefore you could think about checking his/her authorization through a customer exit variable to avoid the jinx of variable errors.
Rgds,
Ramesh. -
Hi All,
How to set a variable which should be available throughout the session, I dont want to use session scoped managed beans for this.
Using the following method is not working
FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("variableName","value");is there any other way to set session scoped variables ?Got it working
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("variableName","value");This will make the variable session scoped
Regards,
Sai Krishna -
CSS 11503 Stickyness session based
Need assistance comming up with a soulution for session based Stickyness.
1.can this be based on the J-Session ID?
2.Can the CSS send a cookie and the clients stick to the same servers until the session expires and the cookie os removed?
3. Also can we set a timeout value for the cookie?If servers are setting the cookies then you need something like this
Service webserver1
ip address 10.10.10.1
string server1 <-- server cookie value
active
Service webserver2
ip address 10.10.10.2
string server2 <-- server cookie value
active
Service webserver3
ip address 10.10.10.3
string server3 <-- server cookie value
active
content mycontent
vip address 12.12.12.12
add service webserver1
add service webserver2
add service webserver3
string prefix "JSESSIONID="
protocol tcp
port 80
url "/*"
advanced-balance cookies
sticky-inact-timeout 60 <-- Inactivity timeout value for cookie
active
The string prefix (that goes on the Content Rule) would need to match be the name of the
cookie string prefix "JSessionID="
Then the string on the services would need to match the value that is inserted on each
server:
Example:
Service webserver1
ip address 10.10.10.1
string server1
active
Then the cookies injected from server1 would need to look like this:
JSessionID=service1
That is how the CSS would then identify which server the cookie belongs to and how to send
it to it. If the JDSessionID values are random, then the CSS would not be able to match the values to a service. -
Can we access the session scoped variable by simply using its name
The Java EE 6 Tutorial contains a "Duke's Bookstore Case Study Example”. I could not understand following statements of this case study:
*bookdetails.xhtml*
{code}
<h:outputText value="#{selected.title}"/>
{code}
*BookstoreBean.java*
{code}
public String details() {
context()
.getExternalContext()
.getSessionMap()
.put(
"selected",
getFeatured());
return ("bookdetails");
{code}
I want to know can we access the session scoped variable in bookdetails.xhtml by simply using its name as done above?It is basic Expression Language (EL) functionality, it isn't even specific to JSF. And it isn't specific to the session scope either, you can put beans in any scope (page, request, session, application, flash, conversation, whatever custom scope you create) and reference it using EL by only its name. The thing that you have to take care of is that the bean lives in SOME scope, which can be achieved using JSF specific annotations or configuration files, through CDI or by manually putting the bean in a specific scope through Java code. It's flexible, which is the nature of the Java platform.
Maybe you are looking for
-
2012 R2 RDS Deployment with RDCB HA and UPDs enabled. Everything was working fine with no issues until users started getting temporary profiles. Around the same time UPDs were being created but at the same time a user profile was created in C:\Users.
-
Streaming content to Apple TV from Late 2007 MacBook Pro without AirPlay
What is the method of streaming content to a third-generation Apple TV from a late 2007 MacBook Pro? This Mac doesn't support AirPlay. If this feature is not supported by Apple, what are some third-party options?
-
To retrieve data from xml datatype
oracle.sql.OPAQUE@4e1a77 This is the XML data that is stored in the field of oracle XML dataype .So from this oracle.sql.OPAQUE@4e1a77 ..how can i retrieve the actual data
-
What are the required/recommended Antivirus exceptions for BPC ????
I need to provide and implement a definitive list of required Antivirus exceptions for BPC (both Web and SQL servers). We currently run v5.1 but I would also like to know if anything is different for v7, although I don't see why it would be. However
-
In Photoshop Bridge CS5 when I choose File open I do not have Photoshop as an option.
Can someone suggest how to correct this problem?