Now if I am in the admin 1 environment, I would initialize my servlet with request parameter admin=1 and the servlet should load email address of admin 1 and similarly when in the environment 2, should load the servlet with admin 2.
I could do the same by putting the email address of the respective admin as request param value, but i don't want to the email address to appear in the url.
Viewing this example of pagination [URL] and other similar beans for pagination, why do they do these beans view scoped? These beans dont contain any properties for a form so they could be application scoped, right?
And this works fine: URL....The war file is deployed under the context root /bankconnect/ I want to make a servlet mapping, before the context root "i still want the context root bankconnect". URL....
I have a managed bean for a form. I map the fields filled in the form with managed bean properties. when I submit the form and click new form , values from the previous form submitted gets displayed in the input fields. I used the scope of the from bean to session. what should be its scope so that values should be destroyed after I submit the form .For every new form ,new bean has to be initialized. On submit I navigate to another bean with session scope.
I'm just wondering why variables in interface can't be instance scope?
interface Test{ int a; }
And then
Test test = new TestImpl(); test.a=13;
Yes, it violates OO, but I don't see why this is not possible? Since interface is not an implementation, therefore it can;t have any instance scope variable. I can't find the correlation of interface being abstract and being able to hold instance scope variable. There's gotta be another reason. I'm just curious about any programmatic limitation, not deliberate design constraint. the example of programmatic limitation is like when Java forbids multiple inheritance since when different parents have the exact same method, then the child will have trouble determining which method to run at runtime.
now, i want to access a managed bean's method to execute a service call related to the code embedded in the hyperlink.
My Managed bean
@ManagedBean(name="details") @SessionScoped public class XXXX extends Bean implements Serializable{ public XXXX(){...... } public myMethod(..){ service.getDataRelatedToHyperlinkCode(....passing code here to fetch details from DB) } }
if i use postConstruct annotation it is getting executed only once since it is a session scope. and point to be noted is i cannot use viewscope and requestscope.
I have an issue with variables/attributes scope inside a jsp tag file.
In short, I have a tag with an attribute named "id". If the page using my tag has a variable called "id" (maybe coming from the spring model) and I call my tag WITHOUT specifying the id attribute, inside my tag I still can acces to the "id" attribute that was defined in the page but I don't want this behavior; if the tag is called without the "id" attribute then it should defaults to empty/null.
(...) The id is: ${id} // <- Prints 'X' <my:print /> <- Prints 'X' ! I want it to not print anything in that case <my:print id="Y"/> <- Prints 'Y' (...)
What I want is to have the tag attributes live only in the tag, without having any knowledge of any variable outside of the tag itself. Is it possible?
My current workaround is to remove the "id" attribute, enable dynamic attributes and with a scriptlet search in the dynamic attributes map for the "id" and save it in a variable with a different name (e.g. "__id").
In my case my managed bean is View Scoped and it supports a UI page which has multiple forms and each form is submitted as AJAX POST request.
As per the statndard, setting restriction to 5 should create 5 views and after that based on LRU algorithm the oldest views should get deleted if 6th views is created.
Therefore any action on the oldest view will throw the ViewExpiredException and i simply redirect the user to view expired page.
1) When i set the restriction to 5 views, i open 4 tabs with 3 forms each. 2) I submit the 3 forms on first tab everything works fine. 3) As soon as I go to 2nd tab and submit the first form thr, i get view expired exception 4) It seems I am exceeding the number of views I mentioned in web.xml
I want to know :
1) Does every AJAX POST submit itself creates a view ? 2) How I can count the number of views created in a session ? 3)Can i force expiry of a view in JSF 2.0.2 while the session is still alive ? 4) Normally JSF 2.0.2 session cachces the views. Lets assume session is alive the entire day but a view was created in morning at 9:00 AM and is not used again the entire day. Assuming that session doesn't reaches the max number of views it can save in entire day, will the view created in morning expire on its own after certain interval of time ? If not , can we still force its expiry while keeping the session alive ?
How to access session from different context? I have created a session in one jsp, in one context and trying to access it from different context. But, I was unable to access the same. How to achieve it?
I had to change context path name of my web application due to some organizational shuffle. I have successfully changed it and it has been working fine.
But what is happening is we have used old context path name in reminder and notification emails. so When users hit links from old emails, they are getting 404 Error.
Is there any way to redirect the old request which has old context path to new one?
I am working on netbeans IDE , but I understand how the application know the parametres for the connections. I understand what is a Context , specifically i understand this code about the init method
import java.awt.*; public class Square { private double x,y; // Current position of the square. private Color color; // The color of the square. private int side; // The side of the square public Square() // constructor
[Code] .....
This is the square class, it draws an orange square that moves around in the applet viewer, works fine and as it supposed to do.
Ship:
package assignment1;
import java.awt.*; public class Ship { private Square[] fleetMembers; // declare fleetMembers as an array of Square private int total = 5; // Max number of squares in fleet private double x,y; Ship() // Constructor
[Code] ....
This is my FleetOfShips code. It is supposed to be a set of ships moving around together, but for unknown to me reasons it doesn't work. It does compile without any problems but when I run the applet it doesn't do anything.
I am trying to make a game, for some reason i have begun to get a java.lang.StackOverflowError.
I am not exactly sure how i can fix it. only removing line 14 from infopannel1 (and everything that used that class.) seems to work. im not sure what else i can do to fix it. or why its resulting in stack overflow for that matter.
I am putting in a link for the files i wrote this using bluej (several classes have no relevance, errorv2, demonstration, folderreadertest, ReadWithScanner, saveloadtest, menutest,rannum, and menutestTester. are all irrelivent to my problem.)
I came across this code which proves that variable initialisation occurs before even constructors are called.However, I am confused over some things.
Firstly, from my understanding, when a new House object is created in this line House h = new House(); , the no-arg constructor of the House class is called.
Since the no-arg constructor House() is called, why are all the creation of Window objects being run first ? Shouldn't Java jump straight into the no-arg constructor House() ?
class Window { Window(int marker) { System.out.println("Window(" + marker + ")"); } } class House { Window w1 = new Window(1); // Before constructor House() { // Show that we’re in the constructor: System.out.println("House()"); w3 = new Window(33); // Reinitialize w3
Main screen leftsecond screen rightswing portal application is visible on two screens. If you open a context menu (right mouse) on the right screen, the context menu open on the left (Main) screen instead of the right.
I am using netbeans 7.2, glassfish 3.1.2, JSF 2.1 and Primefaces 3.2. When I add more than three menu tabs, I get this error ui layout initialization error the center-pane element does not exist the center-pane is a required element. This is my template.xhtml code:
<?xml version='1.0' encoding='UTF-8' ?> <!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" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui">
public class SavingsAccount extends Account { private static final double MIN_BALANCE = 100.00; private static final double RATE = 0.035; public SavingsAccount(Customer customer, double bal, String accountNum, Transaction[] trans) { super(customer, bal, accountNum, trans);
[code]....
When I execute this code there is an error in Transaction array initialization. Change the Saving account constructor from (String customer,double balance, String accountnumber,Transaction[] tr) to (String customer,double balance, String accountnumber,Transaction tr)
public static void main(String... args) { String i; // String i = null; that would compile if (i == null) {// this line does not compile as i was not initialized System.out.print("A"); } else { System.out.print("B"); i = "A"; main("A", "B"); } }
Why does the above code not compile although the statement String i should lead to an initialisation of i to the value of null which is the default value for Strings.
Now If I hit /Allen it sets init parameter for both servlet MyServlet and jsp JjspInit. I don`t have any servlet all I have is a web.xml and a jsp page. But accessing JjspInit.jsp directly gives null.
How hiting the url /Allen prints valu. This code is on JjspInit.jsp .
So does that mean that in web.xml I have registered this jsp as the target for /Allen. And one more question directly accessing the jsp page shows null it means init parameter haven`t been set.