Gytis Jakutonis

Ranch Hand
+ Follow
since Feb 02, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
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 Gytis Jakutonis

Hello,

in plain web (jsp, php etc.) world I use simple technique to pass data between pages - url params. How to solve this issue with jsf?

Suppose we have page A with list of orders. Each order item is rendered as url to page B for single order management. Each url has param - order id. And that's all - simple.

Now I'm trying to handle the same logic with JSF. Seems like there is no simple solution for such a simple problem - pass id between pages. Possible solutions:

a.use request scope bean for page B and bind bean attribute orderID=#{param.orderId}. Main drawback - in some cases request bean is not enough (I need to store some page related data between requests). So if we do not want to pollute http session with page data like DataModel etc., we have to use session scoped bean for page B.

b.use session scoped bean for page B. In this case we can store data between requests (very useful then order editing spans over several pages). But now we have no ability to map bean attribute to request param.

b1.we either need to implement action listener and bind it in page A (getting order Id still is not straightforward for me)

b2.we can set orderId for our session bean in action handler in page A backing bean (getting bean from session is not straightforward too)

b3.we can parse request param in page B bean in method getOrder - compare current order id with requested one and reload order if needed. Main drawback - jsf strives to hide all that request parsing stuff, but seems like we are going back to old jsp style (just this time it is much harder to understand that is going on).

Another issue with case b is session bean cleanup. If we have many users and use this technique for many pages, we can get with a lot of session scoped beans and each bean may store quite large objects.

Any ideas? Which way is the true one from jsf perspective?
11 years ago
JSF
Hello,

I'm using managed bean from session scope to handle page data and actions. It is not clear how to handle situation, then the same client (single session) opens the same page in two browser windows with different data selected. Obviously session bean stores data for the last request only. So that happens on the first page submit (some action activated) - the only one session bean gets activated to handle the action. Action was activated from the first page, so user expects to get first page data submited. But session bean already contains data for second page, and submited action performs activities on that data. Is it possible to prevent such situation in JSF? Any ideas?
11 years ago
JSF
Hello,

I'm trying to find out, how does JAAS integrates with J2EE. Suppose our J2EE container maintains keystore for X.509 certificates. On client side (which is either Web or Java app based) we initialize JAAS LoginContext and initiate user authentication. As I understand, authentication request is passed to our J2EE container. After successful authentication client side may proceed by looking up for EJB's etc. And I'm not sure, when does authenticated Subject with Principals are passed to J2EE? Should I always use doAs() in order to supply authentication info with J2EE request (ex. EJB call)?
12 years ago
Hello,

I can not figure out, why are there two quite overlapping specifications. While WS Metadata spec (JSR-118) defines WSDL-Java mapping (annotations basically), JAX-WS (JSR-224) also defines set of annotations for WSDL-JAva mapping. So why do they (JCP) created two spec instead of extending one of them?
12 years ago
Hello,
I'm using ServiceLocator pattern to locate EJB's and other JNDI resources. Currently I have singletone ServiceLocator, but I'm not sure about this implementation style. I really hate singletones, because they can not be subclassed, garbaged, initialized in custom way etc. But I can not figure out any alternative way to use ServiceLocator in EJB layer and BusinessDelegate layer. These layers has no access to general scope (like ServletContext). Any ideas?
Hi Nicky,
thanks for your replay. I have two more questions about the code you have posted:
  • why can't we use just <T extends Comparable<T>>
  • your solution is restricted to Comparable types only, but some operations like EQUALS or IS_NULL does not need Comparable arguments at all


  • thanks in advance,
    Gytis
    14 years ago
    I want to implement some operations like 'more', 'less', 'equal'. For 'more' and 'less' I want to use Comparable api. So in general operations may look like this:


    But the problem is that with 1.5 jdk I get unchecked call wraning for compareTo(). Is there any elegant way to solve this issue? Thanks in advance.
    14 years ago
    How can I implement tree of classes, so that each would have different value for the same static property? Maybe there is some workaround for this issue? thanks in advance
    14 years ago
    Hello,
    I need to define final static array (with file signature bytes in my case), ant I'm not sure how to protect array from modifications. If I use simple form:

    then malicious code may change signature elements:


    So I came up with this idea:

    Maybe there is some pattern for this problem, or maybe new jdk 1.5 has some standard elements, which slolve the issue?
    14 years ago
    Hi Robert,
    I think I've lost some points on general considerations and documentation because of my poor english And one more point - I see a lot of discussions considering documentation amount. I'm sure that there is no need to write pages of text for choices.txt and userguide.txt - my both files are only two printed pages long.
    14 years ago
    Chirag, congrats!

    Seems like we both have got the same result for locking (44 of 80), so could you post some notes on this one. It is quite interesting to analyse, that we did wrong. thanks.
    14 years ago
    Score: 353
    Comment: This report shows the total 1.4 SCJD points that could have been awarded in each section, and the actual number of points you were awarded. This is provided to give you per-section feedback on your strengths. The maximum possible score is 400; the minimum to pass is 320. General Considerations (maximum = 100): 99 Documentation (maximum = 70): 69 O-O Design (maximum = 30): 30 GUI (maximum = 40): 31 Locking (maximum = 80): 44 Data store (maximum = 40): 40 Network server (maximum = 40): 40
    -------
    Major decisions (briefly discussed in this forum):
    1. RMI, but no remote interface for DBMain - remote interface with business logic, called Services, with three methods (book, release, find).
    2. DuplicateKeyException not used at all, RecordNotFoundException not used for find method.
    3. runtime wrapper for IOException called RuntimeIOException
    4. Server mode has no gui (maybe I've lost some points on this?)
    5. MVC for client GUI, but my View component does not use events - it calls Controller directly. I guess I've lost some points because of these issues: no gui configuration is saved (I store only database file location, host and port), default JTable management (I've added simple sorting only), specific MVC implementation (no events), I've forgot to handle RuntimeIOException and show some dialog with error message.
    6. Seems like I've failed with my locking. I've implemented locking, based on record-weak_reference_to_client map and synchronized lock() unlock() methods. I've used wait() and motifyAll(). Weak references are added to ReferenceQueue in order to cleanup later by utility thread (since my DBMain is not exported remotelly, I guess I've lost some points because of this unnecessary cleanup). Also I've implemented deadlock detection and reentrant locking support. I've tested all locking with multiple threads, deadlock also, so my locking works fine, so I'm a bit confused about the lost points.

    Anyway, I'm quite satisfied with the results, since I've lost many points only in one section, which means that either my implementation was too complex or I've missed smth in requirements.
    14 years ago
    Hi,
    I'm trying to inflate UTF-8 ant Latin-1 compressed text:

    The problem is the size of buffer array. Since I use inflated buffer data to create String instance, I'm not sure how big that buffer should be. Any ideas?
    14 years ago
    Hanna,
    thanks for information. One more question - how should I prepare for essay? Should I re-read all java tricks and specifications as for programmers exam or only prepare for questions based on my assignment only?