bala kannan

Greenhorn
+ Follow
since Jan 22, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by bala kannan

Hi Tim, formatting in the sense i meant about the bold and italicized content. I am not sure when i store a bolded and Italized text(of String data type as you suggested) on to varchar will it be same or not.

As suggested i will implement the way you suggested rtf text stored in a String(Java Side) and the same in database (either varchar or clob). Hope it works successfully.
13 years ago
Thanks for reply tom.

The scenario goes like this. From the client side(EXTjs) i will be collecting the text sent in RTF. I need to first grab with some data type that supports RTF in java and then store the same in database and retieve it( without affecting the format of the text). Will it be possible using Strings? If i store strings in DB as varchar, the entire format of rich text will be lost rite?

I had thought of file handling by capturing the text from client in a RTF file and then storing the file as a BLOB object in DB. But the idea is rejected here.
Please help.
13 years ago
Hi All,

I have a basic question. I want to know how to store rich text content in java. Is there any specific data type to hold such data without affecting the original data. I should be in a position to store the rich text content on to some variable(of data type that supports RTF) and retrieve it when ever required.

We don use swings here. Also this requirement should be met without file handling. Please help me in this regard.



13 years ago
I request some one to suggest a solution here as i am stuck with no way forward. My requirement. When i click the question number in the right frame. The corresponding question should be displayed in the left frame.Insted when i click it, it only gets appended..
Hi All,

I am trying to develop a quiz application based on MVC architecture using JSP and servlets. I have a frame where left side displays the questions and right side displays the set of buttons(total no of questions). When i click on "2" button, its not overwriting the left pane, instead its appending with the left one and displaying 1,2 questions. When i click on 3rd button, the left pane is not getting overwritten. In my servlets i am using request Dispatcher to forward to Jsp which will display the frame. Can you please hel out here. Below is my code

//Frame displaying left side question and right side buttons


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<frameset cols="60%,*">
<frame src="questiondisplay.jsp" name="displayquestion"/>
<frame src="questionset.jsp" name="questionset"/>
</frameset>
</html>

------------------------------------------------------
//Page with buttons

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript">


</script>
<form name="fetch" method="post" action="questionDisplay">
<input type="hidden" name="btn"/>
<table>
<%
//Object o=request.getAttribute("size");
//Integer size=(Integer)request.getAttribute("size");
//int no=size.intValue();

for(int i=1;i<=25;i++) {%>
<tr>
<td>
<input type="button" value="<%=i %>" onclick="{document.fetch.btn.value=this.value;document.fetch.submit();}"/>
</td>
</tr>
<%}
%>
</table>
</form>
</body>
</html>
------------------------------------

//Page to display question

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form name="display">
<jsp:useBean id="ques" scope="application" class="questiondisplay.FetchQuestion"/>
<table align="center" width="45%">
<tr>
<td>
<jsp:getProperty name="ques" property="question"/>
</td>
</tr>
<tr>
<td>
<input type="radio"/>
</td>
<td>
<jsp:getProperty name="ques" property="option1"/>
</td>
</tr>
<tr>
<td>
<input type="radio"/>
</td>
<td>
<jsp:getProperty name="ques" property="option2"/>
</td>
</tr>
<tr>
<td>
<input type="radio"/>
</td>
<td>
<jsp:getProperty name="ques" property="option3"/>
</td>
</tr>
<tr>
<td>
<input type="radio"/>
</td>
<td>
<jsp:getProperty name="ques" property="option4"/>
</td>
</tr>
<tr>
<td>
<input type="submit" value="Next"/>
</td>
</tr>
<tr>
<td>
<input type="submit" value="Previous"/>
</td>
</tr>
<tr>
<td>
<input type="submit" value="submit"/>
</td>
</tr>
</table>
</form>
</body>
</html>
-------------------------------------------------------

//Servlet code

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
int btnvalue=Integer.parseInt(request.getParameter("btn"));
String username=(String)request.getSession().getAttribute("username");

try{
database db=new database();
Connection conn=db.getConnection();
Statement stmt=conn.createStatement();
String query="select * from "+username+" where qno="+btnvalue;
ResultSet rset=stmt.executeQuery(query);
rset.next();
qno=rset.getInt(1);
question=rset.getString("question");
option1=rset.getString("option1");
option2=rset.getString("option2");
option3=rset.getString("option3");
option4=rset.getString("option4");
FetchQuestion qdisplay=new FetchQuestion();
qdisplay.setQuestionInfo(qno, question, option1, option2, option3, option4);
request.getSession().setAttribute("ques",qdisplay);
RequestDispatcher send=request.getRequestDispatcher("questions.jsp");
send.forward(request,response);
//response.sendRedirect("questions.jsp");
}catch(Exception e){
e.printStackTrace();
}
}
------------------------------------------