Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Kumar Jaya

Ranch Hand
+ Follow
since Jan 12, 2009
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 Kumar Jaya

Bear Bibeault wrote:You can't nest one EL expression within another.

Hint 1: use <c:set> to perform string concatenation to create the variable name; then use the EL expression.

Hint 2: why are you doing something so convoluted in the first place? Figure out a simpler way to accomplish the same with better variable names or constructs.



I am trying to learn el and jstl. I am always having problems with el, I really do not understand how they work, they are bit different from java variables and constructs!
8 years ago
JSP
I am a beginner in el and jstl. I have a jsp that has the scriptlet


I want to print the values using el. I tried this but it gives JasperException in Tomcat


I dont know what is wrong, when I print name_${i} i am getting the attribute name but passing that name to the el expression does not seem to work? printing ${name_i} within the loop also fails?
8 years ago
JSP
I created a sample plugin which includes a simple view in eclipse and ran the plugin from inside the workbench, my plugin is installed and I get my view showing up in Window/Show View/Other... . I packaged the plugin as a jar file and copied it under the plugins directory of eclipse and restarted my eclipse workbench. I am not able to find my plugin view. I dont know whats is wrong

I am using eclipse RCP SR2 (3.6) for developing plugins and my packaged jar file includes the code, META-INF/MANIFEST.MF and plugin.xml files.

I created the plugin from the book 'Eclipse Plug-ins, 3rd Edition'. I followed the steps outright and am not able to set up the plugin as a jar file.
I am new to RichFaces. I wanted to create a tree component in RichFaces, having the ability to display the nodes or not using a boolean variable in the node.

The tree node has a user date which is as follows



My Tree Class



My JSF Page is as follows



The above page does not display the nodes properly(the name is not displayed, instead the userobject is printed in the page as 'demo.user@10c276' etc), but if I change the line

to
the code seems to work fine, but why is my EL not functioning properly, I am using tomcat - 6.0.30, RichFaces 3.3.3, I have included jstl-1.2.jar in my war lib? Also the taglib
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c"%> throws exception saying the attribute does not accept expressions and I changed to
<%@ taglib uri="http://java.sun.com/jstl/core_rt"; prefix="c"%> which seems to work fine.
9 years ago
JSF
Thanks Bear, I got it to work, I just thought that I needed a new EL within EL to pass a parameter to the enclosing EL!
9 years ago
JSP

Bear Bibeault wrote:Why would you need to? The whole thing is an EL expression. You are perhaps thinking that ${} is some sort of fetch operator? if so, that's wrong. The ${} simply encompasses the entire complex EL expression.



May be


this is what you mean! But the value of request time variable "pageContext.request.remoteAddr" is the key to the required value in the map. So I am fetching the parameter using ${pageContext.request.remoteAddr}.

I have add a map entry using the key ${pageContext.request.remoteAddr}, so how will I retrieve the value back from the map?

9 years ago
JSP
I am having a utility class ContextObject which has a java.util.Map instance variable with a getter method for it. I have placed the ContextObject in Application Scope using the EL

I am adding a value to the Map in ContextObject using the EL

I just want to retrieve the value and print in the same page. I used the EL expression

and

But both does not seem to work. I think I cant use an EL expression within an EL expression? Is there a way to get the value fro the map?
Thanks in advance.
9 years ago
JSP
I went through the API docs of the BodyTag and BodyContent, The lifecycle of BodyTag is as follows "doStartTag(), setBodyContent(), doInitBody(), BODY, doAfterBody()". BodyContent is a subclass of JspWriter, so when a BODY lifecycle occurs can I assume the contents of the action are appended to the previous content?

The API for the BodyContent says "An encapsulation of the evaluation of the body of an action so it is available to a tag handler.", So I think evaluation of a Body results in content addition(also).

Stefan Evans wrote:The bodyContent variable itself doesn't change, but its not immutable. Its contents can be written to - which is what the "DO BODY" part of the lifecycle would do.


Also note that you are using constants that don't exactly fit with the Body tag.
EVAL_BODY_TAG has been deprecated. You should instead use EVAL_BODY_BUFFERED (has the same constant value, so it currently works).

The doAfterBody method should return EVAL_BODY_AGAIN rather than EVAL_BODY_TAG.
I guess thats just a really old article?



Yes the bodyContent variable itself doesn,t change, but how does the framework have access to my bodyContent variable (which can private also) if it has to change the contents? does it use some sort of reflection mechanism?

Its an old code from sun site. I am just trying to figure out the mechanism behind the scenes. I appreciate the reply, thanks.
9 years ago
JSP
I was trying the example in the sun site 'http://java.sun.com/developer/technicalArticles/xml/WebAppDev3/' I have some problem trying to understand the last example 'Sample 13: LoopTag.java' which prints the tag's body to the times given in the tag's attribute 'times'.

