|
Search Google for "Convert C# to Java". I got this. CS2J[^]
|
|
|
|
|
hi,
try JavaOnet.
i tried it, is working fine, but you need license to use it.
|
|
|
|
|
am using spring MVC and jsp for developing the application. I have a scenario in which I can create or delete a record. index.jsp is the main page where users can see all the records, from there we can create or delete the record, once created or deleted the controller comes back to the same index.jsp with latest changes being shown on the page. Issue is its working fine in FF and chrome but in IE, if I want to see the latest added record or remove the deleted record from the list, I have to close the browser manually and reopen it. I have tried all possible response.setHeaders..to remove the cache in IE. The other approach I tried is to redirect the spring controller, but still IE is not refreshing and not showing the latest changes in index page. Code is as below:
<pre lang="java">@RequestMapping(value = "/createRequest", method = RequestMethod.GET)
public ModelAndView createRequest(final HttpServletRequest request,
final HttpServletResponse response,..)
//logic to create or delete record..
return new ModelAndView("redirect:myredirectPage.htm");
}
@RequestMapping(value="/myredirectPage", method=RequestMethod.GET)
public ModelAndView showMyRedirectPage(){
ModelAndView modelView = new ModelAndView("index");
return modelView;
}
I have added no cache tags in index.jsp as well as create.jsp where we will create the record. Below is the code i kept in jsp: index.jsp:
<%
response.setHeader("Cache-Control","no-cache");
response.setHeader("Pragma","no-cache");
response.setDateHeader ("Expires", -1);
%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="Expires" CONTENT="-1">
..
</html>
create.jsp:
<%
response.setHeader("Cache-Control","no-cache");
response.setHeader("Pragma","no-cache");
response.setDateHeader ("Expires", -1);
%>
<!DOCTYPE HTML>
<head>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<%@page isELIgnored="false" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@page import="java.util.Date" %>
...
Thanks.
|
|
|
|
|
Hello,
If you are using BaseFormController or MultiActionControllers then in your XML configuration file set cacheSeconds to 0. This will force controller to automatically output the cache control headers. If you are using annotated controllers then you can use a bean post processor and in it for Bean of type WebContentGenerator set cacheSeconds to 0. Please find below the sample Bean Post Processor
package org.freeware.bizsutra.utils;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
public class DefaultPostBeanProcessor implements BeanPostProcessor
{
int _intCacheSec = 0;
ConfigurableWebBindingInitializer _webBindingInitializer = null;
public int getCacheSeconds()
{
return _intCacheSec;
}
public void setCacheSeconds(int cacheSeconds)
{
_intCacheSec = cacheSeconds;
}
public ConfigurableWebBindingInitializer getWebBindingInitializer()
{
return _webBindingInitializer;
}
public void setWebBindingInitializer(ConfigurableWebBindingInitializer webBindingInitializer)
{
_webBindingInitializer = webBindingInitializer;
}
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException
{
if (bean instanceof RequestMappingHandlerAdapter)
{
((RequestMappingHandlerAdapter) bean).setCacheSeconds(0);
((RequestMappingHandlerAdapter) bean).setWebBindingInitializer(webBindingInitializer);
}
return bean;
}
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException
{
return bean;
}
}
Regards,
<div class="signature">Prasad P. Khandekar
Knowledge exists, man only discovers it.</div>
|
|
|
|
|
sir im using two different table table1 and table2
in table1 im storing user details and
table2 storing username and password .
when the user login with table2. he want to same person details only .
how it is passable please help me.
|
|
|
|
|
Does this have anything to do with Java? If so please explain exactly what the issue is.
|
|
|
|
|
Use appropriate forum to post your questions.Please see this[^] before posting another question
In both tables ,the common id will be USERID(assumption).Use INNERJOIN to join the tables by the common column(USERID).
Check these to know about joins:
Joining Tables in SQL[^]
Visual Representation of SQL Joins[^]
You have to learn to think like a computer or teach him to think like a human.
-Kornfeld Eliyahu Peter
|
|
|
|
|
Here is the question:
12-player are in a 6-day competition. The competition have 6 different games. the rule is:
1. Every player must participate all 6 games.
2. Each player can only play the same game ONCE.
3, Each player can only play with the same opponent ONCE.
right now I use two method "isPlayed()" and "isPlayedWith()" to set players in a loop, but it doesn't work. I guess I have to some other way. But right now I have no clue how to design the algorithm. please help me out. I can write code myself, I just need to learn HOW.
Thank you very much
|
|
|
|
|
There is a forum for Algorithm questions. Alternatively you could show the relevant parts of your code and explain what is meant by:
Member 10409221 wrote: but it doesn't work
|
|
|
|
|
Hi, relatively new to java, and wondering how I should make the following construction:
Got 3 tables let's call them A, B & C.
Reverse engineered those with Hibernate. C refers to A & B with foreign keys, no other relations.
Hibernate translates those foreign keys as getA() and setA(A a) in my C class.
So how do I make a query that says I need all C where A.Id = 1 ?
Here is what I got so far, but generates an error: invalid path null.A
Query q = session.createQuery("select C from A inner join C.A where A.Id="+String.valueOf(a.getId()));
|
|
|
|
|
Looks like your String.valueOf(a.getId()) expression is not generating anything. Use your debugger to see what is happening.
|
|
|
|
|
that expression is working fine, it's the only thing on that line that IS working.
Based on the error I get, it looks like the join isn't working good. But I don't have enough knowledge to fix it.
|
|
|
|
|
I'm afraid that's an SQL issue, nothing to do with Java.
|
|
|
|
|
It's a Hibernate issue which is part of Java, so I think otherwise. But let's ask the question differently:
I want to get a list of type C where the property of type A matches a value of type A.
Or put in practice: I have a combobox filled with a list of type A. Type C has 2 properties: a & b. a is of type A, b is of type B. Now I want a list of type C where property a matches the value of the combobox.
How would you do this with using Hibernate?
|
|
|
|
|
Sorry, I don't know Hibernate.
|
|
|
|
|
Dated: 29th April 2014
To,
The Managing Director
Southtech Limited,
Plot -1, Road -13, Sector -1,
Uttara Model Town, Dhaka 1230
Subject: Resignation Letter for the position of Ascend Programmer.
Dear Sir,
With due respect, I would like to inform you that, I have some problem to continue my job in your organization and have intention to leave my position as Ascend Programmer from your Ascend ISS Department in Southtech Limited.
It was a great honor for me to work with you. Due to family crisis, financial and physical problem, I am unfitted in this job position. Right now, no pending projects are dependent on me. I feel tremendous problem to continue my work. Therefore, I would like to request you to relieve me of my duties immediately. Please be assured that I will do all I can to assist in the smooth transfer of my responsibilities before leaving.
I wish both of you and Southtech Limited, every good fortune and I would like to thank you for having me as a part of your team.
Best regards,
Mostafizur Rahman
Ascend Programmer
Pin: 641
Souttech Limited
Contact: +8801675876752
Email: mostafizur.cse@gmail.com
C.C.:
1. Md Zayed Zulfikar, Chairman, Southtech Limited, Sector -1, Uttara Model Town, Dhaka 1230
2. Md. Shajibul Hussain Talukder, Senior software developer, Ascend ISS, Southtech Limited, Sector -1, Uttara Model Town, Dhaka 1230
3. Human Resource Department, Southtech Limited, Sector -1, Uttara Model Town, Dhaka 1230
how can read all line in java with formating in above message
|
|
|
|
|
Given that we have no idea what formatting you are talking about, it is impossible to answer. Please explain the format used in the file.
|
|
|
|
|
I think you should use BufferedReader/Writer. According what i saw, it looks like simple text.
PS: My English's not good, please ignore my mistake.
|
|
|
|
|
private List<Patienthealthdata> patientHealthDataList = new ArrayList<Patienthealthdata>();
patientHealthDataSet = medicalHistoryService.getLatestMedicalHistoryDataAttributes(patient);
String groupName = patientHealthData.getHealthdata().getHealthdatagrouplinks().iterator().next().getHealthdatagroup().getName().trim();
if (groupName.equals(Constants.HELTH_GROUP_BMI)) {
if (patientHealthData.getHealthdata().getName().contains("Height (ft)")) {
for (Entry<Integer, String> entry : heightMap.entrySet()) {
if (entry.getKey() == 1) {
valHeightFt = entry.getValue();
}
if (entry.getKey() == 2) {
valHeightInch = entry.getValue();
}
int indexInch = valHeightInch.indexOf('\'');
if (indexInch > 0) {
valHeightInch = valHeightInch.substring(0, indexInch);
}
int indexFt = valHeightFt.indexOf('\'');
if (indexFt > 0) {
valHeightFt = valHeightFt.substring(0, indexFt);
}
if (!valHeightFt.equals("") && !valHeightInch.equals("")) {
newValue = valHeightFt + "'" + valHeightInch + "\"";
patientHealthData.setHealthDataValueDisplay(newValue);
}
}
patientHealthDataList.add(patientHealthData);
}
|
|
|
|
|
Not sure what the question is but TreeMap might be the answer since it is a sorted collection.
|
|
|
|
|
Any body can give me java code similar to ASP.net
ISNOTPOSTBACK
so that I can fetch / fill my current page values without refreshing the page and If I filled the half of my form they will not get effected
|
|
|
|
|
Hello,
There are multiple ways
- Using the JSTL tag libraries in plain JSP
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
...
<input id="txtFName" name="txtFName" value="${fn:escapeXml(param.txtFName)}">
...
<textarea id="txtLName" name="txtLname">${fn:escapeXml(param.txtLName)}</textarea> - Using Spring Framework & Spring Form Tag Library
Regards,
Prasad P. Khandekar
Knowledge exists, man only discovers it.
|
|
|
|
|
I want to display notification (messages/data updates) by other users on the my current loginuser page.
example as soon we get mail, our page will change update new mails without refreshing entire page.
Please help me
|
|
|
|
|
1: procedure AllocateVM(VMList)
2: i←1;
3: while VMList ≠ ɸ do
4: HostId ←RankingAlgo(HostList; Requirmenti; Rank);
5: HostHostId←VMi ;
6: i←i + 1;
7: end while
8: end procedure
1: procedure RankingAlgo (HostList; Requirment; Rank)
2: for each Host € HostList do
3: if Host Satisfies the Requirments then
4: add (MemberList;Host);
5: end if
6: end for
7: PriorityList← SortByRank(MemberList;Rank);
8: AllocatedHost←PriorityList(1);
9: Return AllocatedHost;
10: end procedure
|
|
|
|
|
There is nothing in there that requires anything more than a understanding for the java language (no API needed.)
So the idea is learn basic java and then write the code.
|
|
|
|