Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!

jinesh parikh

Ranch Hand
+ Follow
since Apr 20, 2007
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 jinesh parikh

@John Cruz Thanks for the prompt reply.

Actually, we have some constraints with the third party server hence so we are not allowed to place jsp there.

Anyways, If we are keeping the same design as dictated in my question , Is there any possible way I can make below things work.

1.Is it possible to make the user defined object available using the RedirectAttribute class in the case of redirecting the request using some other workaround?
2.In future I will be validating the jsp form using the Spring Validation support in that case I need to made available org.springframework.validation.BindingResult object to my jsp page in the application A so will that be possible as well?
7 years ago
@Thanks John Cruz for your prompt reply.

Application A contains JSP pages only and nothing else. Application B has controllers, Models and Service layer and persistence layer.

Any GET and POST request submitted by the JSP page of Application A must go to the controllers created in the Application B. The controllers in the web application B must handle the request , if all the validations are correct then they will call the service layer in the application B and store the data in the oracle database. But If there are any validation errors then they must return the error messages back to application A and display the jsp page.

Originally, I have tried to mimic the production environment scenario over here. In case of the production environment we have Application A needs to be deployed on the Weblogic and Application B needs to be deployed on the Websphere server. But for some reason, we don't want the JSP pages to be placed on the websphere sever's box(I don't now the reason).

Please do let me know If I failed to clear your doubts. One more follow up question is that Is it a good design having the JSP page on one Application and the controllers and models needed to handle the request of this JSP page is been placed in the different application?
7 years ago
I am new to the Spring MVC. I am using the Spring release 4.1.6 and deployed my two web applications A and B on tomcat 7 for the development environment. But in the actual production environment the application A will be deployed on weblogic and application B will be deployed on websphere. Below is the scenario occuring on the development environment.

Application A has testrequest.jsp page available in the test directory.Below is the code for the jsp page.



If we look at the action attribute of the form carefully , when the form submits the request must go to the TestController.java. TestController.java has methods to handler the GET(load the page) and POST(submit the page) request.Below is the code for the same.



Below is the RequestDetails(Model) object available in the application B.



When I am executing the URL to display the jsp page http://localhost:8080/b/createtestrequest.test (to set the empty model object in the request) then the controller method**(requestForm(HttpServletResponse httpServletResponse,HttpServletRequest httpServletRequest,RedirectAttributes redirectAttrs)**) to handle get request does gets invoked with the below output but it does redirect to the page testrequest.jsp available in the test directory of the Application A. But it is giving the below error on the browser

output on the tomcat console

*********** Get Request reaches the TestController *******************

Below is the error coming on the browser



I somehow need the Userdefined object "testobj"available in my request object to load the test.jsp page with the available values in the object but it seems to be not working as expected.I have two questions

1.Is it possible to make the user defined object available using the RedirectAttribute class in the case of redirecting the request using some other workaround?
2.In future I will be validating the jsp form using the Spring Validation support in that case I need to made available org.springframework.validation.BindingResult object to my jsp page in the application A so will that be possible as well?

In simpler terms let me explain the problem. I have jsp page in application A , when I execute the url to load the page, the controller is available on application B needs to be invoked.The controller must set the model object and redirect to the jsp page on the application A.
7 years ago
Hi,

I was reading this post on why people use setter injection more than constructor injection.But I could not understand the first reason as well.

Spring maintained its focus on setter injection because at the time, we believed that the lack of default arguments and argument names for constructor arguments resulted in less clarity for developers



can somebody please explain me the first reason stated above?

Any help would be appreciated.

Regards,
Jinesh
10 years ago
I am working weblogic 10.3.I am facing issue while deploying the war files.We have created the ant scripts for deploying the war file to the weblogic server.

When we run the ant scripts it deploys the war files to the managed server.We need to shut down the server before we ran the scripts.

But after running the scripts i have checked the logs and also the upload directory of admin server where our changes are reflected.

But when i started the managed server changes are not getting reflected in the Stage directory of managed server and hence when we run the application we are not able to see our changes.

The issue is specifically coming on Sun Solaris platform else on the Linux environment the things are working fine.

Could somebody please help me in resolving the issue?

Is it something else needs to be done for the sun solaris somekind of ?

11 years ago
thanks for the answer ankit.

by mistake i have written enumertaion instead of enum data type.

sorry for my mistake.

i want to know why it can not be applied to enum data type.

any help would be appreciated
Hi all,

I am currently learning java generics.i want to know one simple thing.

which are the specific things in java on which generics can not be applied?

one thing i know is that it can not be applied to enumertaion.

but i don't know why?


can somebody provide me answer to this.

please correct me if i am wrong.
Hi

I have a question in generics regarding the wilcard characters.Wilcard characters when used during the creation of instance behave strange.

consider the following statement.

List<?> list = new ArrayList<?>();

Above statement gives me compile time error.

List<List><?>> lists = new ArrayList<List><?>>();

Above statement is working fine.My Question is why?

what is the problem with the first one?


Any help would be appreciated.

Hi all

i am using struts-1.2.9 and Jboss4.0.4 GA and mysql 5.1 as a database.My Question is regarding the character encoding in UTF-8.

I am making the ajax call to send the data to the server.in the ajax call i have made use of the following to set the character encoding to UTF-8

encodeURIComponent(document.getElementById("fname").value)
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");

but when i fetch the data on the server side

if i have enetered data in the first name field as šašal?lyj?? i would get the data Å¡aÅ¡al?lyj?? on the server side.

i don't know why it is changing the characters ???

i have also made changes to set the character Encoding to UTF -8

i have attached the source code of my files below to made you understand my problem.


1.setting the content type in the JSP page
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

2. I am also placed the filter that will set the character encoding of the request and response to UTF-8.Code of the Fileter SetCharSet Filter is below attahced


package com;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class SetCharsetFilter implements Filter{


private FilterConfig config;
public SetCharsetFilter()
{
config = null;
}

public void init(FilterConfig config)
throws ServletException
{
this.config = config;
}

public void destroy()
{
config = null;
}

public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain)
throws IOException, ServletException
{
System.out.println("Setting the Character Set ***********");
servletRequest.setCharacterEncoding("UTF-8");
servletResponse.setCharacterEncoding("UTF-8");
HttpServletRequest req=(HttpServletRequest)servletRequest;
System.out.println(req.getParameter("firstName"));
// Set the content type in the header of the response servletResponse.setContentType("text/html;charset=UTF-8");
chain.doFilter(servletRequest, servletResponse);
System.out.println("Ending the Character Set ***********");


}

}


