Sunesh Kumar

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

Recent posts by Sunesh Kumar

Hi Friends,

I had a sample.jsp which is invoked from OrcaleApps application.

I have to restrict users by accessing the sample.jsp directly. (Directly by giving the URL)

How could i can justify that the request is coming from CRM or not?

Please help me in this regards friends... struggling from 2 days on google.

Thanks in advance

16 years ago
Friends,

kindly help me out!!!
16 years ago
Dear Friends,

While saving the message I am facing the problem of "Error during saving multipart message" .. kindly help me in this regards.

env.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/");
env.addNamespaceDeclaration("xsd","http://www.w3.org/2001/XMLSchema");
env.addNamespaceDeclaration("xsi","http://www.w3.org/2001/XMLSchema-instance");
env.addNamespaceDeclaration("enc","http://schemas.xmlsoap.org/soap/encoding/");
env.addNamespaceDeclaration("tns","syniverse:uniroam");

SOAPBody bd = env.getBody();

SOAPElement bg = bd.addChildElement(env.createName("query","ans1","syniverse:uniroam"));

SOAPElement be = bg.addChildElement(env.createName("UNIRequest_1"));


be.addChildElement("companyId").addTextNode("3740").setAttribute("xsi:type","xsd:string");
be.addChildElement("dataFlag").addTextNode("N").setAttribute("xsi:type","xsd:string");
be.addChildElement("direction").addTextNode("IG").setAttribute("xsi:type","xsd:string");
be.addChildElement("min").addTextNode("1623567780").setAttribute("xsi:type","xsd:string");
be.addChildElement("subGroup").addTextNode("37").setAttribute("xsi:type","xsd:string");

out.println("<br>1...");

msg.saveChanges();
16 years ago
Friends,

Please help me, as I am struggling for a sample code.

The url mentioned is not giving me crumb.war file,

please friends help me out in this regards.
17 years ago
Dear Friends,

I am struggling to implement the concept of Breadcrumbs using struts.

Can any one help me in this regards with some sample code.
17 years ago
Dear Friends...

Can any help out in answering level 12.


Thanks in advance ...
17 years ago
Hi Friends,

How to find the datatype size in JAVA
for ex: int ->4bytes like that....


I tried for the method getSize(); but no use...

Can you please provide any idea...


Bye
18 years ago
Hi,

I am very much Thankful to you for your response.

I have only one "action" tag in <action-mappings> and i placed like this after ur suggestion.

<action-mappings>
<action>
</action>
</action-mappings>

But still the same error in the Stack is occuring...

and also this...

javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection


What can I do my dear friend...

Bye..
18 years ago
Hi Friends,

Just began the taste of Struts...

Here is My problem
javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection.

I Found some thing in my log..
Jul 13, 2006 6:44:32 PM org.apache.commons.digester.Digester fatalError
SEVERE: Parse Fatal Error at line 10 column 10: The end-tag for element type "action" must end with a '>' delimiter.
org.xml.sax.SAXParseException: The end-tag for element type "action" must end with a '>' delimiter.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)


Here is My code

account.jsp
<HTML>
<HEAD>
<TITLE> User Maintenance </TITLE>
</HEAD>

<BODY>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>

<html:form action="/account">
<table>
<tr>
<td> <bean:write name="accountBean" property="warning"> </td>
</tr>
<tr>
<td> Email </td>
<td> <html:text property="email" /> </td>
</tr>
<tr>
<td> Password </td>
<td> <html assword property="password" /> </td>
</tr>
</table>
<html:radio property="operation" value="createAccount" />Create Account
<html:radio property="operation" value="modifyAccount" />Modify Account
<html:radio property="operation" value="deleteAccount" />Delete Account
<br>
<html:submit value="Perform Selected Operation" />
</html:form>
</BODY>
</HTML>

struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>

<form-beans>
<form-bean name="accountBean" type="com.sunesh.struts.AccountBean" />
</form-beans>

<global-forwards>
<forward name="failure" path="/admin/faliure.jsp" />
</global-forwards>

<action-mappings>

<action path="/account"
type="com.sunesh.struts.AccountAction"
name="accountBean"
parameter="operation"
scope="session">

<forward name="create-success" path="/admin/create-confirm.jsp" />
<forward name="modify-success" path="/admin/modify-confirm.jsp" />
<forward name="delete-success" path="/admin/delete-confirm.jsp" />
</action>

</action-mappings>

</struts-config>

web.xml
<web-app>

<servlet>
<servlet-name>as</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
</servlet>

<servlet-class>
<servlet-name>as</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-class>

</web-app>

AccountBean.java
package com.sunesh.struts;

import org.apache.struts.action.*;

public class AccountBean extends ActionForm
{
private String email = "[email protected]";
private String password = "test";

//Variables for operation and warning messages
private String warning = "";
private String operation = "";

public String getEmail()
{
return this.email;
}

public void setEmail(String email)
{
this.email = email;
}

public String getPassword()
{
return this.password;
}

public void setpassword(String password)
{
this.password = password;
}

public String getWarning()
{
return this.warning;
}

public void setWarning(String warning)
{
this.warning = "<h2><font color=red>"+ warning + "</font></h2>";
}

public String getOperation()
{
return this.operation;
}

public void setOperation(String operation)
{
this.operation = operation;
}
}

Sorry friends for trobling you...but please help because it is eating my brain from past 3 days and I could not solve that...

And one thing more I am using my action class as "DisptachAction"...

