Eugene Lucash

Ranch Hand
+ Follow
since Feb 19, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Eugene Lucash

Vjy Chin,
Althought you described your problem more cleanly now, still there are many
white spots.
I'll try with all info I got up to now, so...

You can avoid submitting forms in such explicit way.

First you must investigate interfaces of Other's site form in detail.
Pretend yourself like a spider bot surfing to company's website.
You don't see presentational markup,
you only see form, it's action url, http method (post or get).
And names of fields,
knowing their requirements to corect format of values

When you know this information,
you can use, for example, Apache commons HttpClient library
http://jakarta.apache.org/commons/httpclient/

With this library you can automatically construct REQUEST's
to appropriate server and fill them with appropriate values, then submit.

HttpClient used programmaticaly, for example in any servlet
or java application.


PS, Dear, Bear Bibeault, move this back to Servelts or JSP so more people
can put their thougth on this topic.
Jsp is server side. JavaScript is client side.
JavaScript appears in jsp as ordinary html markup or the template text,
and nothing more.
Jsp cannot call javascript, it can only write fucntions or calls
to response output so browser will execute it.
20 years ago
JSP
You must name context xml as 'ora.xml'
and put it like this

CATALINA_HOME\conf\Catalina\localhost\ora.xml
20 years ago
Dear, Bear Bibeault.
I think you have made a mistake.
this is more JSP question, about how leverage flow of server
side iteration, so little script acts like helper and not more.
Consider reading & understanding posts before moving something..

TAB,F6,ENTER,TAB,F6,ENTER.....
... I like to move it! move it!,I like to move it! move it!
On server (jsp) you can save on server something and print on network printer.

On client (js) you can save only manual by browser so preventing unfriendly pages to operate you disk content. Only you can do is open print dialog

window.print();
Eric, you mean using technique which called "javascript triggers"?
Another solution is using dynamic server side webpages
Yes, you can do i18n with JSTL, Struts, Whatever.
you only need read documentation.
20 years ago
JSP
Want Dependency Injection?
Hehe!
20 years ago
JSP
Introducing PSEUDO code to give you insight
This is not real code but it shows main idea



SELECT Name, Id FROM Users WHERE Id=SomeId
ResultSet rs = use jdbc ^^^^
MyUserBean mub = MyUserBean();
mub.setId(rs.getInt("Id"));
mub.setName(rs.getString("Name"));
%>
<form action="/editUser.jsp" method="post">
<input type="text" name="name" value="<%=mub.getName()%>">
<input type="text" name="id" value="<%=mub.getId()%>">
<input type="submit">
</form>

----->>
SUBMIT
-->>>
<%
String id = request.getParameter("id");
String name = request.getParameter("name");

JDBC...
"UPDATE Users SET id= " + id
+ ", name='" + name + "' WHERE id = " + id;
Execute it
%>
20 years ago
JSP
I think you a little confused ;
You are all wrong

So... Where to begin...

1. do not use META refresh at all in your case. althougth it may be helpful, but not in your case, because form must be submitted and don't redirected
if I understand your problem clearly.

2. You want to display one user info at a time and then
automaticaly submit it after a while? Then you have misconseption about
what is going on on server and what's going on in browser.

So... In servlet save details in session
I do not know way in which you organize you servlets,
but I think you'll be able use those snippets.
####################################
Servlet #1 lets map it something like /showAll
//.... in body of servise method
List objArrayList = get reference to info list
//assert objArrayList.size() > 0 : "Non Empty List";
request.getSession().setAttribute ("DETAILS", objArrayList);

Integer i = new Integer(1);
request.setAttribute("currentindex", i);

forward ("viewInfo.jsp") //use request dispatcher
//end of snippet
####################################
Servlet #2 let map it something like /oneInfo
//.... in body of servise method

//.... process submitted values from Info (HashMap) input field here

String si = request.getParameter("index");
int ii = safely convert si to int.....
List l = (List)request.getSession().getAttribute("DETAILS");
if (l.size() >= ii) {
request.getSession().removeAttribute("DETAILS");//CleanUp
forward ("end_of_loop") //use request dispatcher to go out of this loop
}
request.setAttribute("currentindex", new Integer(ii + 1));
forward ("viewInfo.jsp") //use request dispatcher to display next
//end of snippet

.....
####################################
And finally JSP
.....
<%
List objArrayList = (List)request.getAttribute("DETAILS");
Integer currenIndex = request.getAttribute("currentindex");
HashMap m = (HashMap)objArrayList.getAt(currenIndex.intValue());
%>
<form name="frmServeBetter" method="post" action="/oneInfo" ><!--Servlet#2 will process this form -->
...............
<INPUT class=field value = "<%=objHashMap.get("FIRSTNAME")%>" name="FirstName" size="20" >..........
<INPUT class=field value = "<%=objHashMap.get("LASTNAME")%>" name="LastName" size="20">..........
<!--AND SO ON WITH ALL FIELDS OF RECORD-->
................
<!--Here some inportant things. Hidden Index that we use in servlet#-->
<input type="hidden" name="index">
<input type="Submit" style="display:none"/>
</form>

<script type="text/javascript">
window.on1oad = function () {
var act = function(){document.frmServeBetter.submit()};
window.setTimeout(act, 5000 /* timeout in miliseconds */);
}
</script>

Hope you'll understand main idea
[ March 14, 2005: Message edited by: Eugene Lucash ]
ServletContext.getRealPath(String)
20 years ago
Most novices misunderstand the flow of web applications.
When response is sended back to browser, browser do not have
any special knowledge who generated request (servlet, jsp, struts(manual?,jsp?,velocity?)).
But you can pass this information by yourself. For example, generate hidden
field in response form, so your next submit processing can investigate this parameter.

--> Render response
Servlet -->
out.print("<input type='hidden' name='generator' value='servlet'/>");
Jsp -->
<%= ssdsd %><input type='hidden' name='generator' value='jsp'/>

--> Submit
-->
String gen = request.getParameter("generator");
if (gen != null && gen.equals("jsp")) {
...
} else {
......
20 years ago
Have you tried to use batch files as link targets? (Migth not work either)

About browser path. I think that you can't dynamically investigate location of browser files path, because of security reasons (browsers allows do only things that matches it's sandbox). If path fixed or can be saved for particular user than it is not a problem.
[ February 27, 2005: Message edited by: Eugene Lucash ]
Jsp development is not desktop development.
Try to think about webapp in terms of pages, query parameters and
form posting. To retreive some data you almost always need to post some
data to server and return the same page or another one with updated values.
Similar topics have been discussed here many times (recently)

regards
20 years ago
JSP