i am also attaching the JSP file on which i have placed one firstName field

AddContact.jsp
-------------------------
--------------------------

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="cache-control" content="no-cache" >
<meta http-equiv="expires" content="0" >
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript">

function ajaxFunction()
{
try
{
xmlHttp=new XMLHttpRequest();
}
catch(e)
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
//alert("Created XMLHttpRequest Object");
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{
alert("Your browser doesnot support the AJAX");
}
}
}
}

function frmSub(){
ajaxFunction();
pth='<%=request.getContextPath()%>';
alert("path is ");
var str=pth+"/addcontact.do?firstName=";
alert(document.getElementById("fname").value)
str+=encodeURIComponent(document.getElementById("fname").value);
alert("Final Path Is :" + str);
xmlHttp.open("post",str,true);
xmlHttp.onreadystatechange = hndlRespAddCont;
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
xmlHttp.send(null);
}
function hndlRespAddCont()
{
if(xmlHttp.readyState==4)
{
if(xmlHttp.status == 200)
{
alert("handlerResponseCreate gets Called **********");
}
}
}

function frmTest(){
document.AddContactForm.submit();
}
</script>
</head>
<body>
<html:form action="/addcontact.do" acceptCharset="UTF-8" enctype="multipart/form-data">
First Name :<html:text property="firstName" styleId="fname" />