please help me , by then I can step a head...

Bye...waiting for ur replies
18 years ago
Hi,

I too getting the same error. I am using netBeans5.0 can any ine please suggest me the solutions.

javax.servlet.ServletException: Could not connect to SMTP host: localhost, port: 25

Bye
18 years ago
Hi,

Sorry I forgot to say this..

First i am trying for only "createAccount" operation only.

But I cant even able to display the "accountMod.jsp" file

could you please help me...

Bye
18 years ago
Hi,

I too having the same problem

My Jsp:

<BODY>
<center>
<h1> Account Control </h1>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<html:form action="/AccountMod.do">
<bean:write name="accountFormBean" property="warning" filter="false" />
Email
<html:text property="email" />
Password
<html:text property="password" />
<table>
<tr>
<td><html:radio property="operation" value="createAccount" />Create Account</td>
<td><html:radio property="operation" value="modifyAccount" />Modify Account</td>
<td><html:radio property="operation" value="deleteAccount" />Delete Account</td>
</tr>
</table>
<html:submit value="Perform Selected Operation" />
</html:form>
</center>
</BODY>

ActionForm:

package com.sunesh.struts;

import org.apache.struts.action.*;

public class AccountFormBean extends ActionForm
{
private String email = "[email protected]";
private String password = "null";

//for error messages
private String warning = "";

public String getEmail()
{
return this.email;
}

public void setEmail(String email)
{
this.email = email;
}

public String getPassword()
{
return this.password;
}

public void setPassword(String password)
{
this.password = password;
}

public String getWarning()
{
return this.warning;
}

public void setWarning(String warning)
{
this.warning = "<H2>Invalid or missing <FONT color=red>" + warning + "</FONT></H2>";
}
}

struts-comfig.xml :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<form-beans>
<form-bean name="accountFormBean"
type="com.sunesh.struts.AccountFormBean" />
</form-beans>

<action-mappings>
<action path="/AccountMod"
type="com.sunesh.struts.AccountAction"
name="accountFormBean"
parameter="operation"
scope="session">

<forward name="create-success" path="admin/create-confirm.jsp" />
<forward name="create-failure" path="accountMod.jsp" />
</action>

</action-mappings>
</struts-config>


can u please help me..

Bye
18 years ago
Hi Ajith,

Really very much thanks man...


Bye...
18 years ago
Hi Ajith,

pleasee see the PM and also PM with answer and explanation plsssss



Bye...
18 years ago
Hi John,

why cant you try this...
Mailing with attachment
import java.io.*;
import java.util.*;
import javax.mail.*;
import javax.mail.event.*;
import javax.mail.internet.*;

public final class MailerBean extends Object implements Serializable {

/* Bean Properties */
private String to = null;
private String from = null;
private String subject = null;
private String message = null;
public static Properties props = null;
public static Session session = null;

static {
/*Setting Properties for STMP host */
props = System.getProperties();
props.put("mail.smtp.host", "ideal-solutions.co.in");
//session = Session.getDefaultInstance(props, null);
session = Session.getInstance(props, null);
}
/* Setter Methods */
public void setTo(String to) {
this.to = to;
}

public void setFrom(String from) {
this.from = from;
}

public void setSubject(String subject) {
this.subject = subject;
}

public void setMessage(String message) {
this.message = message;
}
/* Sends Email */
public void sendMail() throws Exception {
if(!this.everythingIsSet())
throw new Exception("Could not send email.");
try {
MimeMessage message = new MimeMessage(session);
message.setRecipient(Message.RecipientType.TO,
new InternetAddress(this.to));
message.setFrom(new InternetAddress(this.from));
message.setSubject(this.subject);
message.setText(this.message);
Transport.send(message);
import java.io.*;
import java.util.*;
import javax.mail.*;
import javax.mail.event.*;
import javax.mail.internet.*;

public final class MailerBean extends Object implements Serializable {

/* Bean Properties */
private String to = null;
private String from = null;
private String subject = null;
private String message = null;
public static Properties props = null;
public static Session session = null;

static {
/*Setting Properties for STMP host */
props = System.getProperties();
props.put("mail.smtp.host", "ideal-solutions.co.in");
//session = Session.getDefaultInstance(props, null);
session = Session.getInstance(props, null);
}
/* Setter Methods */
public void setTo(String to) {
this.to = to;
}

public void setFrom(String from) {
this.from = from;
}

public void setSubject(String subject) {
this.subject = subject;
}

public void setMessage(String message) {
this.message = message;
}
/* Sends Email */
public void sendMail() throws Exception {
if(!this.everythingIsSet())
throw new Exception("Could not send email.");
try {
MimeMessage message = new MimeMessage(session);
message.setRecipient(Message.RecipientType.TO,
new InternetAddress(this.to));
message.setFrom(new InternetAddress(this.from));
message.setSubject(this.subject);
message.setText(this.message);
Transport.send(message);
} catch (MessagingException e) {
throw new Exception(e.getMessage());
}
}

/* Checks whether all properties have been set or not */
private boolean everythingIsSet() {
if((this.to == null) || (this.from == null) ||
(this.subject == null) || (this.message == null))
return false;

if((this.to.indexOf("@") == -1) ||
(this.to.indexOf(".") == -1))
return false;

if((this.from.indexOf("@") == -1) ||
(this.from.indexOf(".") == -1))
return false;

return true;
}
}

NOTE:
u must have activation.jar and mail.jar in you lib folder..ok
hope this helps

Bye...
18 years ago