The example seems to work fine, but I am not able to understand the flow of it


The corresponding JSP page



I am sure that the setBodyContent(BodyContent bodyContent) method is called only once and doAfterBody() is called 4 times, but I am not sure where the addition to the BodyContent is made. I just include a sysout in the doAfterBody() to examine the contents of BodyContent

i.e.,

The first call to doAfterBody() prints

"Welcome to Custom Tags Programming.<BR>"

and the second call to doAfterBody() prints

"Welcome to Custom Tags Programming.<BR>"
"Welcome to Custom Tags Programming.<BR>"

and so on..

How does this occur in the background without the BodyContent variable being altered any where in the code and setBodyContent() method being called??

Thanks for the help
9 years ago
JSP
Is there a way I can modify the contents of a file inside a jar file? I have tried different options but haven't succeeded. I just have a war file that does not have any contents inside the classes folder, but has all the working code inside the lib folder (jars). One of these jar files say (my1.jar) has a text file say (sample.txt) packaged along with it. I am able to read the contents of the file (sample.txt) from the code in my1.jar using (getClass().getResourceAsStream("path to sample.txt")). I just am curious to know whether I will be allowed to modify the content of the file (sample.txt).

my.war
|
|---META-INF
|
|---WEB-INF
|
|-- classes (empty)
|
|--lib
|
|---my1.jar
|---my2.jar

my1.jar
|
|--- META-INF
|--- com
|--my
| |
| |--file
| |
| |--sample.txt
|--MyClass (I am able to read the contents of the file from this class)

I am not able to create a file object of 'sample.txt' file. The Url obtained just does not start with 'file://..'(hierarchial) its opaque as ('jar:file://....'). I dont have a way to created a output stream either!

Any help is greatly appreciated.

Regards







9 years ago
I have a very basic doubt in SSL HandShake. Assume that we have a server S which uses self signed certificates. I write a Java client C which connects to the S. When C connects to S, C gets certificates from S and saves them to its truststore and the remaining part of the communication proceeds. After some time I use the same C to connect to the S, so will S send the certificates again to C, or C will use the certificates already stored in truststore. I am not good in SSL and underlying implementation of Truststore functionality in Java.

Will S send the certificates to C invariable of whether the C has certificates on its truststore?? I believe that if I have certificates in truststore C trusts S and C will not ask for certificates when I connect again?? Is my assumption right??

Is the process same for self-signed certificates and CA certificates??

Thanks in advance.
10 years ago
I have a question in scheduling jobs in web application. If we have to schedule jobs in web application we can either use java util Timer/TimerTask or Quartz(there are also other scheduling mechanism, but I considered Quartz). I was considering which one to use, when i hit the site http://oreilly.com/pub/a/java/archive/quartz.html?page=1 which says using timer has a bad effect as it creates a thread that is out of containers control in the last line. The other pages discuss Quartz and its capabilities, but I can read that Quartz also uses thread and/or threadpool to schedule tasks. My guess is that these threads are also not under the containers control

Can anybody clarify this to me
Is it safe to use Quartz in my web applications without creating hanging threads or thread locking issues?
Thanks in advance
10 years ago
Hello,

I have a basic question in hibernate and c3p0. Should I need c3p0.jar in my lib directory for hibernate to use c3p0 connection pool provider. I have configured the hibernate c3p0 properties in cfg.xml file and I did not have c3p0 jar in the lib directory and hibernate did not give any warning messages, but my web application is able to run, so what pool is it actually using?

Thanks
jkv
I got a doubt on thread priorities, Assume that I have only two JVMs(JVM-A and JVM-B) running in a single physical machine. Since these two JVMs are the only process to the OS, lets assume that the processor cycles is 50:50 for each JVMs, meaning the share the CPU cycles equally.

Suppose I have 5 threads in each JVM and JVM-A's threads are all of NORMAL_PRIORITY(5) and JVM-B's threads are all of HIGH_PRIORITY(10), will the processor cycle shift to like 25:75(JVM-A:JVM-B)? I mean will JVM-B be given higher priority by the OS?

Thanks in advance,
Hello Sunil,

Thanks for the reply. I will do that, but I got one other question, if I use the ps.close() after every ps.execute() or ps.executeUpdate() what will happen to my transaction isolation level which is Serializable here?? Will ps.close() release the lock on the row it has inserted or updated before con.commit() is called?? that was my third question

3) One final thing in that api. what they mean by resources anyway? do resources mean tables or locks, if so closing the statement will release the lock, wont it? Will calling a con.close() close any statement objects associated with that connection??

Regards
jaya