<input type="button" value="Login" onclick="frmSub()"/>
</html:form>
</body>
</html>


in the above code if on the button Login's click event when i call the function frmTest() it works fine i get the correct data on the server side.But when i am sending the data using the ajax using the function frmSub() then i will get the different data.


Please help me .

Any Help would be appreciated.





12 years ago
Hi all,

I have created some of the examples of the JCF (Java Collections Framework).One thing that had confused me is that

When we are iterating a Colection say ArrayList using the iterator and during the iteration if we try to modify the collection by by calling the ArrayList's add method then it will give me the exception
ConcurrentModificationException.

But i did the iterations and try to add the new element by using the listiterator's add method then it is not giving me such exception.

My Question is why is such a different behaviour is there? Why java allowed to modify the collection using the iterator's own methods when iterating and why not through the arraylist method ?

After all both ways we are going to add the element to the ArrayList .

Please any help would be appreciated.
Hi all,

I was reading JCF(Java Collections Framework) i found certain methods are Optional in the Collection interface.

Why these optional methods are required in interface ? since interface when implemented all its methods must provide proper implementation

Please help me i am getting confused


I found my answer on the following link

https://coderanch.com/t/291668/JSP/java/difference-between-set-body-no

Regards
Jinesh Parikh
13 years ago
JSP
Hello all,
I am using JSP2.0. i have created one simple application in which form gets submitted and servlet gets called which creates the map and place it inside the session scope and redirect the page to the new jsp page.I am deploying the application on the server jboss 4.0.2 -GA.

Here is the Directory Structure of my Web Application.

----------------------------------
Structure of my Web Application
----------------------------------

SCWCD
|
|
WEBCONTENT
| | |
| | |
| | JSP
| | |
| | |
| | index.jsp
| WEB-INF
| | |
| | |
| | classes
| | |
| | <compiled classes>
| lib
| |
| <All the libraries are here>
finalresults.jsp












-----------------------------------------
Output After Executing OptionalServlet
-----------------------------------------

Class of the person attribute :class java.lang.String
15:30:52,839 INFO [STDOUT]
Value of the person attribute :Beans.Employee@b1404f
15:30:52,839 INFO [STDOUT]
Class of the person1 attribute :class Beans.Employee
15:30:52,839 INFO [STDOUT]
Value of the person1 attribute :jineshparikh


Now i have read in HFSJ that when we are using the <c:set> tag then in that case either i can use the value attribute of the tag or i can specify the value in the body of the tag.What ever the evaluated value's type would be the type of the attribute.

But here in the above example look at the code of the finalresults.jsp




in the above code where i have used the body for the person1 attribute and value for the person attribute. In both of the case i have assigned them value of the attribute named person which was set in the personal attribute.Here the ${sessionScope.personal} attribute evaluates to person class object. But when i access the both of the attribute in my optionalServlet.java i got the following result


[output]
Class of the person attribute :class java.lang.String

Value of the person attribute :Beans.Employee@b1404f

Class of the person1 attribute :class Beans.Employee

Value of the person1 attribute :jineshparikh
[/output]


you can clearly see the difference in the output. For the person attribute data type is string and for the person1 attribute data type is Employee object.

My question is why there is a difference in the data type of the person and person1 attribute. when both of them are set to same value.

Please help me on this issue.

Any help would be appreciated.

Regards
Jinesh Parikh.

Please
13 years ago
JSP
Thank you steve for the answer.

Now it is working fine.

Currently I am reading "Head First Servlets and JSP" of oreilly publication.This book is also very good.

But if i want to read JSP and Servlet in more detail then
Could you please suggest any good book for reading JSP?

Regards
Jinesh Parikh.
13 years ago
JSP