Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Patil Niteen

Ranch Hand
+ Follow
since Dec 10, 2009
Patil likes ...
Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Patil Niteen

Which version of the web application deployment descriptor are you using?

Check this....
The default value varies depending on the version of the web application deployment descriptor. The default mode for JSP pages delivered using a Servlet 2.3 or earlier descriptor is to ignore EL expressions; this provides backward compatibility. The default mode for JSP pages delivered with a Servlet 2.4 descriptor is to evaluate EL expressions; this automatically provides the default that most applications want. You can also deactivate EL expression evaluation for a group of JSP pages (see Deactivating EL Expression Evaluation).

Thanks,
Nitin
9 years ago
JSP
The filter code is:




Also, I tried this in after method and it doesn't work.
Thanks.
Nitin.
9 years ago
Hi,

I have date and time in IST . How to get the corresponding Date and Time In EST using Java API.



Thanks and regards,
Nitin.
9 years ago
I am setting the attribute of the session for logout to null. I am checking the same session variable in the filter for valid login. If the attribute is null, I am trying to prevent caching of the page. This way , I am trying to prevent the user to view the visited pages after logout using Internet Explorer's BACK button.

The conditionally setting of the response headers is not working for me.

Here,s the code: For logout:


I am checking the userLogger attribute of the session in the filter as:



If the condition is removed from the code. The response headers are set and the user is prevented to view the visited pages after logout.
Also, the print statement prints: Response Committed:false.

Note: I am using this in a GRAILS application. Since, the issue is with the response and setting the headers , I have posted it here.
Thanks and regards,
Nitin
9 years ago
The scenario is :

When the user logs out , I am setting the session variable to null. If the user tries to view the previously visited page using the internet explorer's Back button, In a filter I am checking


if(session==null). If session is null , I am setting the header variables.


But , the header variables are not being set in this case.

Is the response commited before checking the condition?

Thanks and regards,
Nitin.
9 years ago
Hi Ranchers ,

I need to set the response headers to prevent caching of the data. I am using the following code in a filter:



This code works fine.
Now, my requirement is to set the headers conditionally like:



But the headers are not being set in this case. Any way through which I can make it work?

Thanks and regards,
Nitin.
9 years ago
Hi Ranchers,

Can I get the perfect date and time at a perticular location with the help of TimeZone?

The code I am using is:



The output is:
Eastern Standard Time
-18000000
EST
Date:Sun Dec 26 13:34:51 IST 2010
Press any key to continue . . .

I am trying to get the date and time at the specified TimeZone (Eastern Standard Time) but I am getting the system date and time.
Am I making any mistake in the code? Please guide me.

Thanks and regards,
Nitin.
9 years ago
Hi Peter,


Yes. This is required for the security reason. It may happen that the user logs out and leaves the page as it is. No other person should be able to view the details of this user using BACK button.There may be some confidential information being displayed.

Thanks,
Nitin.
9 years ago

Campbell Ritchie wrote:

Patil Niteen wrote:. . . Should I shift the question under "Java in General" section? . . .

No. Please don't ask the same question twice.

It may be that nobody knows the answer, but I can try moving you to the security forum.



Thanks , Campbell .

In general, what I need is to restrict the user to view the contents after log-out using the explorer "Back" button. For example, the one which is implemented in GMAIL.

Are there any settings to be made in GRAILS framework for this to work. Or is there any other way through which this can be done.

Thanks,
Nitin.
9 years ago
Hi,

I haven't received any answer till now. Should I shift the question under "Java in General" section?

Thanks,
Nitin.
9 years ago
Hi,
I am trying to implement security in an application using GRAILS. I am checking the username and password entered by the user with the database stored data. For a valid user access is given to a perticular portal. The problem is that the user can access the pages after logging out of the application. The user can use the "back " button of the browser and can access the recently visited pages in a perticular login. I downloaded the plug-in and made the changes in the Config.groovy file. But still the security feature doesn't work and the user can access the application after logging out.

plug-in: http://grails.org/plugin/cache-headers


Changed the Config.groovy

// Prevent any client side caching for now

cache.headers.enabled = false


Also, I tried to set cache false in the method which is called for a perticular page.

Still could not restrict the user viewing the pages of a perticular login using back button after logout



Thanks,
Nitin.

9 years ago
Hi,

I have set the model for the JTable . Only table.revalidate();and table.repaint(); are sufficient to get the new data displayed or else we have to add the JTable to the mainPanel and the mainPanel to the JFrame and repaint all the panels. I have tried different ways but could not get the updated data displayed.

Which is the better approach?
Thanks.
10 years ago
Hi Rob,
I tried the option specified by you but still could not get the required result.

To make my question more clear let us consider the example given below.

Suppose there are total 4 JPanels : mainPanel,statusInfoPanel,buttonPanel,dataPanel.

My class extends JFrame. The panels statusInfoPanel,buttonPanel and dataPanel are added to mainPanel.

Finally mainPanel is added to the JFrame.

Now, I want to change the contents of the data panel on the click of a specific button present on a buttonPanel . I will retreive the values from the database and will construct the JTable with this data and add this JTable to the dataPanel. I am trying to display the new data but could not do that. Am I missing something here? ,is dataPanel.repaint() sufficient to get the data cahange to be displayed? .

Or else do I have to construct the whole mainPanel and add it to JFrame?
Thanks.
10 years ago
Hi ranchers,

Suppose I have added 4 panels to a JFrame. On a perticular action I want to update the components of panel 1 only. Is there any way(method) through which I can repaint the panel 1 after updating its components . I tried with panel1.repaint(), but could not get the results. Or is it necessary to repaint the whole jFrame. Please giude me.

Thanks,
10 years ago
Thanks Jesper Young,

What a great explanation. Most of the books do not contain such explanations.
According to the explanation , the compiler has a cache of all the Integer objects between the range -128 to 127(Can we change the range?). So the reference variables i11(10) and i12(10) in the above example refer to the same Integer Object. But for the value 1000 two different Objects are created.

Thanks.

10 years ago