Salman Raut

Greenhorn
+ Follow
since Mar 31, 2009
Merit badge: grant badges
For More
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 Salman Raut

Hi Maneesh,

Thanks for telling about Sysdeo.

The following is a better step by step tutorial for installing sysdeo.

http://www.sipages.com/sysdeopage.shtml


Best Regards
Hi Ranchers,

I am venturing developing web applications. Eclipse is my primary IDE.

Now here is the problem:
I want to develop web applications (in Java) in Eclipse and run them from eclipse.
If I use the Tomcat server internally in Eclipse, the web application runs for sure in the IDE. But if I make the war of the application and try to deploy it on an independent Tomcat server it fails miserably. This happened to me in Netbeans. I had worked hard to make a web application that was working awesome through Netbeans. But when I made the war and deployed it in external Tomcat, it failed big time. The reason being Netbeans had added several dependencies which external Tomcat would not recognize.

One solution is develop the application in the IDE but deploy it on external Tomcat server. But during development, it is very painful to deploy manually after doing small changes.

Is there any plug-in that can be used to solve this problem?

In short this is what I want:
I want to develop and test applications in Eclipse IDE. At the same time, I want to be sure that when I make a war of the app running fine in Eclipse and deploy it on external Tomcat, it should run fine.

Any suggestions, tutorials are welcome.

Thanks for your time and consideration.

Best Regards
Hi Ranchers,

I am venturing developing web applications. Eclipse is my primary IDE.

Now here is the problem:
I want to develop web applications (in Java) in Eclipse and run them from eclipse.
If I use the Tomcat server internally in Eclipse, the web application runs for sure in the IDE. But if I make the war of the application and try to deploy it on an independent Tomcat server it fails miserably. This happened to me in Netbeans. I had worked hard to make a web application that was working awesome through Netbeans. But when I made the war and deployed it in external Tomcat, it failed big time. The reason being Netbeans had added several dependencies which external Tomcat would not recognize.

One solution is develop the application in the IDE but deploy it on external Tomcat server. But during development, it is very painful to deploy manually after doing small changes.

Is there any plug-in that can be used to solve this problem?

In short this is what I want:
I want to develop and test applications in Eclipse IDE. At the same time, I want to be sure that when I make a war of the app running fine in Eclipse and deploy it on external Tomcat, it should run fine.

Any suggestions, tutorials are welcome.

Thanks for your time and consideration.

Best Regards
Hi Abdul,

Sorry for answering so late.

# out.print(String.format(ATTR_TEMPLATE,"name",this.name));
# out.print(String.format(ATTR_TEMPLATE,"size",this.size));





String.format() is basically used to replace complex String concatenation.
Instead of writing:





This complex String concatenation uses nesting of double quotes (") and single quotes (');
This can be eliminated by declaring constants.


and then using these constants.
The following code achieves the same result as that of complex nesting of double and single quotes.



The above code is a lot more pretty and readable.

This is particularly useful when we have multiple occurrences of the same attribute that requires nesting of double and single quotes.

Hope I answered your question.

Best Regards
Hi All,

Thanks for your help.

I referred to Bryan Basham's tutorial on Dynamic Attributes and figured it out.

The basic problem was I did not use servlet to set the List. Now, I passed the request to the servlet. Populated the list in the servlet. Put the list in request scope. Then retrieve that list in jsp using EL (${requestScope.colorList}).

For future reference, here are all the required files:

1) input.html



From here the request goes to MyServlet1.java which populates the list.

2) MyServlet1.java



the servlet forward the response to form.jsp.


3) form.jsp



4) SelectTagHandler.java


5) TLD File




6) web.xml





This would solve the mission of writing a custom tag for dynamic select. javascript:emoticon('');

Thanks for all your time and support.
Hi,

I made the changes in the Tag Handler file.
But still I am getting a null pointer exception in the for loop. I have bolded that part in the code.
This is the modified tag handler file.





Are you skeptical about the size attribute because it is String (and not int) OR there is some other reason.

Thanks for taking the time.

Regards
Hi,

I am not sure if it is right to copy paste the error.

But here it is:

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

java.lang.NullPointerException
com.badal.handlers.SelectTagHandler.addOptionsList(SelectTagHandler.java:33)
com.badal.handlers.SelectTagHandler.doTag(SelectTagHandler.java:53)
org.apache.jsp.index_jsp._jspx_meth_myTags_005fselectTag_005f0(index_jsp.java:97)
org.apache.jsp.index_jsp._jspService(index_jsp.java:63)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


Thanks
Hi Milton,

I have specified the attribute size in the TLD file on line 28.

Dynamic attributes are mainly used for optional attributes.

In this example, I am only testing with required attributes.

The problem is surely in the jsp though

Thanks for taking the time and effort
Hi Milton,

The problem is in the line 6 of the JSP.

Regards
Hi All,

There is an example in Head First Servlets and JSP book.
This is in chapter 10 (Pg 543). The mission is to implement the select tag handler for generatinf dynamic drop down.
This will help us in getting away from hard coding the drop down box in the HTML page.

Following are the files:
1) SelectTagHandler.java


2) TLD File



3) JSP Page:



Can some one figure out what am I dong wrong?
It will helpful if some one can provide the flow of this custom tag handler?

Thank you all for your time and consideration.

Best Regards
Hi Christophe,

I understand why java beans must be inside a package.

About the jsp:getProperty:

I expected


this code to spit all the values in the jsp in the same order as they are defined in the bean.
It might not be very useful practically but I was wondering it should still not give me a error.


Hi,

I have 2 questions:
1)
The following is the scenario:
The user enters the form data in a html page. The form action points to a jsp page.
In the jsp the values are set in the bean using jsp:setProperty and retrieved from the bean and displayed on the jsp using jsp:getProperty.
The text boxes in the html have the same name as the properties in the bean.

SO I am able to set all the properties in the bean from jsp using:


The container, after seeing property="*" in jsp:setProperty, does the mapping between html text box names and bean property names and then populates the bean.

But when I want to retrieve the bean values in the jsp:getProperty using *, it gives an error. I am forced to retrieve values one by one.
In short, this statement fails:




Is there any logical reason why the container does not obey us for retrieving all the values?




2) The bean class has to be in a package. In other words src is the home directory for all the source files, I cannot put MyBean.java directly inside the src folder. If I put it directly under src folder, it gives an error.
I am forced to package it inside the src folder.
Is there any reason for this rule?

Thank you

Best Regards
Thanks Sam and Paul.

I am clear about the requirement of the init().

Thank you very much for clearing my doubt.

Best Regards
14 years ago
Hi Bear,

Thanks for the response.

I am convinced with the second answer about multiple requests from the same client.

But I have some reservations about why a constructor cannot do init() work?
Every servlet has a ServletConfig. Why is it not possible to pass ServletConfig instance as an argument to the contructor?
Then using that instance, one can do whatever ServletConfig instance does in the init().

Regards
14 years ago
Hi All,

I am learning Servlets and JSPs. I am referring Head First Servlets and JSP book.
I have the following doubts in Servlets:

1) Servlet class has a default constructor. All the initialization (that is done when the container calls the init()) can be done in that default constructor. Why is init() required if its purpose can be achieved by the default constructor?

2) Web Container allocates one thread per request. If one client sends multiple requests, then multiple threads are created by the Container. One servlet will always give the same output for multiple requests. What is the need for creating separate threads if all of them generate the same output?

Thanks for taking the time to see my questions.

Best Regards
14 years ago