Placing session variable on bottom of each printed page
I have an application that contains a page in which we use as
a printed report. We plan to convert this someday to a crystal
report but for now are only option is to use the web browser as our
reporting page.
What I need is to know is if there is a way to code the page
so that the report id, which is stored as a session variable can be
printed out on either the top or bottom of each new page. The
report contains a lot of narrative, so it is impossible to tell
where the new page is going to begin and end because the length of
the narrative varies from 1 to 10 pages.
I don’t know if there is anyway to incorporate the page
setup from the browser settings, we are a state government, and we
are only using Internet Explorer 6.0 as our browser. The
application is using CF MX 7.
Any ideas??
Thanks.
I think I misunderstood. You have one long report and when
printed will be multiple pages. You need the report name to be on
each page.
Three ways I can think of to do it.
First you can use the <title></title> to your
advantage. When printing from a browser the title is at the top of
each page. (though this can be turned off under browser options but
is on by default if I remember correctly).
<head>
<cfset report_name = "Dynamic Report Name">
<title><cfoutput>#report_name#</cfoutput></title>
</head>
Second, you can make the report name part of the URL so it
will appear at the bottom of each page.(this can be turned off too
in browsers)
www.mysite.com/reports/rpt_gen.cfm?REPORT_NAME=AGENT_MULDER_EXPENSE_REPORT_2005
Third, use an image as a watermark. You should probably make
the image 1/2 the height of the printed page. The background image
repeats. That way, you are sure it will appear somewhere on each
page printed. Width is another problem. But you may be able to
center the background image horizontally using css.
<body BACKGROUND="images/report_proof_background.jpg" >
* You might also want to check out using css with page
breaks.
Similar Messages
-
How to print Column Labels on each print page of an ALV report
Hi,
I have an ALV report which is of 10 print pages.
I need to print Column Labels on each print page.
How it is possible.
Plz write the solution
NarendraHi Narendra
try this code.
reward pts if help.
Deepanker.
*& Report ZDEMO_ALVGRID_EDIT *
*& Example of a simple ALV Grid Report *
*& The basic ALV grid, Enhanced to display specific fields as *
*& editable depending on field value *
REPORT ZDEMO_ALVGRID_EDIT .
TABLES: ekko.
TYPE-POOLS: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
field_style TYPE lvc_t_styl, "FOR DISABLE
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA: it_fieldcat TYPE lvc_t_fcat, "slis_t_fieldcat_alv WITH HEADER LINE,
wa_fieldcat TYPE lvc_s_fcat,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE lvc_s_layo, "slis_layout_alv,
gd_repid LIKE sy-repid.
*Start-of-selection.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM set_specific_field_attributes.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-scrtext_m = 'Purchase Order'.
wa_fieldcat-col_pos = 0.
wa_fieldcat-outputlen = 10.
wa_fieldcat-emphasize = 'X'.
wa_fieldcat-key = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'EBELP'.
wa_fieldcat-scrtext_m = 'PO Item'.
wa_fieldcat-col_pos = 1.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'STATU'.
wa_fieldcat-scrtext_m = 'Status'.
wa_fieldcat-col_pos = 2.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'AEDAT'.
wa_fieldcat-scrtext_m = 'Item change date'.
wa_fieldcat-col_pos = 3.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-scrtext_m = 'Material Number'.
wa_fieldcat-col_pos = 4.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MENGE'.
wa_fieldcat-scrtext_m = 'PO quantity'.
wa_fieldcat-col_pos = 5.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MEINS'.
wa_fieldcat-scrtext_m = 'Order Unit'.
wa_fieldcat-col_pos = 6.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'NETPR'.
wa_fieldcat-scrtext_m = 'Net Price'.
wa_fieldcat-edit = 'X'. "sets whole column to be editable
wa_fieldcat-col_pos = 7.
wa_fieldcat-outputlen = 15.
wa_fieldcat-datatype = 'CURR'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'PEINH'.
wa_fieldcat-scrtext_m = 'Price Unit'.
wa_fieldcat-col_pos = 8.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
Set layout field for field attributes(i.e. input/output)
gd_layout-stylefname = 'FIELD_STYLE'.
gd_layout-zebra = 'X'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
FORM display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = gd_repid
i_callback_user_command = 'USER_COMMAND'
is_layout_lvc = gd_layout
it_fieldcat_lvc = it_fieldcat
i_save = 'X'
TABLES
t_outtab = it_ekko
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS
FROM ekpo
INTO CORRESPONDING FIELDS OF TABLE it_ekko.
ENDFORM. " DATA_RETRIEVAL
*& Form set_specific_field_attributes
populate FIELD_STYLE table with specific field attributes
form set_specific_field_attributes .
DATA ls_stylerow TYPE lvc_s_styl .
DATA lt_styletab TYPE lvc_t_styl .
Populate style variable (FIELD_STYLE) with style properties
The NETPR field/column has been set to editable in the fieldcatalog...
The following code sets it to be disabled(display only) if 'NETPR'
is gt than 10.
LOOP AT it_ekko INTO wa_ekko.
IF wa_ekko-netpr GT 10.
ls_stylerow-fieldname = 'NETPR' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
"set field to disabled
APPEND ls_stylerow TO wa_ekko-field_style.
MODIFY it_ekko FROM wa_ekko.
ENDIF.
ENDLOOP.
endform. " set_specific_field_attributes
pls reward pts is help, -
Placing content at the bottom of each page
I have a dynamic form with several content areas that are hidden until certain options are checked. Upon opening the form it is 1 page long, but can easily spread out to 3 pages or more after fields are filled. I want to be able to have content placed at the bottom of each page such as a customers name. I have tried the pagination overflow trailer (Which I figured out has to be a subform that trails) But the problem I am having is that instead of placing it at the bottom of the page it places the field right underneath the last subform that fits on the page. Sometimes that subform will be a couple inches up the page because the next subform will be 4 inches tall. I just want the content to be on the very bottom of each page. How would I adjust this? Thanks
You can place the Fields in the Master Page that you want to be displayed on each page.
You can adjust the Content area in the Master pages to be above the fields at the bottom of the page so that the data will always be displayed at the bottom.
Thanks
Srini -
Firefox 3.6.13 upgrade prints only a small section of a web page on each printed page
Firefox prints as though the left, right, and bottom margins are very large, so that printing occurs in a small rectangle (1" wide x 3" high) centered toward the top of the page. The print preview shows the same small rectangle of text except that it is located at the left of the screen instead of centered. The result is that many paper pages are printed for each web page (e.g., 15 pages to print http://meyerweb.com/eric/articles/webrev/200001/example3.html whereas IE8 prints this in 2 pages). This occurs for all web pages that I have tried to print and is not isolated to a particular web site.
In the print setup, all margins are set to 0.5". I have tried resetting these but it didn't help.When I do Ctrl+P from within Firefox and then select Properties for the HL-1440 printer driver, the paper size is A4 which gives the printing problem. Changing the paper size to Letter from within Firefox still gives the same problem.
Correction from previous post: Before printing with the LaserJet 4 printer driver (while the HL-1440 driver is still the default), the print-preview shows the small rectangle of text (see the image of my previous post). However, once I print using the LaserJet 4 driver (which prints correctly) then any subsequent print-preview while using the LaserJet 4 driver correctly displays the page (full width and height). Hence, there seems to be some conflict between this version of Firefox and the factory HL-1440 driver.
Note: All printing is done to the same physical printer (Brother HL-1440). In all cases the printer properties are set to Portrait and Shrink-to-fit. -
How to access a session variable just before rendering a JSF page???
Dear Sirs...
i am using jdeveloper 10.1.3.2 with JSF and ADF faces. i want to access a session variable and perform some processing just before rendering a page. how can i achieve this????
i am a little new to jsf, so i feel a little lost
thanks for any help in advance, and best regards<p>
Hi,
</p>
<p>
See example 60 "<strong>Triggering OnPageLoad-Style Code in a JSF Backing Bean Using ADF PagePhaseListener or PageController</strong>" on Steve's Muench blog.
</p>
<p>
Kuba
</p> -
How to add Field in Page Title or repeat header on each print page.
Hi Guys,
We are using Application Express 4.1.0.00.32 on Wondows XP and Oracle version is 10g.
I've created a report in APEX and the user is insisting on putting a header on each page in PRINT of the report which should contain the "from date" and "to date", which are present on the select criteria on top.
Now I'm wondering, how can I implement this request?
Can I somehow add from_date and to_date items in Title so that when they print the report, they'll see the from and to dates in the title?
Or is there someother way to do this.
The report is an interactive report with a control break and user prints the report with file->print.
Please help me. I'd really appreciate your help.
Thanks in Advance.Hi Guys,
Nobody responded, so seems like there is no soluion for this in APEX. -
Printing a Web Report Using Firefox Results in Lost Session Variables
Post Author: AVXFlyer
CA Forum: .NET
I'm having a problem with Firefox users printing a Crystal Report from a web site.
The first page of the web site collects information to be used in the report generation, for example, start date, end date, type of report etc. These are all various text boxes, drop down lists, radio buttons and check boxes. When the user clicks to show the report, everything works fine and the first page of the report will display. The code behind this page takes care of saving al the session variables into hidden fields on the page so the settings will be accessible when the user clicks to view the next page of the report.
On clicking to view the next page of the report, everything is still fine and the process works beautifully and I've had no problems.
A new problem has surfaced during the printing of these reports. Users who use IE6.0 or IE 7.0 do not have a problem, however, users who use Firefox do have a problem.
It seems that the print dialog which appears as part of the the Crystal web control manages to 'lose" the variables which were present on the calling page. It only does this with the Firefox browser. Calls on postback to retrieve the variables from the hidden fields result in 0's or empty strings ("").
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init .... .... If Me.IsPostBack = False Then ... ... strDiscontinuedOnly = Request.Form.Item("ddlInvStatus") If strDiscontinuedOnly = Nothing Then isDiscontinuedOnly = False Else Select Case strDiscontinuedOnly Case 0 'All Inventory isDiscontinuedOnly = False Case 1 'Discontinued Inventory isDiscontinuedOnly = True Case 2 'Active Inventory isDiscontinuedOnly = False End Select End If Else 'Postback is true intRequestedReport = Request.Form.Item("fldReportID") strDiscontinuedOnly = Request.Form.Item("fldInvDiscItemsOnly") isDiscontinuedOnly = Request.Form.Item("fldInvDiscItemsOnly") ... ... end ifCan't explain it, but here are a few tests;
1) Try to print a saved data report
2) Try to print a report that is not using parameters
3) Try a different printer driver as "default"
4) Enable the option "Dissociate Formatting Page Size and Printer Paper Size" on the report
5) What format do you export to?
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports] -
Problems accessing session variables from a pop-up
I am working on a webapp and I when I click on a certain button I need to have a pop-up appear that will either prompt a user to enter log-in info if they haven't already, otherwise the pop-up just needs to display a report. Users can navigate around on the main page and select various reports so multiple pop-ups could possibly be opened. When a user logs in I save the login info in session variables, but for some reason whenever I click to have another pop-up open it always says that my session variables are null. Is there a way to have more global session variables so that multiple windows (the pop-ups) can touch session variables? Would there be a way to pass the login info in session variables back to the main page and then pass those session variables back out to each pop-up that opens? Thanks so much.
Have you got session cookies enabled?
The most common way to keep track of the session id is via a session cookie.
This cookie gets shared by all windows of the same browser session.
You are opening these pop-up windows with window.open?
Print out the session id <%= session.getId() %> on each page to see if it is the same.
Cheers,
evnafets -
Problem retrieving Session variables in Flex from Coldfusion
For about a year I've been using a cfc that allows me to remote call from within Flex to retrieve session-level variables. I much prefer this to using FlashVars because with the remote call the session values don't show up in the page source.
This was working fine when I was using an Application.cfm file to manage my Coldfusion pages. However when I switched to using an Application.cfc file, the cfc stopped working. Neither the cfc or the cfm file contain any code to manage these session variables (they are set in other pages), so the only real difference seems to be changing from Application.cfm to Application.cfc.
Any thoughts why? Thanks.Ok, this is resolved.
The problem seems to have been related to the scope of Application.cfc and Application.cfm. The directory which contained the cfc files had an Application.cfm controlling the session, while the directory with the pages that included the flex swf files had an Application.cfc file. Apparently these two don't talk to each other.
The solution is to use either Application.cfc or Application.cfm files, but not to mix them. In other words, use either -- but be consistent. -
Filtering a Recordset with session variable
Hi
I am trying to filter a recordset based on a session
variable. The session variable is passed from the login page via a
username which is their email address. This has been successful.
However when I want to filter the users table - tbl_users to
show their first name it doesn't work.
I followed the adobe help tutorial plus ahave tried other
combinations and I am now at a loss on where exactly I am going
wrong.
The recordset is rs_UserAccess
I have a session variable called - MM_Username
The table has 5 records of various users
The code that I have fiddling with is -
<%
Dim rs_UserAccess
Dim rs_UserAccess_numRows
Set rs_UserAccess = Server.CreateObject("ADODB.Recordset")
rs_UserAccess.ActiveConnection = MM_conn_sidecounter_STRING
rs_UserAccess.Source = "SELECT * FROM tbl_users WHERE
username = MM_Username"
rs_UserAccess.CursorType = 0
rs_UserAccess.CursorLocation = 2
rs_UserAccess.LockType = 1
rs_UserAccess.Open()
rs_UserAccess_numRows = 0
%>
Any help would be appreciated. I have outlined below the
different combinations I have tested.
Try No1
rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE username
= Session("MM_Username")”
Message:
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/main.asp, line 182
Try No2
rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE username
= Session(‘MM_Username’)”
Message:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Undefined function
'Session' in expression.
/main.asp, line 186
Try No3
rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE username
= Session(MM_Username)”
Message:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Undefined function
'Session' in expression.
/main.asp, line 186
Try No4
rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE username
= Session Variable MM_Username"
Message:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error
(missing operator) in query expression 'username = Session Variable
MM_Username'.
/main.asp, line 186
Try No5
rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE username
= MM_Username"
Message:
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters.
Expected 1.
/main.asp, line 186
Thanks in advance
Cheers
DownsyTry this:
rs_UserAccess.Source = "SELECT * FROM tbl_users WHERE
username = " & Session("MM_Username")
Keep that on one line.
Ken Ford
Adobe Community Expert
Fordwebs, LLC
http://www.fordwebs.com
"Downsy42" <[email protected]> wrote in
message news:[email protected]...
> Hi
> I am trying to filter a recordset based on a session
variable. The session
> variable is passed from the login page via a username
which is their email
> address. This has been successful.
> However when I want to filter the users table -
tbl_users to show their first
> name it doesn't work.
> I followed the adobe help tutorial plus ahave tried
other combinations and I
> am now at a loss on where exactly I am going wrong.
> The recordset is rs_UserAccess
> I have a session variable called - MM_Username
> The table has 5 records of various users
>
> The code that I have fiddling with is -
>
> <%
> Dim rs_UserAccess
> Dim rs_UserAccess_numRows
>
> Set rs_UserAccess =
Server.CreateObject("ADODB.Recordset")
> rs_UserAccess.ActiveConnection =
MM_conn_sidecounter_STRING
> rs_UserAccess.Source = "SELECT * FROM tbl_users WHERE
username = MM_Username"
> rs_UserAccess.CursorType = 0
> rs_UserAccess.CursorLocation = 2
> rs_UserAccess.LockType = 1
> rs_UserAccess.Open()
>
> rs_UserAccess_numRows = 0
> %>
>
>
>
> Any help would be appreciated. I have outlined below the
different
> combinations I have tested.
>
>
> Try No1
> rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE
username =
> Session("MM_Username")?
> Message:
> Microsoft VBScript compilation error '800a0401'
> Expected end of statement
> /main.asp, line 182
>
> Try No2
> rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE
username =
> Session(?MM_Username?)?
> Message:
> Microsoft OLE DB Provider for ODBC Drivers error
'80040e14'
> [Microsoft][ODBC Microsoft Access Driver] Undefined
function 'Session' in
> expression.
> /main.asp, line 186
>
> Try No3
> rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE
username =
> Session(MM_Username)?
> Message:
> Microsoft OLE DB Provider for ODBC Drivers error
'80040e14'
> [Microsoft][ODBC Microsoft Access Driver] Undefined
function 'Session' in
> expression.
> /main.asp, line 186
>
> Try No4
> rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE
username = Session
> Variable MM_Username"
> Message:
> Microsoft OLE DB Provider for ODBC Drivers error
'80040e14'
> [Microsoft][ODBC Microsoft Access Driver] Syntax error
(missing operator) in
> query expression 'username = Session Variable
MM_Username'.
> /main.asp, line 186
>
> Try No5
> rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE
username = MM_Username"
> Message:
> Microsoft OLE DB Provider for ODBC Drivers error
'80040e10'
> [Microsoft][ODBC Microsoft Access Driver] Too few
parameters. Expected 1.
> /main.asp, line 186
>
> Thanks in advance
> Cheers
> Downsy
>
>
> -
Hi,
After I insert a record into my MS Access database, it seems
to me that the session variable got destroyed so the next page
display the session variable as undefined. Has anyone have similar
problem? If so, how to work around that?
Thanks.
Tommy,neptunes wrote:
but its leading to jsp page error...For starters: never, never, ignore errors (exceptions and stacktraces). Those contain very, very, worthful information about the cause of the problem and what exactly went wrong. This way you can easily trackback the problem and solve it.
If you're unable to think logically and smart so that you can interpret the error yourself, if necessary with help of Google, then post it here. Then we'll tell you about the actual problem and possible soltions.
At any way:
iam displaying some data in a table using resultset object,now at the same time iam using to session variable to use the resultset object in my other applications...This already doesn't sound very good. You should never pass expensive resources around like that. You should acquire and close the Connection, (Prepared)Statement and ResultSet in the shortest possible scope. Preferably already in the same method as where you query the data. -
Version migration, shared ssl, session variables
I'm migrating a shopping cart application from Cold Fusion
4.5 to a new server running MX 7, and have run into a weird problem
transferring session variables.
Basically, there's two sites running on one physical server.
The catalog, and then the shared ssl checkout pages. I'll call them
catalog.com and sharedssl.com.
Under 4.5, if I passed CFID & CFTOKEN in a link from
identically named applications on catalog.com to sharedssl.com, the
session and all its associated variables would transition
seamlessly forward. Under MX, this is no longer happening. The
*very first page* on sharedssl.com (the one that was directly
passed CFID & CFTOKEN) will have access to those variables, but
any subsequent pages on sharedssl.com will just throw errors.
Looking at the debugging info, it's obvious that under MX a
new CFID and CFTOKEN are being assigned when the user goes to
sharedssl.com, regardless of the session id that was passed on; as
soon as the "old" CFID & CFTOKEN aren't being explicitly
mentioned, the "new" ones take over, resulting in a completely
blank session.
Has anyone else experienced anything similar? Is there a
simple fix?
I have some ideas on how to make this work, but I'd really
like to keep this projection a "migration," and not, ie., a
"rewrite." I guess I'm wondering whether there's a configuration
checkbox I'm unaware of, or perhaps some arcane option in
cfapplication that will restore the old behavior.
Thanks for any help,
TimOn which page is the following code?
After login, user is validated and set values to those session.variables:
........user validation codes here......................
<cfif mylogin NEQ true>
<cflocation url="/login/login.cfm">
<cfabort
<cfelse>
<cfset session.loggedin="Yes">
<cfset session.username="#Trim(Form.username)#">
<CFSET qUserRights = LoginObj.getUserRights('#Trim(Form.username)#')>
<cfset session.userrights = qUserRights><!--- it's a query --->
<CFSET qUserGroup = LoginObj.getUserGroup('#Trim(Form.username)#')>
<cfloop query="qUserGroup">
<cfset session.usergroup = user_group>
<cfbreak>
</cfloop>
<!--- ****************** ???????????????????????????????????????????????????????????????????????????
When I do cfdump in at this level, I can see that all of these session variables have been assigned to their values.
But these session variables are not accessible from other pages. Other pages still show these session variable without its value.
So, when I use these cfdumps in the index.cfm it is shown as they're not yet assigned with any values ****************** --->
<cfdump var="#session.loggedin#">
<cfdump var="#session.username#">
<cfdump var="#session.userright#">
<cfdump var="#session.usergroup#">
</cfif> -
Purchased ColdFusion 10: Having problem with session variables
My Dept. has just bought CF10 and I'm finally updating my existing web app to CF10 from CF8. My First Problem with CF10 is using session variables.
When using the lower version of CF (since CF 4 to 8) I have never had any problem setting up session variables and getting or using these variables in other pages after a successful login but with CF 10 it seems setting session variables and using them in other pages are a major problems. I'm not sure where have I done wrong in the codes.
First I'm setting the session in my Application.cfc This way:
<cfcomponent displayname="Application" output="true">
<cfset THIS.Name ="MyNewApp"/>
<cfset THIS.ApplicationTimeout = CreateTimeSpan(0,0,20,0) />
<cfset THIS.SessionManagement ="YES"/>
<cfset THIS.SessionTimeout = CreateTimeSpan( 0, 0, 20, 0 ) />
<cfset THIS.SetClientCookies = false />
<cffunction name="OnApplicationStart" access="public" returntype="boolean" output="false">
<cfset application.Main_DSN = "TESTDB">
<cfreturn true />
</cffunction>
<cffunction name="onApplicationEnd" output="false">
<cfargument name="applicationScope" required="true">
</cffunction>
<cffunction name="OnSessionStart" access="public" returntype="void" output="false" hint="Fires when user session initializes.">
<cfset session.loggedin = "NO">
<cfset session.username = "">
<cfset session.userrights = "">
<cfset session.usergroup = "">
</cffunction>
</cfcomponent>
After login, user is validated and set values to those session.variables:
........user validation codes here......................
<cfif mylogin NEQ true>
<cflocation url="/login/login.cfm">
<cfabort
<cfelse>
<cfset session.loggedin="Yes">
<cfset session.username="#Trim(Form.username)#">
<CFSET qUserRights = LoginObj.getUserRights('#Trim(Form.username)#')>
<cfset session.userrights = qUserRights><!--- it's a query --->
<CFSET qUserGroup = LoginObj.getUserGroup('#Trim(Form.username)#')>
<cfloop query="qUserGroup">
<cfset session.usergroup = user_group>
<cfbreak>
</cfloop>
<!--- ****************** ???????????????????????????????????????????????????????????????????????????
When I do cfdump in at this level, I can see that all of these session variables have been assigned to their values.
But these session variables are not accessible from other pages. Other pages still show these session variable without its value.
So, when I use these cfdumps in the index.cfm it is shown as they're not yet assigned with any values ****************** --->
<cfdump var="#session.loggedin#">
<cfdump var="#session.username#">
<cfdump var="#session.userright#">
<cfdump var="#session.usergroup#">
</cfif>
In index.cfm, Before Login I got:
session.loggedin = NO
session.username = ["empty string"]
session.userrights = ["empty string"]
session.usergroup = ["empty string"]
After a successful Login:
session.loggedin = NO
session.username = ["empty string"]
session.userrights = ["empty string"]
session.usergroup = ["empty string"]
Have I done something wrong? These codes work on CF8. Please help.
I need to mentioned:
CF10 is in Linux and my web app is under https not http. But these session variables should be shared bentween http and https because some older application are still in http.On which page is the following code?
After login, user is validated and set values to those session.variables:
........user validation codes here......................
<cfif mylogin NEQ true>
<cflocation url="/login/login.cfm">
<cfabort
<cfelse>
<cfset session.loggedin="Yes">
<cfset session.username="#Trim(Form.username)#">
<CFSET qUserRights = LoginObj.getUserRights('#Trim(Form.username)#')>
<cfset session.userrights = qUserRights><!--- it's a query --->
<CFSET qUserGroup = LoginObj.getUserGroup('#Trim(Form.username)#')>
<cfloop query="qUserGroup">
<cfset session.usergroup = user_group>
<cfbreak>
</cfloop>
<!--- ****************** ???????????????????????????????????????????????????????????????????????????
When I do cfdump in at this level, I can see that all of these session variables have been assigned to their values.
But these session variables are not accessible from other pages. Other pages still show these session variable without its value.
So, when I use these cfdumps in the index.cfm it is shown as they're not yet assigned with any values ****************** --->
<cfdump var="#session.loggedin#">
<cfdump var="#session.username#">
<cfdump var="#session.userright#">
<cfdump var="#session.usergroup#">
</cfif> -
Set session variables inside a page
Inside the page "form.cfm" I have this code:
<form name="report" action="pagestatistic.cfm"
method="post">
<INPUT name=ONE size=15 >
<INPUT name=TWO size=15 >
<input type="submit" value="Go ON">
</form>
I would like to set session variable: ONE and TWO, inside the
page: pagestatistic.cfm
IN that way when I will refresh the page "pagestatistic.cfm"
I will watch have the same results.
I added this code at the top of "pagestatistic.cfm" but it
doesn't work.
<CFSET session.ONE = #ONE#>
<CFSET session.TWO = #TWO#>
Could you tell me what goes wrong?
Thanks
CFWorkquote:
Originally posted by:
liquid One
When you say refresh the page, do you mean submit the form by
clicking on the submit button? Or are you filling out the input
boxes and hitting refresh?
I mean I clicked a link that links the same page:
pagestatistic.cfm
Then I would like to add to this link 2 get variables
pagestatistic.cfm?ColorPage=Green&Order=2 to change the
background color and the order of the results of the page. That it
is impossible because when i refresh the page it is doesn't work.
What do you suggest me to do?
Thanks,
CfWork -
Accessing session variables with php
I am trying to access the session variable $_SESSION['MM_Username'] in one of my php pages, but it is somehow showing empty (i.e it does not contain the username that was entered during login).
I checked and confirmed that my login.php function is properly setting the MM_Username session variable by echoing it from the login function.
So why can't I read it from another php file in the same session? Do I need to do something else before the session variables can
be properly read from any php file in the same session? Any help would be appreciated.Here is a test code I am using to access the session variable $_SESSION['MM_username'] from the php page test.php. But it is not working.
I get an empty string all the time for $username. Can any one see something wrong with this code?
<?php require_once('Connections/MyTestingConn.php'); ?>
<?php session_start(); ?>
<?php
$username = "-1";
if (isset($_SESSION['MM_username'])) {
$username = $_SESSION['MM_username'];
echo $username;
else
echo "Eror: can not access session variable";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
</head>
<body>
</body>
</html>
Maybe you are looking for
-
I could record at 192kHz in AA 1.5, but not in AA 3. Help?
I really hope I'm in the right section and also am not missing the answer in another post. Anyways, I have a SB Audigy 2 Platinum soundcard that's serviced me great for 4 years. I used to record everything, vocals, DVD sound, etc. in 192kHz/32 bit (f
-
How can I Delete a MobileMe Email Account and Kill Duplicate Messages?
When I select "All Inboxes" on my iPhone 4s, I see duplicates of each and every message I receive. Furthermore, the duplicate can't be deleted and I get an error message informing so! I suspect this phenomenon is occurring because I have both an iClo
-
on syncing photos to my iphone from my mac (snow leopard) (iphoto), just 2 or 3 per event retain the edited verisons, the rest are shown in the original version. I'm confused by this. Is this a bug? Is there a way to see all the photos on the mac-edi
-
Can't find Toshiba portable external hard drive in finder after I upgraded to Mavericks
Anyone know how I can be able to see my external hard drive? I've been using it before and was able to see it until I upgraded my OS to Mavericks....Now, I cannot find it in the finder but I can see it in the disk utility however, my mac does not all
-
IPhoto won't open copied IPhoto Library
We just bought two new MacBook Pros and imported all our 11,000 plus pictures into the first MacBook. After investing quite a bit of time organizing the pictures into 166 Events we have IPhoto on the first machine very much the way we want it. The re