Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Samaresh Gupte

Greenhorn
+ Follow
since Oct 03, 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 Samaresh Gupte

Thanks Matthew. That sounds good.
9 years ago
Hi,

I thought of using enums for declaring mostly String constants as suggested by Sonar report.

After delving further I realised lot of code is being repeated in every enum I declare. I have some enum declared in a class to overcome the namespace. For e.g.


Observe that class A has two enums viz. TridionConstants and CacheConstants
both these enums have certain code common.

I am wondering whether I can pull the commonalities into a SuperEnum and have those enums extend/implement SuperEnum.

Jesper: Fixed code tags
9 years ago
Thank you Peter Johnson.

What you suggested worked for us.

I am creating the jar during compile phase just to check the contents of the jar generated without wasting much time
for packaging.I wont be doing so on the production.

Thanks once again.
10 years ago
Hello,
I have generated artifacts for a webservice using WSDL. However I am unable to package them in a jar.
I am trying to generate a jar file for all the class files of the artifacts which are under com/fmr/brokerage

Following is the code snippet.


after checking the jar using 'jar -tf mvn_edb-1.0.0-edb.jar' i get
META-INF/
META-INF/MANIFEST.MF
META-INF/maven/
META-INF/maven/com/
META-INF/maven/com/mvn_edb/
META-INF/maven/com/mvn_edb/pom.xml
META-INF/maven/com/mvn_edb/pom.properties

I would appreciate any guidance.
Thank you.
10 years ago
HI Santosh,

I dont think you can override _jspService(HttpServletRequest, HttpServletResponse) method and you should not attempt too.

All you can do is write code that goes in there
12 years ago
JSP
Well thank you Swapnil


what is relation between Employee & Person(subclass - superclass) ?



Sorry forgot to mention the relation

Employee extends Person
12 years ago
JSP
Thank you Shailesh.It worked

I have another query.

In the bean tag when we set the property to primitive value, does the automatic type conversion take place only when the type and class have the same bean class..say



Now will the same thing work if say:


12 years ago
JSP
Hi,

I have bee trying out an example from head first JSP and Servlets and been recieving jasper excepition.
Can you please help me with the same...

Here is my bean code


and Here is my JSP:


The error I recieve is:
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

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

exception

org.apache.jasper.JasperException: Cannot find any information on property 'strName' in a bean of type 'foo.Person'
org.apache.jasper.runtime.JspRuntimeLibrary.getReadMethod(JspRuntimeLibrary.java:837)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1011)
org.apache.jasper.compiler.Node$GetProperty.accept(Node.java:1062)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Generator.generate(Generator.java:3270)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:189)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.


can you please help me out

12 years ago
JSP
Thanks a lot Avi Sinha..now the point is absolutely clear
12 years ago
JSP
I apologize if I was unable to putforth my point clearly.



1. <web-app>
2. <servlet>
3. <servlet-name>MyServlet</servlet-name>
4. <jsp-file>/Results.jsp</jsp-file>
5. </servlet>
6. <servlet-mapping>
7. <servlet-name>MyServlet</servlet-name>
8. <url-pattern>/go</url-pattern>
9. <servlet-mapping>



In the above case what if there is no servlet existing?
say there is only Results.jsp and I want to redirect to this jsp after hitting submit button on my HTML.

I will say action="Result.jsp" on my HTML, right?

But then what goes in web.xml?
or is it that instead of <servlet-class> I put in <jsp-file>?

or is it that I'm confusing between <jsp-file> and <jsp-config>?
12 years ago
JSP
Thank you Avi.

But I'm really confused because it is unclear how the mapping from an HTML to the particular JSP ( which is a servlet eventually) done

Like in Servlet mapping it is very evident from the web.xml viz. through <servlet-name> , <url-pattern> and <servlet-class>

But the same transperency is not with the JSPs. So my point is how the HTML finds/maps the servlet that is generated from the JSP?
12 years ago
JSP
Hello,

This is in reference to the code snippet from Head First Servlets and JSP page 359.

The heading says Going straight from the request to the JSP without going through a servlet

I was eager to try out the code but wondered how the web.xml would look if I have say a JSP called Test.jsp under root of my application, is the code below the right one:

web.xml


What should come in place of ...??

Thank you.
12 years ago
JSP
Hi

I am curious to know if in Date or Calendar class is there a provision for incrementing a date?

Like in Oracle they have


Please let me know, since I need to use it in many places in my application.

I made up my own code for the same which has many checks like if the year is a leap, enums for months with 30 and 31 days etc.

Thank you.
12 years ago
Please refer to the code below and help me understand the execution better.
Also how do things work on stack memory?

class sample
{
static int i = 0;
public static void main(String[] args)
{
System.out.println("Hello world");
test();
System.out.println("i = "+i);
}
static int test()
{
try{

System.out.println("in try value of i::"+i);
return ++i;
}finally{

System.out.println("in catch value of i::"+i);
return ++i;
}
}
}

Thank you.
12 years ago