Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!

Anju sethi

Ranch Hand
+ Follow
since Dec 26, 2005
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 Anju sethi

Thanks Gowher,

"if servlet implements SingleThreadModel then there can have multiple instances in memory.if there are 5 threads accessing single servlet at a single time then there may be 5 instances of servlet present in memory.But it depends upon container."

That is amazing. This helped me in understanding better.

Few more doubts to clarify more:

1. I believe all containers mentain a single instance of servlet to service multiple threads/requests. SingleThreadModel is an exception wherein multiple instances are created to service multiple threads/request. I am Correct ??
Hi,

In Servlet 2.4 Spec, Unavailable Exception is thrown by servlet instance during initialization.

Can anyone explain me what does this exception mean??

-Anju
Thanks Gowher,

I am all the more confused.

1. "if servlet implements SinglethreadModel then only single thread access servlet at a time. But if there is request from other thread then SinglethreadModel will not block it. SinglethreadModel is used if you have single servlet model."

What kind of synchronization does SingleThreadedModel provide if it does not block another thread accessing Servlet at the same time. Why anyone would ever use it"

Please help
Hi,

I was going thru Single Thread model in Servlets 2.4 Spec.

Can anyone help me explaining this point:

"The use of SingleThread Model interface guarentees that only one thread at a time will execute in a given servlet instance's service method. This guarentee applies to each servlet instance, since container may choose to pool such objects. Objects that are accesible to more than one servlet instance at a time such as HttpSession, may be available at any particular time to multiple servlets , inclusimg those that implement SinglethreadModel".

How container handle such thing??

Thanks,
Anju Sethi
Hi,

Can anyone tell me a function in java that append elements of two arrays in destination array.

I am unable to recall. I do nt want to use any loop to do the same.


Please help
12 years ago
Remember Static means Class Level and non static means Object Level.

Static variables are created and initialized before non static variables that means static variables are availiable and are in the context of non static. Therefore One can refer static members using object of the Class also.

And As non static are not created before static members ...they do not exist in the context of static members. Therefore non Static members can not be referenced from static directly without making object.

Then, regarding your Query....

Q. How main method(static) is able to access both static and non static method
A: If you notice...you have made object before accessing non static method from main. Without making object, you can not access it.
12 years ago
Yes, U are correct. We convert non-unicode charset to unicode by passing it in the string constructor and unicode to non-unicode by using getBytes method.

Refer this link:
http://java.sun.com/docs/books/tutorial/i18n/text/string.html
12 years ago
Please help
13 years ago
This is my jsp page

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

<html:html locale="true">
<head>
<html:javascript formName="LoginForm" />
<link rel="stylesheet" href="global.css" type="text/css" >
</head>

<body bgcolor="#eeeeee">
<table align="center">
<tbody>
<tr>
<td align = "center">
<h2><bean:message key="tlms.jsp.loginform.heading"/></h2>
</td>
</tr>

<tr>
<td align = "center">
<b><html:errors property="loginForm"/></b>
</td>
</tr>
</tbody>
</table>

<html:form action="LoginAction.do" focus="userId" onsubmit="return validateLoginForm(this)">
<table align="center">
<tbody>
<tr>
<td align="right"><span class="required">*</span>

<bean:message key="tlms.loginform.userid" /></td>

<td align="left">

<html:text property="userId" /></td>

<html:errors property="userId"/>
</tr>

<tr>
<td align="right"><span class="required">*</span>

<bean:message key="tlms.loginform.password" /></td>

<td align="left">

<html assword property="password" /></td>

<html:errors property="password"/>


</tr>

<tr>
<td> </td>

<td><html:link forward="ChangePassword">change password</html:link></td>
</tr>

<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td align="center" colspan="2"><html:submit property="submit" value="Submit" />
<html:reset>Reset</html:reset></td>
</tr>
</tbody>
</table>
</html:form>
</body>
</html:html>
13 years ago
Hi Friends,

I am also trying to validate my login form in struts using Validator form.

I made my form class extend the ValidatorForm class,and wrote all the validation components,and its validating but no pop-up box is coming up.
And I have disabled my pop-up blocked too.Here's are my parts:

validation.xml:

code:
--------------------------------------------------------------------------------

<formset>
<!-- An example form -->
<form name="LoginForm">
<field property="username" depends="required">
<arg key="tlms.logonForm.username" />
</field>
<field property="password" depends="required,mask">
<arg key="tlms.logonForm.password" />
<var>
<var-name>mask</var-name>
<var-value>^[0-9a-zA-Z]*$</var-value>
</var>
</field>
</form>
</formset>
--------------------------------------------------------------------------------


Struts-config.xml:

code:
--------------------------------------------------------------------------------

<action-mappings>
<action path = "/LoginAction"
type = "com.hsc.tlms.action.LoginAction"
name = "LoginForm"
scope = "request"
validate="true"
input = "/JSP/Login.jsp"
>
<forward name="LoginSuccess" path="/HomeAction.do" />
</action>
</action-mappings>
.... .... ....

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>

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


LoginForm class:

code:
--------------------------------------------------------------------------------

public class LoginForm extends ValidatorForm{ // getters and setters}

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



Login.jsp

code:
--------------------------------------------------------------------------------

<html:form action="LoginAction.do" focus="userId" onsubmit="return validateLoginForm(this)"><table>
<tr> ... ... ... </tr>
</table>
<html:submit property="submit" value="Submit" />
</html:form>
</body>
</html:html>

And <html:javascript formName="LoginForm" /> in the <head> of the jsp page.

Please help
13 years ago
Hi,

I have done one project using JSP/Servlets/EJB but i have no idea of portlets.

Could anyone give me some good free links to start my learning with ?

Thanks
Anju Sethi
13 years ago
Super Class:
javax.servlet.http.HttpServlet --> javax.servlet.genericServlet
(abstract class)

javax.servlet.genericServlet --> javax.servlet interface
13 years ago
http://www.javaworld.com/javaworld/jw-04-2006/jw-0410-html.html

This above doc will guide you thru the process of converting html to pdf.
13 years ago
jar
Thanks.
13 years ago