Invoking servlet from ODB using GET
I have a requirement where i need to invoke a servlet using GET. Can anyone let me know the procedute to follow in this invocation.
Your help is appreciated
Thanks,
P
Hi
Try the following way to register servlets in web.xml
<web-app>
<servlet>
<servlet-name>generateSurveyServlet</servlet-name>
<servlet-class>com.robbie.servlet.generateSurveyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>generateSurveyServlet</servlet-name>
<url-pattern>/generateSurveyServlet </url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>surveyResultsHandlerServlet</servlet-name>
<servlet-class>com.robbie.servlet.surveyResultsHandlerServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>surveyResultsHandlerServlet</servlet-name>
<url-pattern>/surveyResultsHandlerServlet </url-pattern>
</servlet-mapping>
</web-app>i hope this will clear u.
thanks,
nvseenu
Similar Messages
-
Need help to retrieve the message from MQ using get operation
Hi
Used MQ adapter to Post a message to queue.
And used Received activity in bpel to retrieve the message using MQ adapter from same queue(used get operation) , got an error message as timed
out exception.
Could some one assist in retrieving the message from MQ using get operation.
Regards
RajaHi Raja,
Is the process a empty bpel process which is used to get the message from the MQ?
Regards
Surya -
Cannot invoke servlet from JSP
I am trying to invoke a servlet from my JSP file. At present I am getting the error:
500 Internal Server Error
java.lang.IllegalArgumentException: Resource /servlet/CreateSPSS not found
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.EvermindPageContext.forward
I understand that my JSP cannot find my servlet but I cannot identify what the correct path or amendment is.
My JSP file is located in:
default-web-app/examples/jsp/com.xml2spss.jsp
In the JSP my forward parameter is :
<jsp:forward page="/servlet/CreateSPSS" />
and my servlet (.java & .class) is located in
default-web-app/WEB-INF/classes/com/pmstation/spss/site/servlet.CreateSPSS.java
I have added the following line to Web.XML:
<servlet-mapping>
<servlet-name>CreateSPSS</servlet-name>
<url-pattern>/servlet/CreateSPSS</url-pattern>
</servlet-mapping>
Where am I going wrong??
Thankyou for any help at all on this one.Shaun,
Nice to know that you find a way that works. However, what Zsolt suggests should work; otherwise, it is a bug. That is, put the servlet definition and servlet mapping in your web.xml and then you should be able to access http://host:port/myWebContext/servlet/CreateSPSS?myParmName=myParm without seeing a response like "No resource found". Please make sure that your servlet definition come before the corresponding servlet mapping. -
Hi all;
this is the process.
1. Servlet received / creates msg.
2. Servlet Enqueues Msg on JMS queue.
3. MDB dequeues.
-- processes against DB
-- composes respoonse.
4. mdb invokes servlet with response.
servlet need not maintain state.
State information can be passed in Msg (Query and Response)
I was just wanting to find out if this possible in oc4j.
apparently, there is a process in weblogic 6.1 to support this.
Any help is appreciated.
thanks.
jayantI would assume that you would need to do a "createSipApplicationSession" on your sip factory and then get the ID from there.
Then create a request from your session and send it.
Wouldn't you want each outgoing call to be associated with a different sip app session? -
Error in invoking servlet from JSP
Hi - again!
after being thoroughly reprimanded for posting on the wrong board, and hence seeing the error in my ways, all help greatly appreciated....
I have read elsewhere that it is possible to call a servlet (which produces HTML) from within a JSP, thus keeping a nice clean MVC paradigm and making it easier for non-java people to design the front-end.
I am having difficulty getting it to work and any help is much appreciated:
My servlet (Mole):
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.write("###some html stored in DB#####");
} finally {
out.close();
}my JSP:
<jsp:include page="Mole" flush="false"></jsp:include>the error I get
Internal error flushing the buffer in release()
StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
java.io.IOException: Stream closed
at org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:257)
at org.apache.jasper.runtime.JspWriterImpl.clearBuffer(JspWriterImpl.java:206)
at org.apache.jsp.CMS.services_jsp._jspService(services_jsp.java from :176)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)Any pointer as to what I am donig wrong?
many thanks
Hin your web.xml
<servlet>
<servlet-name>Mole</servlet-name>
<servlet-class>srvlt.Mole</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Mole</servlet-name>
<url-pattern>/Mole</url-pattern>
</servlet-mapping>
package srvlt;
// Import servlet packages
import javax.servlet.*;
import javax.servlet.http.*;
// Import other Java packages
import java.io.*;
public class Mole extends HttpServlet {
public void init() throws ServletException {}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.write("###some html stored in DB#####");
} finally {
out.close();
}in your jsp
<jsp:include page="/Mole" flush="false"></jsp:include> -
How to post and get data from server using Get Webrequest
Hi:-)
I'm trying to send a username and password argument my server and the server is suppose to send some string back. The following code, that I got of the web, just dies. I think this line:
HttpWebRequestpreq = result.AsyncState
asHttpWebRequest;
is null. Can you kindly fix this for me? Thank you in advance:-)
notes: I have a few textboxes with the values for the request params
I'm targeting Windows Phone 8.0 and Windows Phone 8.1 devices
privatevoidBtnSignUpSubmit_Tab(objectsender,
RoutedEventArgse)
//show error if Username == Username
if(TbUN.Text.ToString() ==
"Username")
MessageBox.Show("You
must fill in your Username in the Username textbox.\nThank you.");
return;
//make sure all fields are filled in
if(TbUN.Text.ToString() ==
""|| TbPW.Text.ToString()
== ""|| TbCPW.Text.ToString()
== "")
MessageBox.Show("All
fields must be filled in.\nThank you.");
return;
//make sure Password is the same as Confirm Password
if(TbPW.Text.CompareTo(TbCPW.Text) !=
0)
MessageBox.Show("Your
Password should be the same as Confirm Password.\nThank you.");
return;
//make sure Username contains valid characters
boolbValid = IsUsernameValid(TbUN.Text);
if(bValid)
bSignUp =
true;
//disable textboxes
TbUN.IsEnabled =
false;
TbPW.IsEnabled =
false;
TbCPW.IsEnabled =
false;
TbEmail.IsEnabled =
false;
BtnSignUpSubmit.IsEnabled =
false;
title.Text =
"requesting...";
//make Post request top-server
//add parameters
stringdata =
"username="+TbUN.Text+"&Password="+TbPW.Text;
if(TbEmail.Text.Contains("@")
&& TbEmail.Text.Contains("."))
data +=
"&email="+ TbEmail.Text;
System.
UriURL =
newUri("http://www.iclips.co.za/RegisterUsernameAndPassword.php");
WebRequestwebRequest =
WebRequest.Create(URL);
webRequest.Method =
"POST";
webRequest.ContentType =
"application/x-www-form-urlencoded";
webRequest.ContentLength = data.Length;
//we first obtain an input stream to which to write the body of the HTTP POST
webRequest.BeginGetRequestStream((
IAsyncResultresult) =>
HttpWebRequestpreq = result.AsyncState
asHttpWebRequest;
if(preq !=
null)
StreampostStream = preq.EndGetRequestStream(result);
//guess one could just accept a byte[] [via function argument] for arbitrary data types - images, audio,...
byte[] dataStream =
Encoding.UTF8.GetBytes(data);
postStream.Write(dataStream, 0, dataStream.Length);
postStream.Close();
//we can then finalize the request...
preq.BeginGetResponse((
IAsyncResultfinal_result) =>
HttpWebRequestreq = final_result.AsyncState
asHttpWebRequest;
if(req !=
null)
try
//we call the success callback as long as we get a response stream
WebResponseresponse = req.EndGetResponse(final_result);
success_callback(response.GetResponseStream());
catch(WebExceptionwe)
//otherwise call the error/failure callback
error_callback(we.Message);
return;
}, preq);
}, URL);
privatevoiderror_callback(stringp)
if(bSignUp)
bSignUp =
false;
// Show error message
MessageBox.Show("Connection
Error!\n\n"+ p);
//enable input
//disable textboxes
TbUN.IsEnabled =
true;
TbPW.IsEnabled =
true;
TbCPW.IsEnabled =
true;
TbEmail.IsEnabled =
true;
BtnSignUpSubmit.IsEnabled =
false;
title.Text =
"try again";
privatevoidsuccess_callback(Streamstream)
if(bSignUp)
bSignUp =
false;
// Open the stream using a StreamReader for easy access.
StreamReaderreader =
newStreamReader(stream);
// Read the content.
stringresponse = reader.ReadToEnd();
// Display the content.
MessageBox.Show(response);
// Clean up the streams.
reader.Close();// Directives
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using iClips.Resources;
using System.ComponentModel;
using System.Threading;
using System.IO;
using System.IO.IsolatedStorage;
using Microsoft.Devices;
using System.Windows.Media;
using Microsoft.Xna.Framework.Media;
using System.Windows.Media.Imaging;
using System.Threading.Tasks;
using System.Text;
using Windows.Storage;
using System.Windows.Threading;
using System.Diagnostics;
using System.Globalization;
namespace iClips
public partial class MainPage : PhoneApplicationPage
Boolean bSignUp;
HyperlinkButton BtnSignIn, BtnSignUp, BtnSignUpSubmit;
TextBox TbUN, TbPW, TbCPW, TbEmail;
TextBlock un, title;
System.DateTime startTime;
// Viewfinder for capturing video.
private VideoBrush videoRecorderBrush;
// Source and device for capturing video.
private CaptureSource captureSource;
private CaptureDevice vcDevice;
double w, h;
// File details for storing the recording.
private IsolatedStorageFileStream isoVideoFile;
private FileSink fileSink;
private string isoVideoFileName = "CameraMovie.mp4";
// For managing button and application state.
private enum ButtonState { Initialized, Stopped, Ready, Recording, Playback, Paused, NoChange, CameraNotSupported };
private ButtonState currentAppState;
//create reference to SocketClient
SocketClient sock = new SocketClient();
// Constructor
public MainPage()
InitializeComponent();
//setup recording
// Prepare ApplicationBar and buttons.
PhoneAppBar = (ApplicationBar)ApplicationBar;
PhoneAppBar.IsVisible = true;
StartRecording = ((ApplicationBarIconButton)ApplicationBar.Buttons[0]);
StopPlaybackRecording = ((ApplicationBarIconButton)ApplicationBar.Buttons[1]);
StartPlayback = ((ApplicationBarIconButton)ApplicationBar.Buttons[2]);
PausePlayback = ((ApplicationBarIconButton)ApplicationBar.Buttons[3]);
//display a welcome message
txtDebug.Text = "Welcome to iClips.";
string result = sock.Connect("197.189.214.116", 5000);
txtOutput.Text = result;
if(result.Contains("success")){
sock.Send("#testing_");
SetScreenResolution();
//set image on load friends
/*Uri uri = new Uri("/Assets/home_icons/myFriends.png", UriKind.Relative);
BitmapImage imgSource = new BitmapImage(uri);
Image image = new Image();
image.Source = imgSource;
load_friends.Content = image;*/
SignIn();
private void SignIn()
// remove all elements inside sign grid
for (int index = MyGrid.Children.Count - 1; index >= 0; index--)
MyGrid.Children.RemoveAt(index);
BtnSignIn = new HyperlinkButton();
BtnSignIn.Content = "<< Sign In >>";
BtnSignIn.Click += new RoutedEventHandler(SignIn_Tab);
BtnSignIn.VerticalAlignment = VerticalAlignment.Bottom;
BtnSignUp = new HyperlinkButton();
BtnSignUp.Content = "<< I'm new here. Sign Up. >>";
BtnSignUp.Click += new RoutedEventHandler(SignUp_Tab);
BtnSignUp.VerticalAlignment = VerticalAlignment.Bottom;
un = new TextBlock();
un.Text = "Enter your Username:";
un.VerticalAlignment = VerticalAlignment.Bottom;
un.HorizontalAlignment = HorizontalAlignment.Center;
TextBlock pw = new TextBlock();
pw.Text = "Enter your Password:";
pw.VerticalAlignment = VerticalAlignment.Bottom;
pw.HorizontalAlignment = HorizontalAlignment.Center;
//setup username textbox
TbUN = new TextBox();
TbUN.Opacity = 0.5;
TbUN.Text = "";
TbUN.FontSize = 16;
TbUN.FontWeight = FontWeights.ExtraBold;
TbUN.Foreground = new SolidColorBrush(Colors.Black);
TbUN.Background = new SolidColorBrush(Colors.Transparent);
TbUN.VerticalAlignment = VerticalAlignment.Top;
TbUN.Height = 70;
TbUN.Tap += TbUN_Tap;
//setup password textbox
TbPW = new TextBox();
TbPW.Opacity = 0.5;
TbPW.Text = "";
TbPW.FontSize = 16;
TbPW.FontWeight = FontWeights.ExtraBold;
TbPW.Foreground = new SolidColorBrush(Colors.Black);
TbPW.Background = new SolidColorBrush(Colors.Transparent);
TbPW.VerticalAlignment = VerticalAlignment.Top;
TbPW.Height = 70;
TbPW.Tap += TbPW_Tap;
//Show the background color of MyGrid
MyGrid.Background = new SolidColorBrush(Colors.Blue);
// Create Row for Username Textblock
RowDefinition gridRow0 = new RowDefinition();
gridRow0.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow0);
// Create Row for Username
RowDefinition gridRow1 = new RowDefinition();
gridRow1.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow1);
//create row for password Textblock
RowDefinition gridRow2a = new RowDefinition();
gridRow2a.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow2a);
//create row for password
RowDefinition gridRow2 = new RowDefinition();
gridRow2.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow2);
//create row for << Sign In >>
RowDefinition gridRow3 = new RowDefinition();
gridRow3.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow3);
//create row for << Sign Up >>
RowDefinition gridRow4 = new RowDefinition();
gridRow4.Height = new GridLength(120);
MyGrid.RowDefinitions.Add(gridRow4);
Grid.SetRow(un, 0);
Grid.SetColumn(un, 0);
Grid.SetRow(TbUN, 1);
Grid.SetColumn(TbUN, 0);
Grid.SetRow(pw, 2);
Grid.SetColumn(pw, 0);
Grid.SetRow(TbPW, 3);
Grid.SetColumn(TbPW, 0);
Grid.SetRow(BtnSignIn, 4);
Grid.SetColumn(BtnSignIn, 0);
Grid.SetRow(BtnSignUp, 5);
Grid.SetColumn(BtnSignUp, 0);
MyGrid.Children.Add(un);
MyGrid.Children.Add(TbUN);
MyGrid.Children.Add(pw);
MyGrid.Children.Add(TbPW);
MyGrid.Children.Add(BtnSignIn);
MyGrid.Children.Add(BtnSignUp);
private void SignUp_Tab(object sender, RoutedEventArgs e)
MessageBox.Show("Welcome to Sign up.\n\nYou need 3 things to create an account:\n1. A unique Case-Sensitive Username. ex 'iClips' is not the same as 'Iclips'\n2. A password to secure you account. \n3. A profile photo for easy recognition.\nThank you.");
// remove all elements inside sign grid
for (int index = MyGrid.Children.Count - 1; index >= 0; index--)
MyGrid.Children.RemoveAt(index);
//repopulate grid with Sign Up elements
//create title
title = new TextBlock();
title.Text = "--- Sign Up 1/2 ---";
title.VerticalAlignment = VerticalAlignment.Top;
title.HorizontalAlignment = HorizontalAlignment.Center;
//field for Username
TbUN = new TextBox();
TbUN.Opacity = 0.5;
TbUN.Text = "Username";
TbUN.FontSize = 16;
TbUN.FontWeight = FontWeights.ExtraBold;
TbUN.Foreground = new SolidColorBrush(Colors.Black);
TbUN.Background = new SolidColorBrush(Colors.Transparent);
TbUN.VerticalAlignment = VerticalAlignment.Top;
TbUN.Height = 70;
TbUN.Tap += TbUN_Tap;
//field for Password
TbPW = new TextBox();
TbPW.Opacity = 0.5;
TbPW.Text = "Password";
TbPW.FontSize = 16;
TbPW.FontWeight = FontWeights.ExtraBold;
TbPW.Foreground = new SolidColorBrush(Colors.Black);
TbPW.Background = new SolidColorBrush(Colors.Transparent);
TbPW.VerticalAlignment = VerticalAlignment.Top;
TbPW.Height = 70;
TbPW.Tap += TbPW_Tap;
//field Confirm for Password
TbCPW = new TextBox();
TbCPW.Opacity = 0.5;
TbCPW.Text = "Confirm Password";
TbCPW.FontSize = 16;
TbCPW.FontWeight = FontWeights.ExtraBold;
TbCPW.Foreground = new SolidColorBrush(Colors.Black);
TbCPW.Background = new SolidColorBrush(Colors.Transparent);
TbCPW.VerticalAlignment = VerticalAlignment.Top;
TbCPW.Height = 70;
TbCPW.Tap += TbCPW_Tap;
//field for Optional Email
TbEmail = new TextBox();
TbEmail.Opacity = 0.5;
TbEmail.Text = "Email (Optional)";
TbEmail.FontSize = 16;
TbEmail.FontWeight = FontWeights.ExtraBold;
TbEmail.Foreground = new SolidColorBrush(Colors.Black);
TbEmail.Background = new SolidColorBrush(Colors.Transparent);
TbEmail.VerticalAlignment = VerticalAlignment.Top;
TbEmail.Height = 70;
TbEmail.Tap += TbEmail_Tap;
HyperlinkButton BtnGoBack = new HyperlinkButton();
BtnGoBack.Content = "<< Go Back ";
BtnGoBack.Click += new RoutedEventHandler(BtnGoBack_Tab);
BtnGoBack.VerticalAlignment = VerticalAlignment.Bottom;
BtnSignUpSubmit = new HyperlinkButton();
BtnSignUpSubmit.Content = "<< Sign Up >>";
BtnSignUpSubmit.Click += new RoutedEventHandler(BtnSignUpSubmit_Tab);
BtnSignUpSubmit.VerticalAlignment = VerticalAlignment.Bottom;
// Create Row for title
RowDefinition gridRow0 = new RowDefinition();
gridRow0.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow0);
// Create Row for Username
RowDefinition gridRow1 = new RowDefinition();
gridRow1.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow1);
//create row for password Textblock
RowDefinition gridRow2a = new RowDefinition();
gridRow2a.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow2a);
//create row for Confirm password
RowDefinition gridRow2 = new RowDefinition();
gridRow2.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow2);
//create row for email
RowDefinition gridRow3 = new RowDefinition();
gridRow3.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow3);
//create row for << Sign Up >>
RowDefinition gridRow4 = new RowDefinition();
gridRow4.Height = new GridLength(120);
MyGrid.RowDefinitions.Add(gridRow4);
//create row for << Go Back >>
RowDefinition gridRow5 = new RowDefinition();
gridRow5.Height = new GridLength(120);
MyGrid.RowDefinitions.Add(gridRow5);
Grid.SetRow(title, 0);
Grid.SetColumn(title, 0);
Grid.SetRow(TbUN, 1);
Grid.SetColumn(TbUN, 0);
Grid.SetRow(TbPW, 2);
Grid.SetColumn(TbPW, 0);
Grid.SetRow(TbCPW, 3);
Grid.SetColumn(TbCPW, 0);
Grid.SetRow(TbEmail, 4);
Grid.SetColumn(TbEmail, 0);
Grid.SetRow(BtnSignUpSubmit, 5);
Grid.SetColumn(BtnSignUpSubmit, 0);
Grid.SetRow(BtnGoBack, 6);
Grid.SetColumn(BtnGoBack, 0);
MyGrid.Children.Add(title);
MyGrid.Children.Add(TbUN);
MyGrid.Children.Add(TbPW);
MyGrid.Children.Add(TbCPW);
MyGrid.Children.Add(TbEmail);
MyGrid.Children.Add(BtnSignUpSubmit);
MyGrid.Children.Add(BtnGoBack);
BtnSignUp.Content = "<< Sign Up >>";
private bool IsUsernameValid(string str)
int d;
if (str.Length > 30)
MessageBox.Show("You may only use a maximum of 30 characters for your Username.\nThank you.");
return false;
for (d = 0; d < str.Length; d++)
if (str.Contains("~") || str.Contains("!") || str.Contains("@") || str.Contains("$")
|| str.Contains("#") || str.Contains("%") || str.Contains("|") || str.Contains("_"))
MessageBox.Show("Your Username may not contain any of the follwing characters: \n~ ! @ # $ % | _\nThank you.");
return false;
return true;
private void BtnSignUpSubmit_Tab(object sender, RoutedEventArgs e)
//show error if Username == Username
if (TbUN.Text.ToString() == "Username")
MessageBox.Show("You must fill in your Username in the Username textbox.\nThank you.");
return;
//make sure all fields are filled in
if (TbUN.Text.ToString() == "" || TbPW.Text.ToString() == "" || TbCPW.Text.ToString() == "")
MessageBox.Show("All fields must be filled in.\nThank you.");
return;
//make sure Password is the same as Confirm Password
if (TbPW.Text.CompareTo(TbCPW.Text) != 0)
MessageBox.Show("Your Password should be the same as Confirm Password.\nThank you.");
return;
//make sure Username contains valid characters
bool bValid = IsUsernameValid(TbUN.Text);
if (bValid)
bSignUp = true;
//disable textboxes
TbUN.IsEnabled = false;
TbPW.IsEnabled = false;
TbCPW.IsEnabled = false;
TbEmail.IsEnabled = false;
BtnSignUpSubmit.IsEnabled = false;
title.Text = "requesting...";
//make Post request top-server
//add parameters
string data = "username="+TbUN.Text+"&Password="+TbPW.Text;
if(TbEmail.Text.Contains("@") && TbEmail.Text.Contains("."))
data += "&email=" + TbEmail.Text;
System.Uri URL = new Uri("http://www.iclips.co.za/RegisterUsernameAndPassword.php");
WebRequest webRequest = WebRequest.Create(URL);
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.ContentLength = data.Length;
//we first obtain an input stream to which to write the body of the HTTP POST
webRequest.BeginGetRequestStream((IAsyncResult result) =>
HttpWebRequest preq = result.AsyncState as HttpWebRequest;
if (preq != null)
Stream postStream = preq.EndGetRequestStream(result);
//guess one could just accept a byte[] [via function argument] for arbitrary data types - images, audio,...
byte[] dataStream = Encoding.UTF8.GetBytes(data);
postStream.Write(dataStream, 0, dataStream.Length);
postStream.Close();
//we can then finalize the request...
preq.BeginGetResponse((IAsyncResult final_result) =>
HttpWebRequest req = final_result.AsyncState as HttpWebRequest;
if (req != null)
try
//we call the success callback as long as we get a response stream
WebResponse response = req.EndGetResponse(final_result);
success_callback(response.GetResponseStream());
catch (WebException we)
//otherwise call the error/failure callback
error_callback(we.Message);
return;
}, preq);
}, URL);
private void error_callback(string p)
if (bSignUp)
bSignUp = false;
// Show error message
MessageBox.Show("Connection Error!\n\n" + p);
//enable input
//disable textboxes
TbUN.IsEnabled = true;
TbPW.IsEnabled = true;
TbCPW.IsEnabled = true;
TbEmail.IsEnabled = true;
BtnSignUpSubmit.IsEnabled = false;
title.Text = "try again";
private void success_callback(Stream stream)
if (bSignUp)
bSignUp = false;
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(stream);
// Read the content.
string response = reader.ReadToEnd();
// Display the content.
MessageBox.Show(response);
// Clean up the streams.
reader.Close();
private void BtnGoBack_Tab(object sender, RoutedEventArgs e)
SignIn();
private void TbEmail_Tap(object sender, System.Windows.Input.GestureEventArgs e)
TbEmail.SelectAll();
private void TbCPW_Tap(object sender, System.Windows.Input.GestureEventArgs e)
TbCPW.SelectAll();
private void SignIn_Tab(object sender, RoutedEventArgs e)
if (TbUN.Text.ToString() == "" || TbPW.Text.ToString() == "")
MessageBox.Show("Your Username or Password cannot be empty.\nThank you.");
return;
private void TbUN_Tap(object sender, System.Windows.Input.GestureEventArgs e)
TbUN.SelectAll();
un.Text = "Usernames are Case-Sensitive.\n'Iclips' is not the same as 'iClips'.";
private void TbPW_Tap(object sender, System.Windows.Input.GestureEventArgs e)
TbPW.SelectAll();
protected override void OnNavigatedTo(NavigationEventArgs e)
base.OnNavigatedTo(e);
// Initialize the video recorder.
InitializeVideoRecorder();
CameraButtons.ShutterKeyHalfPressed += OnButtonHalfPress;
// The event is fired when the shutter button receives a full press.
CameraButtons.ShutterKeyPressed += OnButtonFullPress;
// The event is fired when the shutter button is released.
CameraButtons.ShutterKeyReleased += OnButtonRelease;
protected override void OnNavigatedFrom(NavigationEventArgs e)
// Dispose of camera and media objects.
DisposeVideoPlayer();
DisposeVideoRecorder();
base.OnNavigatedFrom(e);
CameraButtons.ShutterKeyHalfPressed -= OnButtonHalfPress;
CameraButtons.ShutterKeyPressed -= OnButtonFullPress;
CameraButtons.ShutterKeyReleased -= OnButtonRelease;
// Ensure that the viewfinder is upright in LandscapeRight.
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
if (vcDevice != null)
if (e.Orientation == PageOrientation.LandscapeLeft)
txtDebug.Text = "LandscapeLeft";
videoRecorderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 90 };
//rotate logo
if (logo != null)
RotateTransform rt = new RotateTransform();
rt.Angle = 90;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
logo.RenderTransformOrigin = new Point(0.5, 0.5);
logo.RenderTransform = rt;
//rotate sign in link
if (MyGrid != null)
RotateTransform rt = new RotateTransform();
rt.Angle = 90;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
MyGrid.RenderTransformOrigin = new Point(0.5, 0.5);
MyGrid.RenderTransform = rt;
if (e.Orientation == PageOrientation.PortraitUp)
txtDebug.Text = "PortraitUp";
videoRecorderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 0 };
//rotate logo
if (logo != null)
RotateTransform rt = new RotateTransform();
rt.Angle = 0;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
logo.RenderTransformOrigin = new Point(0.5, 0.5);
logo.RenderTransform = rt;
//rotate sign in link
if (MyGrid != null)
RotateTransform rt = new RotateTransform();
rt.Angle = 0;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
MyGrid.RenderTransformOrigin = new Point(0.5, 0.5);
MyGrid.RenderTransform = rt;
if (e.Orientation == PageOrientation.LandscapeRight)
txtDebug.Text = "LandscapeRight";
// Rotate for LandscapeRight orientation.
//videoRecorderBrush.RelativeTransform =
//new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 180 };
//rotate logo
if (logo != null)
RotateTransform rt = new RotateTransform();
rt.Angle = -90;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
logo.RenderTransformOrigin = new Point(0.5, 0.5);
logo.RenderTransform = rt;
//rotate sign in link
if (MyGrid != null)
RotateTransform rt = new RotateTransform();
rt.Angle = -90;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
MyGrid.RenderTransformOrigin = new Point(0.5, 0.5);
MyGrid.RenderTransform = rt;
if (e.Orientation == PageOrientation.PortraitDown)
txtDebug.Text = "PortraitDown";
videoRecorderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 270 };
// Provide auto-focus with a half button press using the hardware shutter button.
private void OnButtonHalfPress(object sender, EventArgs e)
// Focus when a capture is not in progress.
try
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "Half Button Press: Auto Focus";
catch (Exception focusError)
// Cannot focus when a capture is in progress.
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = focusError.Message;
// Capture the image with a full button press using the hardware shutter button.
private void OnButtonFullPress(object sender, EventArgs e)
// Focus when a capture is not in progress.
try
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "Full Button Press: Auto Focus";
catch (Exception focusError)
// Cannot focus when a capture is in progress.
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = focusError.Message;
// Cancel the focus if the half button press is released using the hardware shutter button.
private void OnButtonRelease(object sender, EventArgs e)
try
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "Shutter is released: Auto Focus";
catch (Exception focusError)
// Cannot focus when a capture is in progress.
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = focusError.Message;
// Update the buttons and text on the UI thread based on app state.
private void UpdateUI(ButtonState currentButtonState, string statusMessage)
// Run code on the UI thread.
Dispatcher.BeginInvoke(delegate
switch (currentButtonState)
// When the camera is not supported by the phone.
case ButtonState.CameraNotSupported:
StartRecording.IsEnabled = false;
StopPlaybackRecording.IsEnabled = false;
StartPlayback.IsEnabled = false;
PausePlayback.IsEnabled = false;
break;
// First launch of the application, so no video is available.
case ButtonState.Initialized:
StartRecording.IsEnabled = true;
StopPlaybackRecording.IsEnabled = false;
StartPlayback.IsEnabled = false;
PausePlayback.IsEnabled = false;
break;
// Ready to record, so video is available for viewing.
case ButtonState.Ready:
StartRecording.IsEnabled = true;
StopPlaybackRecording.IsEnabled = false;
StartPlayback.IsEnabled = true;
PausePlayback.IsEnabled = false;
break;
// Video recording is in progress.
case ButtonState.Recording:
StartRecording.IsEnabled = false;
StopPlaybackRecording.IsEnabled = true;
StartPlayback.IsEnabled = false;
PausePlayback.IsEnabled = false;
break;
// Video playback is in progress.
case ButtonState.Playback:
StartRecording.IsEnabled = false;
StopPlaybackRecording.IsEnabled = true;
StartPlayback.IsEnabled = false;
PausePlayback.IsEnabled = true;
break;
// Video playback has been paused.
case ButtonState.Paused:
StartRecording.IsEnabled = false;
StopPlaybackRecording.IsEnabled = true;
StartPlayback.IsEnabled = true;
PausePlayback.IsEnabled = false;
break;
default:
break;
// Display a message.
txtDebug.Text = statusMessage;
// Note the current application state.
currentAppState = currentButtonState;
public void InitializeVideoRecorder()
if (captureSource == null)
// Create the VideoRecorder objects.
captureSource = new CaptureSource();
fileSink = new FileSink();
vcDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();
// Add eventhandlers for captureSource.
captureSource.CaptureFailed += new EventHandler<ExceptionRoutedEventArgs>(OnCaptureFailed);
// Initialize the camera if it exists on the phone.
if (vcDevice != null)
// Create the VideoBrush for the viewfinder.
videoRecorderBrush = new VideoBrush();
videoRecorderBrush.SetSource(captureSource);
// Display the viewfinder image on the rectangle.
viewfinderRectangle.Fill = videoRecorderBrush;
// Start video capture and display it on the viewfinder.
captureSource.Start();
// Set the button state and the message.
UpdateUI(ButtonState.Initialized, "Tap record to start recording...");
else
// Disable buttons when the camera is not supported by the phone.
UpdateUI(ButtonState.CameraNotSupported, "A camera is not supported on this phone.");
// Set recording state: start recording.
private void StartVideoRecording()
try
// Connect fileSink to captureSource.
if (captureSource.VideoCaptureDevice != null
&& captureSource.State == CaptureState.Started)
captureSource.Stop();
// Connect the input and output of fileSink.
fileSink.CaptureSource = captureSource;
fileSink.IsolatedStorageFileName = isoVideoFileName;
// Begin recording.
if (captureSource.VideoCaptureDevice != null
&& captureSource.State == CaptureState.Stopped)
captureSource.Start();
// Set the button states and the message.
UpdateUI(ButtonState.Recording, "Recording...");
StartTimer();
// If recording fails, display an error.
catch (Exception e)
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "ERROR: " + e.Message.ToString();
//start the timer
private void StartTimer()
dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
dispatcherTimer.Start();
startTime = System.DateTime.Now;
private void StopTimer()
dispatcherTimer.Stop();
private void dispatcherTimer_Tick(object sender, EventArgs e)
System.DateTime now = System.DateTime.Now;
txtRecTime.Text = now.Subtract(startTime).ToString();
// Set the recording state: stop recording.
private void StopVideoRecording()
try
// Stop recording.
if (captureSource.VideoCaptureDevice != null
&& captureSource.State == CaptureState.Started)
captureSource.Stop();
// Disconnect fileSink.
fileSink.CaptureSource = null;
fileSink.IsolatedStorageFileName = null;
// Set the button states and the message.
UpdateUI(ButtonState.Stopped, "Preparing viewfinder...");
StopTimer();
StartVideoPreview();
// If stop fails, display an error.
catch (Exception e)
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "ERROR: " + e.Message.ToString();
// Set the recording state: display the video on the viewfinder.
private void StartVideoPreview()
try
// Display the video on the viewfinder.
if (captureSource.VideoCaptureDevice != null
&& captureSource.State == CaptureState.Stopped)
// Add captureSource to videoBrush.
videoRecorderBrush.SetSource(captureSource);
// Add videoBrush to the visual tree.
viewfinderRectangle.Fill = videoRecorderBrush;
captureSource.Start();
// Set the button states and the message.
UpdateUI(ButtonState.Ready, "Ready to record.");
// If preview fails, display an error.
catch (Exception e)
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "ERROR: " + e.Message.ToString();
// Start the video recording.
private void StartRecording_Click(object sender, EventArgs e)
// Avoid duplicate taps.
StartRecording.IsEnabled = false;
StartVideoRecording();
// Handle stop requests.
private void StopPlaybackRecording_Click(object sender, EventArgs e)
// Avoid duplicate taps.
StopPlaybackRecording.IsEnabled = false;
// Stop during video recording.
if (currentAppState == ButtonState.Recording)
StopVideoRecording();
// Set the button state and the message.
UpdateUI(ButtonState.NoChange, "Recording stopped.");
// Stop during video playback.
else
// Remove playback objects.
DisposeVideoPlayer();
StartVideoPreview();
// Set the button state and the message.
UpdateUI(ButtonState.NoChange, "Playback stopped.");
// Start video playback.
private void StartPlayback_Click(object sender, EventArgs e)
// Avoid duplicate taps.
StartPlayback.IsEnabled = false;
// Start video playback when the file stream exists.
if (isoVideoFile != null)
VideoPlayer.Play();
// Start the video for the first time.
else
// Stop the capture source.
captureSource.Stop();
// Remove VideoBrush from the tree.
viewfinderRectangle.Fill = null;
// Create the file stream and attach it to the MediaElement.
isoVideoFile = new IsolatedStorageFileStream(isoVideoFileName,
FileMode.Open, FileAccess.Read,
IsolatedStorageFile.GetUserStoreForApplication());
VideoPlayer.SetSource(isoVideoFile);
// Add an event handler for the end of playback.
VideoPlayer.MediaEnded += new RoutedEventHandler(VideoPlayerMediaEnded);
// Start video playback.
VideoPlayer.Play();
// Set the button state and the message.
UpdateUI(ButtonState.Playback, "Playback started.");
// Pause video playback.
private void PausePlayback_Click(object sender, EventArgs e)
// Avoid duplicate taps.
PausePlayback.IsEnabled = false;
// If mediaElement exists, pause playback.
if (VideoPlayer != null)
VideoPlayer.Pause();
// Set the button state and the message.
UpdateUI(ButtonState.Paused, "Playback paused.");
private void DisposeVideoPlayer()
if (VideoPlayer != null)
// Stop the VideoPlayer MediaElement.
VideoPlayer.Stop();
// Remove playback objects.
VideoPlayer.Source = null;
isoVideoFile = null;
// Remove the event handler.
VideoPlayer.MediaEnded -= VideoPlayerMediaEnded;
private void DisposeVideoRecorder()
if (captureSource != null)
// Stop captureSource if it is running.
if (captureSource.VideoCaptureDevice != null
&& captureSource.State == CaptureState.Started)
captureSource.Stop();
// Remove the event handler for captureSource.
captureSource.CaptureFailed -= OnCaptureFailed;
// Remove the video recording objects.
captureSource = null;
vcDevice = null;
fileSink = null;
videoRecorderBrush = null;
// If recording fails, display an error message.
private void OnCaptureFailed(object sender, ExceptionRoutedEventArgs e)
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "ERROR: " + e.ErrorException.Message.ToString();
// Display the viewfinder when playback ends.
public void VideoPlayerMediaEnded(object sender, RoutedEventArgs e)
// Remove the playback objects.
DisposeVideoPlayer();
StartVideoPreview();
public void SetScreenResolution()
w = Application.Current.Host.Content.ActualWidth;
h = Application.Current.Host.Content.ActualHeight;
setResViewF(w, h);
public void setResViewF(double width, double height)
viewfinderRectangle.Width = width;
viewfinderRectangle.Height = height;
resMI.Content = "resolution: " + width + "*" + height;
private void resMI_Click(object sender, RoutedEventArgs e)
switch (resMI.Content.ToString())
case "resolution: 176*220":
setResViewF(240, 320);
break;
case "resolution: 240*320":
setResViewF(360, 480);
break;
case "resolution: 360*480":
setResViewF(480, 800);
break;
case "resolution: 480*800":
setResViewF(1440, 720);
break;
case "resolution: 1440*720":
setResViewF(1920, 1080);
break;
case "resolution: 1920*1080":
setResViewF(176, 220);
break;
default:
setResViewF(176, 220);
break;
public void WriteToFile(string key, string value)
var Iso_settings = System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings;
if (!Iso_settings.Contains(key))
Iso_settings.Add(key, value);
Iso_settings.Save();//This will save your data in isolated storage.
public string ReadFromFile(string key)
var Iso_settings = System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings;
if (Iso_settings.Contains(key))
return (string)Iso_settings[key];
else
return null;
public DispatcherTimer dispatcherTimer { get; set; }
private void ToggleZoom(MediaElement media)
if (media.Stretch != Stretch.UniformToFill)
// zoom
media.Stretch = Stretch.UniformToFill;
else
// unzoom
media.Stretch = Stretch.Uniform;
BtnSignUpSubmit_Tab is the HyperLinkButton that would trigger the web request process. I need this code to work perfectly because a lot of people will use this. If you can simplify the http web request that already feels so good. Thank you. -
Invoking servlet from server (tomcat 5.5) at regular interval
Hi all
My problem is I want to send mail on 1st day of every month through form my application. But for that I don�t want to login my application. It should fire automatically from server. I am using Tomcat 5.5 for my application. This process also involved talking to database.
Is there any to achieve this?
Please help me.
Thanks in advance.these are the results of the "servlet context listener" key on google.
http://edocs.bea.com/wls/docs70/webapp/app_events.html
http://publib.boulder.ibm.com/infocenter/wasinfo/v5r1//index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/rweb_listeners.html
Regards,
Sebastien Degardin -
Syntax for invoking servlet from form in a servlet context
Hi all,
I have a web application called A, put all related files in a directory B. I deployed
some JSPs into a directory C under B. Within a jsp called c.jsp in C, a servlet
is called in a form. What syntax should I use to call the servlet properly. For
the given web application A, the url syntax for it is http://server/A/C/c.jsp.
I used 'action=servlet', 'action=/servlet', but failed. For 'action=servlet',
the user is directed to http://server/A/C/servlet. The other is http://server/servlet.
Both are not correct. Any ideas?
Thanks,
Lijun
What is the servlet-mapping in the web.xml file? If this is your servlet mapping:
<servlet>
<servlet-name>CookieCounter</servlet-name>
<servlet-class>examples.servlets.CookieCounter</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CookieCounter</servlet-name>
<url-pattern>monster</url-pattern>
</servlet-mapping>
Then the appropriate action is action=monster (or possibly action=../monster).
Hope this helps,
Robert
Lijun wrote:
> Hi all,
>
> I have a web application called A, put all related files in a directory B. I deployed
> some JSPs into a directory C under B. Within a jsp called c.jsp in C, a servlet
> is called in a form. What syntax should I use to call the servlet properly. For
> the given web application A, the url syntax for it is http://server/A/C/c.jsp.
> I used 'action=servlet', 'action=/servlet', but failed. For 'action=servlet',
> the user is directed to http://server/A/C/servlet. The other is http://server/servlet.
> Both are not correct. Any ideas?
>
> Thanks,
> Lijun
-
Cann't invoke servlet from my own browser
Hi Techies,
I have my written browser , which can invoke the www pages, but when i try to invoke my servlet , it doesn't show me the desired page and output like
<?xml version1.0
(which is starting of deployment , web.xml file)
Can anybody give some tips/suggestions??
Many thanks in advance....
VaibhsYes the file which is responsible for deployment is the web.xml file.If you do not mind send me this file to check it.It can be an error in the Context TAG.
-
How to pass parameters/atrributes to Servlet from ALBPM
HI Friends,
I am invoking servlet from bpm using server configuration, i am able to invoke servlet, but not able to pass parameters dynamically,
Also I like to receive response parameters/attributes from servlets?
Can any body help me on this?
Look forward for response.
CheersSome helpful Docs on the WebServer component for you:
The WebServer component is used to send HTTP requests to an HTTP server and capture the responses. It supports HTTP methods GET and POST.
The body of the HTTP response is available in the WebServer.response attribute (String).
Note: This component is superseded by the Fuego.NetX.AdvancedWebServer component, which provides better performance and more functionality like support for proxies and for more HTTP methods (like PUT and DELETE).
Example: Get Oracle's website home page and save it to a file.
getFrom(WebServer, url : "http://oracle.com", args : null)
binaryResponse = Binary(text: WebServer.response,
encoding: "UTF8")
BinaryFile.writeFromBinaryTo(data : binaryResponse,
name : "/tmp/oracle_index.html",
append : false) -
Calling servlet from java page flow
Hi,
I need to call servelt class from the <netui:anchor ..> tag of my jpf.
i have mapped this servlet class in the web.xml.
please tell us how to invoke servlet from the netui:anchor tag from the jpf action
method.
thanks
shashiI am calling a Servlet from JAVA Class as I am using IDE: Eclipse. The Problem is below
URL url = new URL(ServletPath);
URLConnection connet = url.openConnection();Why should the Servlet running in different Runtime print on your Eclipse Runtime. Please be more clear about the question. -
How can I invoke servlet from an <af:form> tag ?
Hi Zaro,
it depends what you'd like to do.
1. Put the result into the page: Use normal links, eg. <af:objectImage source="/graphservlet"/>2. Use it as a navigation step: edit your faces-config.xml
--olaf -
Hi,
I have written a program that takes the email id and password from a jsp page and posts it to a servlet. The servlet had to get the parameters from the jsp and pass this values to a method called loginvalidation which inturn has to connect to data source and return true if the record exists else false if it doesn't exist. Now my problem is that the control is not passed from the jsp to the servlet(name:Login). It throws an Illegal access exception. What can be the problem? Can u provide a solution for this.
The problem here is that your servlet doesn't implement doGet()
doing a response.sendRedirect sends a web page back to the client, which then tries to load the servlet.
It uses GET instead of POST because it is a standard URL link.
Solution: implement doGet() in your servlet, even if all it does is call doPost() to do the same thing.
You can also do a jsp:include, or jsp:forward to transfer control from a jsp to a servlet.
However you are working in HTML, and you may not be able to get away from using an HTML form.
Cheers,
evnafets -
How to invoke a servlet from an application-URGENT
Hi,
My requirement is as follows :
I have to invoke a servlet from a client application. I am using
java.net.URL and java.netURLConnection classes to
open a connection and invoke the servlet.
I am using WebLogic5.1
my code snippet is as follows :
URL url = new URL("http://localhost:7001/urlservlet");
URLConnection connection = url.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.setDoInput(true);
PrintStream outStream = new PrintStream( connection.getOutputStream() );
outStream.print("message=hai");
outStream.flush();
outStream.close();
When I execute the application, Webloigc server console is displaying the
following line.
<Listen Thread> Adding Address : <machine name><ip address>
But the service method of servlet is not getting invoked at all.
Help me to find the answer.
Jeelani
jeelani <[email protected]> wrote:
> Hi Dimitri,
> Thanks a lot.That worked for me.
> But if I want to send java objects (Vectors,beans),what is the best way to
> do it.
> This is exactly what our requirement is..
If you want to send Java object you have to use POST:
URLConnection conn = ...
conn.setDoOutput(true); // makes this a POST
OutputStream os = conn.getOutputStream();
...write your objects here...
os.flush();
os.close();
InputStream in = conn.getInputStream(); // sends data to the server and
// opens input stream
..read servlet response..
.. ot just close the stream...
in.close();
> my client application need to send some java components to our main server
> located in our head office.The servlet will read the objects and execute the
> functionality..
> I really appreciate for the fast response from you.
> Dimitri Rakitine <[email protected]> wrote in message
> news:[email protected]...
>> Try it like this:
>>
>> URL url = new URL("http://localhost:7001/urlservlet?message=hai");
>> URLConnection connection = url.openConnection();
>> InputStream in = connection.getInputStream();
>> in.close();
>>
>>
>> jeelani <[email protected]> wrote:
>> > Thanks for the quick response.
>>
>> > Actually right now it doesn't matter whether it is by GET or by POST.
>> > Add my clinet application just needs to send data to Servlet and nothing
> to
>> > get in return.Thats why I am using connection.getOutputStream().
>>
>> > since application will not be reading anything from servlet, I don't
>> > think it is required to use connection.getInputStream().
>> > (I am sorry, if I am wrong).
>>
>> > Can you please help me out. weblogic server is able to get the address
>> > from where the request is coming. Only problem is servlet is not getting
>> > invoked.
>>
>> > regards,
>> > Jeelani
>>
>>
>> > Dimitri Rakitine <[email protected]> wrote in message
>> > news:[email protected]...
>> >> Are you trying to do get or post? First you set method to GET
>> >> and then you do the POST.
>> >>
>> >> And add InputStream is = connection.getInputStream() - that will
>> >> result in HttpURLConnection sending data to the server and getting
>> >> back the response.
>> >>
>> >> jeelani <[email protected]> wrote:
>> >> > Hi,
>> >>
>> >> > My requirement is as follows :
>> >>
>> >> > I have to invoke a servlet from a client application. I am using
>> >> > java.net.URL and java.netURLConnection classes to
>> >> > open a connection and invoke the servlet.
>> >>
>> >> > I am using WebLogic5.1
>> >>
>> >> > my code snippet is as follows :
>> >>
>> >> > URL url = new URL("http://localhost:7001/urlservlet");
>> >>
>> >> > URLConnection connection = url.openConnection();
>> >>
>> >> > connection.setRequestMethod("GET");
>> >> > connection.setDoOutput(true);
>>
>> >> > PrintStream outStream = new
>> > PrintStream( connection.getOutputStream() );
>> >> > outStream.print("message=hai");
>> >> > outStream.flush();
>> >> > outStream.close();
>> >>
>> >> > When I execute the application, Webloigc server console is displaying
>> > the
>> >> > following line.
>> >>
>> >> > <Listen Thread> Adding Address : <machine name><ip address>
>> >>
>> >> > But the service method of servlet is not getting invoked at all.
>> >>
>> >> > Help me to find the answer.
>> >>
>> >> > Jeelani
>> >>
>> >> --
>> >> Dimitri
>> >> http://dima.dhs.org
>>
>>
>>
>> --
>> Dimitri
>> http://dima.dhs.org
Dimitri
http://dima.dhs.org
-
How get data in servlet from selected recotrd
I want set on my UIX site new button which after click will invoke servlet. In this servlet, I need a method which get data from selected record and write it to file. I have two questions. What kind of button I have to use to send data from selected record on my UIX site and how can I get selected data in servlet (I don't know a method - request.getParameter("column_name") doesn't work) It's very important for me. Please anyone response ?
If you are using ADF you can how which row were selected using the following code
tableClients.setRowIndex(
Integer.parseInt(
(String)
tableClients.getSelectionState().getKeySet().iterator().next()));
client = (Client) tableClients.getRowData();
assuming that the <af:table> have a binding to a managed bean and that it have an "selection" facet and you include your command button in these facet
to write to a file check java.sun.com and look for BufferedWriter or BufferedOutputStream
Atilio
Maybe you are looking for
-
Installed 7.2 on my Core 2 Duo iMac, and now the program won't launch. I click the icon in the dock, and it appears to launch, but the main window never comes up. I can't even force quit the application; I have to completely restart the machine to ge
-
Change start date of an object..
hello guru's, i was wondering if the start date for objects like org unit or possition or job can be changed or we can only delimit or delete it...and if the start date can be changed then how can we do it...
-
Availability Check from CRM using ECC / Assembly Order
Hi, we're using an ATP Check from ECC to CRM 5.0. As described in the SAP Notes, assembly orders are not supported in this ATP scenario. Does anybody have experience to overcome this (without implementing APO or creating the orders directly in ECC)?
-
Disable Throttling event from client side
As a user of flash player, can i disable the Throttling event introduce from flash player 11.2? I am using a pc and not using phone to play flash game, it hang when the screen not in focus or minimize. Thanks.
-
Warning Upgrade with Mac OS version 10.4.5 deleted all mails + address book
This should not happen. All my old (inbox, outbox) mails and my address book are missing after I uppgrated my Mac OS vesion from 10.4.4 to 10.4.5. There was no ask for Archive and Install so I have no old file versions saved. Is there any possibility